net.officefloor.eclipse.extension
Class ExtensionUtil

java.lang.Object
  extended by net.officefloor.eclipse.extension.ExtensionUtil

public class ExtensionUtil
extends Object

Utility class for working with extensions.

Author:
Daniel Sagenschneider

Nested Class Summary
protected static interface ExtensionUtil.SourceClassExtractor<E>
          Extracts the Source Class from the extension.
 
Constructor Summary
protected ExtensionUtil()
          All access via static methods.
 
Method Summary
static List<AdministratorSourceExtension> createAdministratorSourceExtensionList()
          Creates the listing of AdministratorSourceExtension instances.
static Map<String,AdministratorSourceExtension> createAdministratorSourceExtensionMap()
          Creates the map of AdministratorSourceExtension instances by their respective AdministratorSource class name.
static Map<String,ExtensionClasspathProvider> createClasspathProvidersByExtensionClassNames()
          Obtains the map of ExtensionClasspathProvider instances by the extension class name.
static
<T> List<T>
createExecutableExtensions(String extensionId, Class<T> type)
          Creates the executable extensions for the particular extension.
static List<ExtensionClasspathProvider> createExtensionClasspathProviderList()
          Creates the listing of ExtensionClasspathProvider instances.
static Map<String,ExtensionClasspathProvider> createExtensionClasspathProviderMap()
          Creates the map of ExtensionClasspathProvider instances by their respective class name.
static List<GovernanceSourceExtension> createGovernanceSourceExtensionList()
          Creates the listing of GovernanceSourceExtension instances.
static Map<String,GovernanceSourceExtension> createGovernanceSourceExtensionMap()
          Creates the map of GovernanceSourceExtension instances by their respective GovernanceSource class name.
static List<ManagedObjectSourceExtension> createManagedObjectSourceExtensionList()
          Creates the listing of ManagedObjectSourceExtension instances.
static Map<String,ManagedObjectSourceExtension> createManagedObjectSourceExtensionMap()
          Creates the map of ManagedObjectSourceExtension instances by their respective ManagedObjectSource class name.
static List<OfficeSourceExtension> createOfficeSourceExtensionList()
          Creates the listing of OfficeSourceExtension instances.
static Map<String,OfficeSourceExtension> createOfficeSourceExtensionMap()
          Creates the map of OfficeSourceExtension instances by their respective OfficeSource class name.
static List<SectionSourceExtension> createSectionSourceExtensionList()
          Creates the listing of SectionSourceExtension instances.
static Map<String,SectionSourceExtension> createSectionSourceExtensionMap()
          Creates the map of SectionSourceExtension instances by their respective SectionSource class name.
static
<E> List<E>
createSourceExtensionList(Map<String,E> sourceExtensionMap)
          Transforms the map of source extensions into a list of source extension sorted by the source class name of the source extension.
protected static
<E> Map<String,E>
createSourceExtensionMap(String extensionId, Class<E> extensionType, ExtensionUtil.SourceClassExtractor<E> extractor)
          Creates the map of Source Class extensions by the Source Class name.
static List<TeamSourceExtension> createTeamSourceExtensionList()
          Creates the listing of TeamSourceExtension instances.
static Map<String,TeamSourceExtension> createTeamSourceExtensionMap()
          Creates the map of TeamSourceExtension instances by their respective TeamSource class name.
static List<WorkSourceExtension> createWorkSourceExtensionList()
          Creates the listing of WorkSourceExtension instances.
static Map<String,WorkSourceExtension> createWorkSourceExtensionMap()
          Creates the map of WorkSourceExtension instances by their respective WorkSource class name.
static String getExtensionId(String name)
          Obtains the extension id for the input extension name.
static boolean isIgnoreSource(Class<?> sourceClass)
          Indicates if the input Class is to be ignored (in other words annotated with TestSource or PrivateSource).
static boolean isIgnoreSource(String sourceClassName, ClassLoader classLoader)
          Convenience method to determine if the source class is annotated with TestSource or PrivateSource.
static void openAdministratorSource(String administratorSourceClassName, PropertyList properties, AbstractOfficeFloorEditor<?,?> editor)
          Opens the AdministratorSource.
static void openGovernanceSource(String governanceSourceClassName, PropertyList properties, AbstractOfficeFloorEditor<?,?> editor)
          Opens the GovernanceSource.
static void openManagedObjectSource(String managedObjectSourceClassName, PropertyList properties, AbstractOfficeFloorEditor<?,?> editor)
          Opens the ManagedObjectSource.
static void openOfficeSource(String officeSourceClassName, String officeLocation, PropertyList properties, AbstractOfficeFloorEditor<?,?> editor)
          Opens the OfficeSource.
static void openSectionSource(String sectionSourceClassName, String sectionLocation, PropertyList properties, AbstractOfficeFloorEditor<?,?> editor)
          Opens the SectionSource.
static void openTeamSource(String teamSourceClassName, PropertyList properties, AbstractOfficeFloorEditor<?,?> editor)
          Opens the TeamSource.
static void openWorkSource(String workSourceClassName, PropertyList properties, AbstractOfficeFloorEditor<?,?> editor)
          Opens the WorkSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensionUtil

protected ExtensionUtil()
All access via static methods.

Method Detail

getExtensionId

public static String getExtensionId(String name)
Obtains the extension id for the input extension name.

Parameters:
extensionName - Name of the extension.
Returns:
Id for the extension.

createWorkSourceExtensionMap

public static Map<String,WorkSourceExtension> createWorkSourceExtensionMap()
Creates the map of WorkSourceExtension instances by their respective WorkSource class name.

Returns:
Map of WorkSourceExtension instances by their respective WorkSource class name.

createWorkSourceExtensionList

public static List<WorkSourceExtension> createWorkSourceExtensionList()
Creates the listing of WorkSourceExtension instances.

Returns:
Listing of WorkSourceExtension instances.

createManagedObjectSourceExtensionMap

public static Map<String,ManagedObjectSourceExtension> createManagedObjectSourceExtensionMap()
Creates the map of ManagedObjectSourceExtension instances by their respective ManagedObjectSource class name.

Returns:
Map of ManagedObjectSourceExtension instances by their respective ManagedObjectSource class name.

createManagedObjectSourceExtensionList

public static List<ManagedObjectSourceExtension> createManagedObjectSourceExtensionList()
Creates the listing of ManagedObjectSourceExtension instances.

Returns:
Listing of ManagedObjectSourceExtension instances.

createGovernanceSourceExtensionMap

public static Map<String,GovernanceSourceExtension> createGovernanceSourceExtensionMap()
Creates the map of GovernanceSourceExtension instances by their respective GovernanceSource class name.

Returns:
Map of GovernanceSourceExtension instances by their respective GovernanceSource class name.

createGovernanceSourceExtensionList

public static List<GovernanceSourceExtension> createGovernanceSourceExtensionList()
Creates the listing of GovernanceSourceExtension instances.

Returns:
Listing of GovernanceSourceExtension instances.

createAdministratorSourceExtensionMap

public static Map<String,AdministratorSourceExtension> createAdministratorSourceExtensionMap()
Creates the map of AdministratorSourceExtension instances by their respective AdministratorSource class name.

Returns:
Map of AdministratorSourceExtension instances by their respective AdministratorSource class name.

createAdministratorSourceExtensionList

public static List<AdministratorSourceExtension> createAdministratorSourceExtensionList()
Creates the listing of AdministratorSourceExtension instances.

Returns:
Listing of AdministratorSourceExtension instances.

createTeamSourceExtensionMap

public static Map<String,TeamSourceExtension> createTeamSourceExtensionMap()
Creates the map of TeamSourceExtension instances by their respective TeamSource class name.

Returns:
Map of TeamSourceExtension instances by their respective TeamSource class name.

createTeamSourceExtensionList

public static List<TeamSourceExtension> createTeamSourceExtensionList()
Creates the listing of TeamSourceExtension instances.

Returns:
Listing of TeamSourceExtension instances.

createSectionSourceExtensionMap

public static Map<String,SectionSourceExtension> createSectionSourceExtensionMap()
Creates the map of SectionSourceExtension instances by their respective SectionSource class name.

Returns:
Map of SectionSourceExtension instances by their respective SectionSource class name.

createSectionSourceExtensionList

public static List<SectionSourceExtension> createSectionSourceExtensionList()
Creates the listing of SectionSourceExtension instances.

Returns:
Listing of SectionSourceExtension instances.

createOfficeSourceExtensionMap

public static Map<String,OfficeSourceExtension> createOfficeSourceExtensionMap()
Creates the map of OfficeSourceExtension instances by their respective OfficeSource class name.

Returns:
Map of OfficeSourceExtension instances by their respective OfficeSource class name.

createOfficeSourceExtensionList

public static List<OfficeSourceExtension> createOfficeSourceExtensionList()
Creates the listing of OfficeSourceExtension instances.

Returns:
Listing of OfficeSourceExtension instances.

createExtensionClasspathProviderMap

public static Map<String,ExtensionClasspathProvider> createExtensionClasspathProviderMap()
Creates the map of ExtensionClasspathProvider instances by their respective class name.

Returns:
Map of ExtensionClasspathProvider instances by their respective class name.

createExtensionClasspathProviderList

public static List<ExtensionClasspathProvider> createExtensionClasspathProviderList()
Creates the listing of ExtensionClasspathProvider instances.

Returns:
Listing of ExtensionClasspathProvider instances.

openWorkSource

public static void openWorkSource(String workSourceClassName,
                                  PropertyList properties,
                                  AbstractOfficeFloorEditor<?,?> editor)
Opens the WorkSource.

Parameters:
workSourceClassName - WorkSource class name.
properties - PropertyList for the WorkSource.
editor - AbstractOfficeFloorEditor.

openManagedObjectSource

public static void openManagedObjectSource(String managedObjectSourceClassName,
                                           PropertyList properties,
                                           AbstractOfficeFloorEditor<?,?> editor)
Opens the ManagedObjectSource.

Parameters:
managedObjectSourceClassName - ManagedObjectSource class name.
properties - PropertyList for the ManagedObjectSource.
editor - AbstractOfficeFloorEditor.

openTeamSource

public static void openTeamSource(String teamSourceClassName,
                                  PropertyList properties,
                                  AbstractOfficeFloorEditor<?,?> editor)
Opens the TeamSource.

Parameters:
teamSourceClassName - TeamSource class name.
properties - PropertyList for the TeamSource.
editor - AbstractOfficeFloorEditor.

openGovernanceSource

public static void openGovernanceSource(String governanceSourceClassName,
                                        PropertyList properties,
                                        AbstractOfficeFloorEditor<?,?> editor)
Opens the GovernanceSource.

Parameters:
governanceSourceClassName - GovernanceSource class name.
properties - PropertyList for the GovernanceSource.
editor - AbstractOfficeFloorEditor.

openAdministratorSource

public static void openAdministratorSource(String administratorSourceClassName,
                                           PropertyList properties,
                                           AbstractOfficeFloorEditor<?,?> editor)
Opens the AdministratorSource.

Parameters:
administratorSourceClassName - AdministratorSource class name.
properties - PropertyList for the AdministratorSource.
editor - AbstractOfficeFloorEditor.

openSectionSource

public static void openSectionSource(String sectionSourceClassName,
                                     String sectionLocation,
                                     PropertyList properties,
                                     AbstractOfficeFloorEditor<?,?> editor)
Opens the SectionSource.

Parameters:
sectionSourceClassName - SectionSource class name.
sectionLocation - Location of the section.
properties - PropertyList for the SectionSource.
editor - AbstractOfficeFloorEditor.

openOfficeSource

public static void openOfficeSource(String officeSourceClassName,
                                    String officeLocation,
                                    PropertyList properties,
                                    AbstractOfficeFloorEditor<?,?> editor)
Opens the OfficeSource.

Parameters:
officeSourceClassName - OfficeSource class name.
officeLocation - Location of the Office.
properties - PropertyList for the OfficeSource.
editor - AbstractOfficeFloorEditor.

createClasspathProvidersByExtensionClassNames

public static Map<String,ExtensionClasspathProvider> createClasspathProvidersByExtensionClassNames()
Obtains the map of ExtensionClasspathProvider instances by the extension class name.

Returns:
Map of ExtensionClasspathProvider instances by the extension class name.

createSourceExtensionList

public static <E> List<E> createSourceExtensionList(Map<String,E> sourceExtensionMap)
Transforms the map of source extensions into a list of source extension sorted by the source class name of the source extension.

Parameters:
sourceExtensionMap - Map of source extensions.
Returns:
List of source extensions.

createSourceExtensionMap

protected static <E> Map<String,E> createSourceExtensionMap(String extensionId,
                                                            Class<E> extensionType,
                                                            ExtensionUtil.SourceClassExtractor<E> extractor)
Creates the map of Source Class extensions by the Source Class name.

Parameters:
extensionId - Extension Id.
extensionType - Type of extension.
extractor - ExtensionUtil.SourceClassExtractor.
Returns:
Map of source class name to source extension.

isIgnoreSource

public static boolean isIgnoreSource(Class<?> sourceClass)
Indicates if the input Class is to be ignored (in other words annotated with TestSource or PrivateSource).

Parameters:
sourceClass - Class to determine if a TestSource.
Returns:
true if annotated with TestSource.

isIgnoreSource

public static boolean isIgnoreSource(String sourceClassName,
                                     ClassLoader classLoader)
Convenience method to determine if the source class is annotated with TestSource or PrivateSource.

Parameters:
sourceClassName - Fully qualified name of the source class.
classLoader - ClassLoader to obtain the source class.
Returns:
true if annotated with TestSource.

createExecutableExtensions

public static <T> List<T> createExecutableExtensions(String extensionId,
                                                     Class<T> type)
Creates the executable extensions for the particular extension.

Parameters:
extensionId - Id of the extension.
type - Type expected for the executable extension.
Returns:
Listing of executable extensions.


Copyright © 2005-2013. All Rights Reserved.