public class AutoWireOfficeFloorSource extends AbstractOfficeFloorSource implements AutoWireApplication
OfficeFloorSource
implementation that auto-wires the configuration
based on type.
To allow auto-wiring this implementation provides facades over the
complexities of more advanced OfficeFloor
configuration to allow
simpler configuration. It is anticipated in the majority of cases that this
will be adequate for most applications. Should however more flexibility be
required then please use the OfficeFloorModelOfficeFloorSource
.
AbstractOfficeFloorSource.SpecificationContext
Constructor and Description |
---|
AutoWireOfficeFloorSource()
Default constructor.
|
AutoWireOfficeFloorSource(OfficeFloorCompiler compiler)
Initiate.
|
Modifier and Type | Method and Description |
---|---|
AutoWireGovernance |
addGovernance(String governanceName,
String governanceSourceClassName)
Adds
Governance over the ManagedObject and object
instances. |
AutoWireObject |
addManagedObject(String managedObjectSourceClassName,
ManagedObjectSourceWirer wirer,
AutoWire... autoWiring)
Adds a
ManagedObjectSource for dependency injection. |
void |
addObject(Object object,
AutoWire... autoWiring)
Adds a raw object for dependency injection.
|
AutoWireSection |
addSection(String sectionName,
String sectionSourceClassName,
String sectionLocation)
Adds an
AutoWireSection . |
<A extends AutoWireSection> |
addSection(String sectionName,
String sectionSourceClassName,
String sectionLocation,
AutoWireSectionFactory<A> sectionFactory)
Adds an
AutoWireSection with the ability to override the
AutoWireSection used. |
void |
addSectionTransformer(AutoWireSectionTransformer transformer)
Adds a
AutoWireSectionTransformer . |
void |
addStartupFlow(AutoWireSection section,
String inputName)
Adds a flow to be triggered on start-up.
|
AutoWireSupplier |
addSupplier(String supplierSourceClassName)
Adds a
SupplierSource to provide ManagedObject instances
for dependency injection. |
AutoWireTeam |
assignDefaultTeam(String teamSourceClassName)
|
AutoWireTeam |
assignTeam(String teamSourceClassName,
AutoWire... autoWiring)
Assigns a
Team responsible for:
Task dependent on the specified object types
Governance with the extension interface object type
|
static AutoWire |
getAppropriateAutoWire(String qualifier,
String type,
Collection<AutoWire> availableAutoWiring)
Obtains the appropriate available
AutoWire . |
OfficeFloorCompiler |
getOfficeFloorCompiler()
Obtains the
OfficeFloorCompiler being used. |
AutoWireSection |
getSection(String sectionName)
Obtains the
AutoWireSection by its name. |
protected void |
initOfficeFloor(OfficeFloorDeployer deployer,
OfficeFloorSourceContext context)
Allows overriding for initialising the
OfficeFloor before
auto-wiring. |
boolean |
isLinked(AutoWireSection section,
String sectionOutputName)
Determines if the
AutoWireSection output is configured for
linking. |
boolean |
isObjectAvailable(AutoWire autoWire)
Indicates if the
AutoWireObject is already configured for the
AutoWire . |
void |
link(AutoWireSection sourceSection,
String sourceOutputName,
AutoWireSection targetSection,
String targetInputName)
Links the source
SectionOutput to a target SectionInput . |
void |
linkEscalation(Class<? extends Throwable> escalation,
AutoWireSection section,
String inputName)
Links the
Escalation to be handled by the
OfficeSectionInput . |
protected void |
loadSpecification(AbstractOfficeFloorSource.SpecificationContext context)
Loads the
OfficeFloorSourceSpecification . |
AutoWireOfficeFloor |
openOfficeFloor()
Opens the
AutoWireOfficeFloor . |
void |
setProfiler(Profiler profiler)
Specifies the
Profiler . |
void |
sourceOfficeFloor(OfficeFloorDeployer deployer,
OfficeFloorSourceContext context)
Sources the
OfficeFloor by deploying it via the input
OfficeFloorDeployer . |
void |
specifyConfigurationProperties(RequiredProperties requiredProperties,
OfficeFloorSourceContext context)
Obtains from the
OfficeFloorSource any additional
Property instances required to source the OfficeFloor
after interrogating the configuration. |
getSpecification
public AutoWireOfficeFloorSource(OfficeFloorCompiler compiler)
compiler
- OfficeFloorCompiler
.public AutoWireOfficeFloorSource()
public static AutoWire getAppropriateAutoWire(String qualifier, String type, Collection<AutoWire> availableAutoWiring)
AutoWire
.protected void initOfficeFloor(OfficeFloorDeployer deployer, OfficeFloorSourceContext context) throws Exception
OfficeFloor
before
auto-wiring.deployer
- OfficeFloorDeployer
.context
- OfficeFloorSourceContext
.Exception
- If fails to initialise.public OfficeFloorCompiler getOfficeFloorCompiler()
AutoWireApplication
Obtains the OfficeFloorCompiler
being used.
This allows manipulation of the OfficeFloorCompiler
before
auto-wiring to compile and open the OfficeFloor
.
getOfficeFloorCompiler
in interface AutoWireApplication
OfficeFloorCompiler
being used.public AutoWireSection addSection(String sectionName, String sectionSourceClassName, String sectionLocation)
AutoWireApplication
AutoWireSection
.addSection
in interface AutoWireApplication
sectionName
- Name of the OfficeSection
.sectionSourceClassName
- Class name of the SectionSource
. May be an alias.sectionLocation
- OfficeSection
location.AutoWireSection
to configure properties and link flows.public <A extends AutoWireSection> A addSection(String sectionName, String sectionSourceClassName, String sectionLocation, AutoWireSectionFactory<A> sectionFactory)
AutoWireApplication
AutoWireSection
with the ability to override the
AutoWireSection
used.addSection
in interface AutoWireApplication
A
- AutoWireSection
type.sectionName
- Name of the OfficeSection
.sectionSourceClassName
- Class name of the SectionSource
. May be an alias.sectionLocation
- OfficeSection
location.sectionFactory
- AutoWireSectionFactory
to allow overriding the
AutoWireSection
utilised.AutoWireSection
to configure properties and
link flows.public AutoWireSection getSection(String sectionName)
AutoWireApplication
Obtains the AutoWireSection
by its name.
This is useful to obtain an existing AutoWireSection
to link to.
getSection
in interface AutoWireApplication
sectionName
- Name of the AutoWireSection
.AutoWireSection
or null
if not
AutoWireSection
by the name.public void addSectionTransformer(AutoWireSectionTransformer transformer)
AutoWireApplication
AutoWireSectionTransformer
.addSectionTransformer
in interface AutoWireApplication
transformer
- AutoWireSectionTransformer
.public void link(AutoWireSection sourceSection, String sourceOutputName, AutoWireSection targetSection, String targetInputName)
AutoWireApplication
SectionOutput
to a target SectionInput
.link
in interface AutoWireApplication
sourceSection
- Source section.sourceOutputName
- Name of the source SectionOutput
.targetSection
- Target section.targetInputName
- Name of the target SectionInput
.public boolean isLinked(AutoWireSection section, String sectionOutputName)
AutoWireApplication
Determines if the AutoWireSection
output is configured for
linking.
This aids configuration by allowing to know if SectionOutput
flows have been configured (linked).
isLinked
in interface AutoWireApplication
section
- AutoWireSection
.sectionOutputName
- SectionOutput
name.true
if configured for linking, otherwise
false
.public void linkEscalation(Class<? extends Throwable> escalation, AutoWireSection section, String inputName)
AutoWireApplication
Escalation
to be handled by the
OfficeSectionInput
.linkEscalation
in interface AutoWireApplication
escalation
- Escalation
.section
- AutoWireSection
.inputName
- Name of the AutoWireSection
input.public void addStartupFlow(AutoWireSection section, String inputName)
AutoWireApplication
addStartupFlow
in interface AutoWireApplication
section
- AutoWireSection
.inputName
- Name of the AutoWireSection
input to trigger on
start-up.public void addObject(Object object, AutoWire... autoWiring)
AutoWireApplication
addObject
in interface AutoWireApplication
object
- Object implementing the type to be dependency injected.autoWiring
- AutoWire
matches that the object is to provide
dependency injection. Should no AutoWire
instances be
provided the type is defaulted from the object without a
qualifier.public AutoWireObject addManagedObject(String managedObjectSourceClassName, ManagedObjectSourceWirer wirer, AutoWire... autoWiring)
AutoWireApplication
ManagedObjectSource
for dependency injection.addManagedObject
in interface AutoWireApplication
managedObjectSourceClassName
- Class name of the ManagedObjectSource
. May be an
alias.wirer
- ManagedObjectSourceWirer
to assist in configuring the
ManagedObjectSource
. May be null
if no
assistance is required.autoWiring
- AutoWire
matches that the ManagedObjectSource
is to provide dependency injection. At least one
AutoWire
must be provided.AutoWireObject
for the ManagedObjectSource
.public AutoWireSupplier addSupplier(String supplierSourceClassName)
AutoWireApplication
SupplierSource
to provide ManagedObject
instances
for dependency injection.addSupplier
in interface AutoWireApplication
supplierSourceClassName
- Class name of the SupplierSource
. May be an alias.AutoWireSupplier
.public boolean isObjectAvailable(AutoWire autoWire)
AutoWireApplication
AutoWireObject
is already configured for the
AutoWire
.isObjectAvailable
in interface AutoWireApplication
autoWire
- AutoWire
to determine if available (configured).true
if an AutoWireObject
has been
configured for the AutoWire
.public AutoWireGovernance addGovernance(String governanceName, String governanceSourceClassName)
AutoWireApplication
Governance
over the ManagedObject
and object
instances.addGovernance
in interface AutoWireApplication
governanceName
- Name of the Governance
.governanceSourceClassName
- Class name of the GovernanceSource
. May be an alias.AutoWireGovernance
.public AutoWireTeam assignTeam(String teamSourceClassName, AutoWire... autoWiring)
AutoWireApplication
Team
responsible for:
Task
dependent on the specified object typesGovernance
with the extension interface object typeassignTeam
in interface AutoWireApplication
teamSourceClassName
- Class name of the TeamSource
. May be an alias.autoWiring
- AutoWire
instances to identify dependent Task
object types and Governance
extension interfaces the
Team
is responsible for. Must have at least one
AutoWire
provided.AutoWireTeam
.public AutoWireTeam assignDefaultTeam(String teamSourceClassName)
AutoWireApplication
assignDefaultTeam
in interface AutoWireApplication
teamSourceClassName
- Class name of the TeamSource
. May be an alias.AutoWireTeam
.public void setProfiler(Profiler profiler)
AutoWireApplication
Profiler
.setProfiler
in interface AutoWireApplication
profiler
- Profiler
.public AutoWireOfficeFloor openOfficeFloor() throws Exception
AutoWireApplication
AutoWireOfficeFloor
.openOfficeFloor
in interface AutoWireApplication
AutoWireOfficeFloor
.Exception
- If fails to open the AutoWireOfficeFloor
.protected void loadSpecification(AbstractOfficeFloorSource.SpecificationContext context)
AbstractOfficeFloorSource
OfficeFloorSourceSpecification
.loadSpecification
in class AbstractOfficeFloorSource
context
- AbstractOfficeFloorSource.SpecificationContext
.public void specifyConfigurationProperties(RequiredProperties requiredProperties, OfficeFloorSourceContext context) throws Exception
OfficeFloorSource
Obtains from the OfficeFloorSource
any additional
Property
instances required to source the OfficeFloor
after interrogating the configuration.
This method is a separate initial step from the
OfficeFloorSource.sourceOfficeFloor(OfficeFloorDeployer, OfficeFloorSourceContext)
method to enable specifying any required Property
instances once
the necessary ConfigurationItem
instances have been interrogated.
Typically this allows environment specific properties to be defined externally so that deployment configuration need not be repeated per environment. In other words, one set of deployment configuration with properties providing the differences between the environments.
This also enables sensitive properties, such as passwords
,
to not be contained in deployment configuration but within a
"secure" location.
specifyConfigurationProperties
in interface OfficeFloorSource
requiredProperties
- Populated by the OfficeFloorSource
with any additional
Property
instances required to source the
OfficeFloor
.context
- OfficeFloorSourceContext
populated with
Property
instances as per the
OfficeFloorSourceSpecification
.Exception
- If fails to initialise the OfficeFloorSource
.public void sourceOfficeFloor(OfficeFloorDeployer deployer, OfficeFloorSourceContext context) throws Exception
OfficeFloorSource
OfficeFloor
by deploying it via the input
OfficeFloorDeployer
.sourceOfficeFloor
in interface OfficeFloorSource
deployer
- OfficeFloorDeployer
to deploy the OfficeFloor
.context
- OfficeFloorSourceContext
populated with the
Property
instances as per the
OfficeFloorSourceSpecification
and
RequiredProperties
. Should there be a name clash
between the two, the RequiredProperties
Property
will be used.Exception
- If fails to source the OfficeFloor
.Copyright © 2005–2016. All rights reserved.