net.officefloor.frame.spi.managedobject.source.impl
Class AbstractAsyncManagedObjectSource<D extends Enum<D>,F extends Enum<F>>

java.lang.Object
  extended by net.officefloor.frame.spi.managedobject.source.impl.AbstractAsyncManagedObjectSource<D,F>
All Implemented Interfaces:
ManagedObjectSource<D,F>
Direct Known Subclasses:
AbstractManagedObjectSource

public abstract class AbstractAsyncManagedObjectSource<D extends Enum<D>,F extends Enum<F>>
extends Object
implements ManagedObjectSource<D,F>

Abstract ManagedObjectSource allowing to asynchronously source the ManagedObject.

Author:
Daniel Sagenschneider

Nested Class Summary
static interface AbstractAsyncManagedObjectSource.DependencyLabeller
          Provide AbstractAsyncManagedObjectSource.DependencyLabeller functionality along with qualifying type of dependency.
static interface AbstractAsyncManagedObjectSource.Labeller
          Provides the ability to label the required dependency or JobSequence.
static interface AbstractAsyncManagedObjectSource.MetaDataContext<D extends Enum<D>,F extends Enum<F>>
          Context for the ManagedObjectSource.getMetaData().
static interface AbstractAsyncManagedObjectSource.SpecificationContext
          Context for the getSpecification().
 
Constructor Summary
AbstractAsyncManagedObjectSource()
           
 
Method Summary
 ManagedObjectSourceMetaData<D,F> getMetaData()
           Obtains the meta-data to describe this.
 ManagedObjectSourceSpecification getSpecification()
           Obtains the specification for this.
 void init(ManagedObjectSourceContext<F> context)
          Called only once after the ManagedObjectSource is instantiated.
protected abstract  void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<D,F> context)
          Overridden to load meta-data.
protected abstract  void loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
          Overridden to load specifications.
 void start(ManagedObjectExecuteContext<F> context)
           Called once after ManagedObjectSource.init(ManagedObjectSourceContext) to indicate this ManagedObjectSource should start execution.
 void stop()
           Called to notify that the OfficeFloor is being closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.officefloor.frame.spi.managedobject.source.ManagedObjectSource
sourceManagedObject
 

Constructor Detail

AbstractAsyncManagedObjectSource

public AbstractAsyncManagedObjectSource()
Method Detail

getSpecification

public ManagedObjectSourceSpecification getSpecification()
Description copied from interface: ManagedObjectSource

Obtains the specification for this.

This will be called before any other methods, therefore this method must be able to return the specification immediately after a default constructor instantiation.

Specified by:
getSpecification in interface ManagedObjectSource<D extends Enum<D>,F extends Enum<F>>
Returns:
Specification of this.

loadSpecification

protected abstract void loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Overridden to load specifications.

Parameters:
context - Specifications.

init

public void init(ManagedObjectSourceContext<F> context)
          throws Exception
Description copied from interface: ManagedObjectSource
Called only once after the ManagedObjectSource is instantiated.

Specified by:
init in interface ManagedObjectSource<D extends Enum<D>,F extends Enum<F>>
Parameters:
context - ManagedObjectSourceContext to use in initialising.
Throws:
Exception - Should the ManagedObjectSource fail to configure itself from the input properties.

loadMetaData

protected abstract void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<D,F> context)
                              throws Exception
Overridden to load meta-data.

Parameters:
context - Meta-data.
Throws:
Exception - If fails to load the meta-data.

getMetaData

public ManagedObjectSourceMetaData<D,F> getMetaData()
Description copied from interface: ManagedObjectSource

Obtains the meta-data to describe this.

This is called after the ManagedObjectSource.init(ManagedObjectSourceContext) method and therefore may use the configuration.

This should always return non-null. If there is a problem due to incorrect configuration, the ManagedObjectSource.init(ManagedObjectSourceContext) should indicate this via an exception.

Specified by:
getMetaData in interface ManagedObjectSource<D extends Enum<D>,F extends Enum<F>>
Returns:
Meta-data to describe this.

start

public void start(ManagedObjectExecuteContext<F> context)
           throws Exception
Description copied from interface: ManagedObjectSource

Called once after ManagedObjectSource.init(ManagedObjectSourceContext) to indicate this ManagedObjectSource should start execution.

On invocation of this method, ProcessState instances may be invoked via the ManagedObjectExecuteContext.

Specified by:
start in interface ManagedObjectSource<D extends Enum<D>,F extends Enum<F>>
Parameters:
context - ManagedObjectExecuteContext to use in starting this ManagedObjectSource.
Throws:
Exception - Should the ManagedObjectSource fail to start execution.

stop

public void stop()
Description copied from interface: ManagedObjectSource

Called to notify that the OfficeFloor is being closed.

On return from this method, no further ProcessState instances may be invoked.

Specified by:
stop in interface ManagedObjectSource<D extends Enum<D>,F extends Enum<F>>


Copyright © 2005-2013. All Rights Reserved.