Class OfficeFloorCompiler
- All Implemented Interfaces:
Node,PropertyConfigurable
- Direct Known Subclasses:
OfficeFloorCompilerAdapter,OfficeFloorCompilerImpl
OfficeFloor compiler to compile the OfficeFloor into the
OfficeFrame to be built.
This is the starting point to use the compiler.
- Author:
- Daniel Sagenschneider
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <E,F extends Enum<F>, G extends Enum<G>, S extends AdministrationSource<E, F, G>>
voidaddAdministrationSourceAlias(String alias, Class<S> administrationSourceClass) Allows providing an alias name for aAdministrationSource.abstract voidaddAutoWireStateManagerVisitor(AutoWireStateManagerVisitor autoWireStateManagerVisitor) Adds anAutoWireStateManagerVisitor.voidConvenience method to add all thePropertyinstances fromSystem.getenv().abstract <I,F extends Enum<F>, S extends GovernanceSource<I, F>>
voidaddGovernanceSourceAlias(String alias, Class<S> governanceSourceClass) Allows providing an alias name for aGovernanceSource.abstract <S extends ManagedFunctionSource>
voidaddManagedFunctionSourceAlias(String alias, Class<S> managedFunctionSourceClass) Allows providing an alias name for aManagedFunctionSource.abstract <S extends ManagedObjectPoolSource>
voidaddManagedObjectPoolSourceAlias(String alias, Class<S> managedObjectPoolSourceClass) Allows providing an alias name for aManagedObjectPoolSource.abstract <D extends Enum<D>,F extends Enum<F>, S extends ManagedObjectSource<D, F>>
voidaddManagedObjectSourceAlias(String alias, Class<S> managedObjectSourceClass) Allows providing an alias name for aManagedObjectSource.abstract voidaddOfficeFloorListener(OfficeFloorListener officeFloorListener) Adds anOfficeFloorListener.abstract <S extends OfficeSource>
voidaddOfficeSourceAlias(String alias, Class<S> officeSourceClass) Allows providing an alias name for anOfficeSource.abstract voidaddProfile(String profile) Adds a profile.abstract voidaddProfiler(String officeName, Profiler profiler) abstract voidaddResources(ResourceSource resourceSource) Adds aResourceSource.abstract <S extends SectionSource>
voidaddSectionSourceAlias(String alias, Class<S> sectionSourceClass) Allows providing an alias name for aSectionSource.voidAdds the aliases for the source classes.abstract <S extends SupplierSource>
voidaddSupplierSourceAlias(String alias, Class<S> supplierSourceClass) Allows providing an alias name for aSupplierSource.voidConvenience method to add all thePropertyinstances fromSystem.getProperties().abstract <S extends TeamSource>
voidaddTeamSourceAlias(String alias, Class<S> teamSourceClass) Allows providing an alias name for aTeamSource.abstract OfficeFloorCompiles and builds theOfficeFloor.abstract booleanRuns theOfficeFloorCompilerConfigurerinstances to configure thisOfficeFloorCompiler.abstract PropertyListCreates a new emptyPropertyList.abstract SourceContextCreates a rootSourceContext.abstract AdministrationLoaderObtains theAdministrationLoader.Node[]Obtains the childNodeinstances.final ClassLoaderObtains theClassLoaderfor thisOfficeFloorCompiler.abstract CompilerIssuesObtains theCompilerIssues.abstract ExecutiveLoaderObtains theExecutiveLoader.abstract GovernanceLoaderObtains theGovernanceLoader.Obtains the location of theNode.abstract ManagedFunctionLoaderObtains theManagedFunctionLoader.abstract ManagedObjectLoaderObtains theManagedObjectLoader.abstract ManagedObjectPoolLoaderObtains theManagedObjectPoolLoader.Obtains the name of theNode.Obtains theNodetype.abstract OfficeFloorLoaderObtains theOfficeFloorLoader.abstract OfficeLoaderObtains theOfficeLoader.getQualifiedName(String name) Obtains the qualified name for childNode.abstract SectionLoaderObtains theSectionLoader.abstract SupplierLoaderObtains theSupplierLoader.abstract TeamLoaderObtains theTeamLoader.abstract TypeLoaderObtains theTypeLoader.booleanIndicates if theNodehas been initialised.static final OfficeFloorCompilernewOfficeFloorCompiler(ClassLoader implClassLoader) Creates a new instance of aOfficeFloorCompiler.static final PropertyListConvenience method to create a newPropertyList.<T> Trun(Class<? extends OfficeFloorCompilerRunnable<T>> runnableClass, Object... parameters) Executes theOfficeFloorCompilerRunnableby instantiating it with the sameClassLoaderbeing used by thisOfficeFloorCompiler.protected final voidsetClassLoader(ClassLoader classLoader) Specifies theClassLoader.abstract voidsetClockFactory(ClockFactory clockFactory) Specifies theClockFactory.abstract voidsetCompilerIssues(CompilerIssues issues) Overrides the defaultCompilerIssuesto use in compiling theOfficeFloor.abstract voidsetEscalationHandler(EscalationHandler escalationHandler) Overrides the defaultEscalationHandler.static final voidSpecifies theOfficeFloorCompiler.OfficeFloorCompilerFactory.abstract voidsetMBeanRegistrator(MBeanRegistrator mbeanRegistrator) Specifies theMBeanRegistrator.abstract voidsetOfficeFloorLocation(String officeFloorLocation) Specifies the location of theOfficeFloor.abstract voidsetOfficeFloorSource(OfficeFloorSource officeFloorSource) Specifies theOfficeFloorSourceinstance to use for compiling theOfficeFloor.abstract <S extends OfficeFloorSource>
voidsetOfficeFloorSourceClass(Class<S> officeFloorSourceClass) Overrides the defaultOfficeFloorSourceto source theOfficeFloor.abstract voidsetOfficeFrame(OfficeFrame officeFrame) Overrides the defaultOfficeFramefor building theOfficeFloor.abstract voidsetOverridePropertiesDirectory(File propertiesDirectory) Specifies a directory containing override properties.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.officefloor.compile.internal.structure.Node
getQualifiedNameMethods inherited from interface net.officefloor.compile.properties.PropertyConfigurable
addProperty
-
Field Details
-
TYPE
Nodetype.- See Also:
-
IMPLEMENTATION_CLASS_PROPERTY_NAME
System.getProperty(String)that allows specifying theOfficeFloorCompilerimplementationClass.Should this not be specified the default
OfficeFloorCompilerImplwill be used.Note: it is anticipated that
OfficeFloorCompilerImplwill always be used.- See Also:
-
-
Constructor Details
-
OfficeFloorCompiler
public OfficeFloorCompiler()
-
-
Method Details
-
setFactory
Specifies the
OfficeFloorCompiler.OfficeFloorCompilerFactory. Allows for overriding the default behaviour in creating anOfficeFloorCompiler.Typically this should not be called however is included to enable flexibility in creating
OfficeFloorCompilerinstances.- Parameters:
factory-OfficeFloorCompiler.OfficeFloorCompilerFactory.
-
newOfficeFloorCompiler
Creates a new instance of aOfficeFloorCompiler.- Parameters:
implClassLoader-ClassLoaderto use for theOfficeFloor. May benullwhich will default to use the currentThread.getContextClassLoader().- Returns:
- New
OfficeFloorCompiler.
-
newPropertyList
Convenience method to create a newPropertyList.- Returns:
- New
PropertyList.
-
getClassLoader
Obtains theClassLoaderfor thisOfficeFloorCompiler.- Returns:
ClassLoaderfor thisOfficeFloorCompiler.
-
setClassLoader
Specifies the
ClassLoader.To ensure
Classcompatibility, theClassLoadermust be a child of the existingClassLoader.- Parameters:
classLoader- ChildClassLoader.- Throws:
IllegalArgumentException- IfClassLoadernot a child of the existingClassLoader.
-
run
public <T> T run(Class<? extends OfficeFloorCompilerRunnable<T>> runnableClass, Object... parameters) throws Exception Executes the
OfficeFloorCompilerRunnableby instantiating it with the sameClassLoaderbeing used by thisOfficeFloorCompiler.This is typically used by graphical editors that need to use the project class path rather than the editor's class path.
- Type Parameters:
T- Return type.- Parameters:
runnableClass-OfficeFloorCompilerRunnableclass.parameters- Parameters to enable configuration of theOfficeFloorCompilerRunnable. AsProxyinstances are used to bridgeClasscompatibility issues due to differentClassLoader, all parameters should only be access via their implementing interfaces.- Returns:
- Value returned from the
OfficeFloorCompilerRunnable. - Throws:
Exception- If fails to run theOfficeFloorCompilerRunnable.
-
addSystemProperties
public void addSystemProperties()Convenience method to add all the
Propertyinstances fromSystem.getProperties().PropertyConfigurable.addProperty(String, String)will be invoked for eachProperty. -
addEnvProperties
public void addEnvProperties()Convenience method to add all the
Propertyinstances fromSystem.getenv().PropertyConfigurable.addProperty(String, String)will be invoked for eachProperty. -
addSourceAliases
public void addSourceAliases()Adds the aliases for the source classes. -
getNodeName
Description copied from interface:NodeObtains the name of theNode.- Specified by:
getNodeNamein interfaceNode- Returns:
- Name of the
Node.
-
getNodeType
Description copied from interface:NodeObtains theNodetype.- Specified by:
getNodeTypein interfaceNode- Returns:
Nodetype.
-
getLocation
Description copied from interface:NodeObtains the location of theNode.- Specified by:
getLocationin interfaceNode- Returns:
- Location of the
Node. May benullifNodedoes not support a location.
-
getParentNode
Description copied from interface:Node- Specified by:
getParentNodein interfaceNode- Returns:
Nodecontaining thisNode.
-
getQualifiedName
Description copied from interface:NodeObtains the qualified name for childNode.- Specified by:
getQualifiedNamein interfaceNode- Parameters:
name- Name of childNode.- Returns:
- Name qualified by this
Node.
-
getChildNodes
Description copied from interface:NodeObtains the childNodeinstances.- Specified by:
getChildNodesin interfaceNode- Returns:
- Child
Nodeinstances.
-
isInitialised
public boolean isInitialised()Description copied from interface:NodeIndicates if theNodehas been initialised.Nodeinstances should only be initialised once. Initialising theNodetwice is an issue.- Specified by:
isInitialisedin interfaceNode- Returns:
trueif initialised.
-
setClockFactory
Specifies the
ClockFactory.This will be added to the
OfficeFramebefore compiling theOfficeFloorand will be available in theSourceContextfor retrievingClockinstances.- Parameters:
clockFactory-ClockFactory.
-
addResources
Adds a
ResourceSource.This will be added to the
OfficeFramebefore compiling theOfficeFloorand will be available in theSourceContextfor loading the various sources.- Parameters:
resourceSource-ResourceSource.
-
setEscalationHandler
Overrides the default
EscalationHandler.This will be specified on the
OfficeFramebefore compiling theOfficeFloor.- Parameters:
escalationHandler-EscalationHandler.
-
setCompilerIssues
Overrides the default
CompilerIssuesto use in compiling theOfficeFloor.Implementations of
OfficeFloorCompilermust provide a defaultCompilerIssues. Typically this will be an implementation that writes issues toSystem.err.- Parameters:
issues-CompilerIssues.
-
setOfficeFrame
Overrides the default
OfficeFramefor building theOfficeFloor.Should this not be called the
OfficeFloorCompilerimplementation should use theOfficeFrame.getInstance()to build theOfficeFloor.- Parameters:
officeFrame-OfficeFrame.
-
setOfficeFloorSourceClass
public abstract <S extends OfficeFloorSource> void setOfficeFloorSourceClass(Class<S> officeFloorSourceClass) Overrides the default
OfficeFloorSourceto source theOfficeFloor.OfficeFloorCompilerimplementations must provide a defaultOfficeFloorSourceimplementation. The choice ofOfficeFloorSourceimplementation is left to theOfficeFloorCompiler, however it should be clearly documented on theOfficeFloorCompilerimplementation whichOfficeFloorSourceimplementation is being used.- Type Parameters:
S-OfficeFloorSourcetype.- Parameters:
officeFloorSourceClass-OfficeFloorSourceClass.
-
setOfficeFloorSource
Specifies the
OfficeFloorSourceinstance to use for compiling theOfficeFloor.This will take precedence over specifying the
OfficeFloorSourceclass.- Parameters:
officeFloorSource-OfficeFloorSource.
-
setOfficeFloorLocation
Specifies the location of theOfficeFloor.- Parameters:
officeFloorLocation- Location of theOfficeFloor.
-
addProfile
Adds a profile.- Parameters:
profile- Profile.
-
addOfficeSourceAlias
public abstract <S extends OfficeSource> void addOfficeSourceAlias(String alias, Class<S> officeSourceClass) Allows providing an alias name for an
OfficeSource.This stops the configuration files from being littered with fully qualified class names of the
OfficeSourceclasses. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.Typically this should not be used directly as the
OfficeSourceServiceis the preferred means to provideOfficeSourcealiases.- Type Parameters:
S-OfficeSourcetype.- Parameters:
alias- Alias name for theOfficeSource.officeSourceClass-OfficeSourceClassfor the alias.
-
addSectionSourceAlias
public abstract <S extends SectionSource> void addSectionSourceAlias(String alias, Class<S> sectionSourceClass) Allows providing an alias name for a
SectionSource.This stops the configuration files from being littered with fully qualified class names of the
SectionSourceclasses. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.Typically this should not be used directly as the
SectionSourceServiceis the preferred means to provideSectionSourcealiases.- Type Parameters:
S-SectionSourcetype.- Parameters:
alias- Alias name for theSectionSource.sectionSourceClass-SectionSourceClassfor the alias.
-
addManagedFunctionSourceAlias
public abstract <S extends ManagedFunctionSource> void addManagedFunctionSourceAlias(String alias, Class<S> managedFunctionSourceClass) Allows providing an alias name for a
ManagedFunctionSource.This stops the configuration files from being littered with fully qualified class names of the
ManagedFunctionSourceclasses. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.Typically this should not be used directly as the
ManagedFunctionSourceServiceis the preferred means to provideManagedFunctionSourcealiases.- Type Parameters:
S-ManagedFunctionSourcetype.- Parameters:
alias- Alias name for theManagedFunctionSource.managedFunctionSourceClass-ManagedFunctionSourceClassfor the alias.
-
addManagedObjectSourceAlias
public abstract <D extends Enum<D>,F extends Enum<F>, void addManagedObjectSourceAliasS extends ManagedObjectSource<D, F>> (String alias, Class<S> managedObjectSourceClass) Allows providing an alias name for a
ManagedObjectSource.This stops the configuration files from being littered with fully qualified class names of the
ManagedObjectSourceclasses. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.Typically this should not be used directly as the
ManagedObjectSourceServiceis the preferred means to provideManagedObjectSourcealiases.- Type Parameters:
D- Dependency type keys.F-Flowtype keys.S-ManagedObjectSourcetype.- Parameters:
alias- Alias name for theManagedObjectSource.managedObjectSourceClass-ManagedObjectSourceClassfor the alias.
-
addManagedObjectPoolSourceAlias
public abstract <S extends ManagedObjectPoolSource> void addManagedObjectPoolSourceAlias(String alias, Class<S> managedObjectPoolSourceClass) Allows providing an alias name for a
ManagedObjectPoolSource.This stops the configuration files from being littered with fully qualified class names of the
ManagedObjectPoolSourceclasses. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.Typically this should not be used directly as the
ManagedObjectSourceServiceis the preferred means to provideManagedObjectSourcealiases.- Type Parameters:
S-ManagedObjectPoolSourcetype.- Parameters:
alias- Alias name for theManagedObjectPoolSource.managedObjectPoolSourceClass-ManagedObjectPoolSourceClassfor the alias.
-
addSupplierSourceAlias
public abstract <S extends SupplierSource> void addSupplierSourceAlias(String alias, Class<S> supplierSourceClass) Allows providing an alias name for a
SupplierSource.This stops the configuration files from being littered with fully qualified class names of the
SupplierSourceclasses. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.Typically this should not be used directly as the
SupplierSourceServiceis the preferred means to provideSupplierSourcealiases.- Type Parameters:
S-SupplierSourcetype.- Parameters:
alias- Alias name for theSupplierSource.supplierSourceClass-SupplierSourceClassfor the alias.
-
addAdministrationSourceAlias
public abstract <E,F extends Enum<F>, void addAdministrationSourceAliasG extends Enum<G>, S extends AdministrationSource<E, F, G>> (String alias, Class<S> administrationSourceClass) Allows providing an alias name for a
AdministrationSource.This stops the configuration files from being littered with fully qualified class names of the
AdministrationSourceclasses. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.Typically this should not be used directly as the
AdministrationSourceServiceis the preferred means to provideAdministrationSourcealiases.- Type Parameters:
E- Extension interface type.F-Flowkeys for theAdministration.G-Governancekeys for theAdministration.S-AdministrationSourcetype.- Parameters:
alias- Alias name for theAdministrationSource.administrationSourceClass-AdministrationSourceClassfor the alias.
-
addGovernanceSourceAlias
public abstract <I,F extends Enum<F>, void addGovernanceSourceAliasS extends GovernanceSource<I, F>> (String alias, Class<S> governanceSourceClass) Allows providing an alias name for a
GovernanceSource.This stops the configuration files from being littered with fully qualified class names of the
GovernanceSourceclasses. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.Typically this should not be used directly as the
GovernanceSourceServiceis the preferred means to provideGovernanceSourcealiases.- Type Parameters:
I- Extension interface type.F-Flowtype keys.S-GovernanceSourcetype.- Parameters:
alias- Alias name for theGovernanceSource.governanceSourceClass-GovernanceSourceClassfor the alias.
-
addTeamSourceAlias
public abstract <S extends TeamSource> void addTeamSourceAlias(String alias, Class<S> teamSourceClass) Allows providing an alias name for a
TeamSource.This stops the configuration files from being littered with fully qualified class names of the
TeamSourceclasses. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.Typically this should not be used directly as the
TeamSourceServiceis the preferred means to provideTeamSourcealiases.- Type Parameters:
S-TeamSourcetype.- Parameters:
alias- Alias name for theTeamSource.teamSourceClass-TeamSourceClassfor the alias.
-
addProfiler
-
setOverridePropertiesDirectory
Specifies a directory containing override properties.
The files within the directory are properties files with the naming convention: <fully-qualified-name>.properties
- Parameters:
propertiesDirectory- Directory containing the override properties.
-
setMBeanRegistrator
Specifies theMBeanRegistrator.- Parameters:
mbeanRegistrator-MBeanRegistrator.
-
addOfficeFloorListener
Adds anOfficeFloorListener.- Parameters:
officeFloorListener-OfficeFloorListener.
-
addAutoWireStateManagerVisitor
public abstract void addAutoWireStateManagerVisitor(AutoWireStateManagerVisitor autoWireStateManagerVisitor) Adds anAutoWireStateManagerVisitor.- Parameters:
autoWireStateManagerVisitor-AutoWireStateManagerVisitor.
-
createPropertyList
Creates a new emptyPropertyList.- Returns:
- New empty
PropertyList.
-
createRootSourceContext
Creates a rootSourceContext.- Returns:
- Root
SourceContext.
-
getCompilerIssues
Obtains theCompilerIssues.- Returns:
CompilerIssues.
-
getTypeLoader
Obtains theTypeLoader.- Returns:
TypeLoader.
-
getOfficeFloorLoader
Obtains theOfficeFloorLoader.- Returns:
OfficeFloorLoader.
-
getOfficeLoader
Obtains theOfficeLoader.- Returns:
OfficeLoader.
-
getSectionLoader
Obtains theSectionLoader.- Returns:
SectionLoader.
-
getManagedFunctionLoader
Obtains theManagedFunctionLoader.- Returns:
ManagedFunctionLoader.
-
getManagedObjectLoader
Obtains theManagedObjectLoader.- Returns:
ManagedObjectLoader.
-
getSupplierLoader
Obtains theSupplierLoader.- Returns:
SupplierLoader.
-
getGovernanceLoader
Obtains theGovernanceLoader.- Returns:
GovernanceLoader.
-
getManagedObjectPoolLoader
Obtains theManagedObjectPoolLoader.- Returns:
ManagedObjectPoolLoader.
-
getAdministrationLoader
Obtains theAdministrationLoader.- Returns:
AdministrationLoader.
-
getTeamLoader
Obtains theTeamLoader.- Returns:
TeamLoader.
-
getExecutiveLoader
Obtains theExecutiveLoader.- Returns:
ExecutiveLoader.
-
configureOfficeFloorCompiler
public abstract boolean configureOfficeFloorCompiler()Runs the
OfficeFloorCompilerConfigurerinstances to configure thisOfficeFloorCompiler.This is always run before a compile. However, may not be run for loaders. This allows running if just loading types.
- Returns:
trueif configured.falsewith issue reported to theCompilerIssues.
-
compile
Compiles and builds theOfficeFloor.- Parameters:
officeFloorName- Name of theOfficeFloor.- Returns:
OfficeFloorornullif issues in compiling which are reported to theCompilerIssues.
-