|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.core.component.factory.DefaultComponentFactory
This implementation of ComponentFactory
constructs the
component by assembling the component's functional implementation with
various ComponentAssistants
defined by the factory's
configuration. This implementation uses a DynamicProxy
as the glue to hold these pieces together.
Nested Class Summary | |
protected static class |
DefaultComponentFactory.MethodWrapper
This class provides a wrapper for tracking methods on the component facade, purely through their signature (name and parameters, but not declaring class). |
Field Summary | |
private org.apache.commons.logging.Log |
log
The handle to Apache-commons logger. |
Constructor Summary | |
DefaultComponentFactory()
|
Method Summary | |
private Component |
assembleComponent(ComponentConfiguration componentConfiguration)
This method does the actual work of constructing a component. |
private Decorator |
buildDecorator(DecoratorConfiguration decoratorConfiguration,
FunctionalInterface functionalImplementation,
ComponentConfiguration componentConfiguration,
ComponentProxyInvocationHandler proxyInvocationHandler)
Factory method for component assistants. |
private FunctionalInterface |
buildFunctionalImplementation(ComponentConfiguration componentConfiguration)
Factory method for the components functional implementation. |
private ComponentProxyInvocationHandler |
buildProxyInvocationHandler(ComponentTemplateConfiguration componentTemplateConfiguration)
Factory method for the component proxy invocation handler. |
private void |
checkAllMethodNames(Set interfaces,
String componentName)
Checks if duplicate methods are defined in interfaces. |
private ComponentConfiguration |
getComponentConfig(String logicalComponentName)
Gets the configuration of the component specified by the name. |
private ComponentTemplateConfiguration |
getComponentTemplateConfiguration(ComponentConfiguration componentConfiguration)
Gets the ComponentTemplateConfiguration for this component. |
Component |
getInstance(String logicalComponentName)
Builds the component specified by the name parameter. |
private void |
initializeComponent(Component component)
Calls lifecycle methods to initialize the component. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.apache.commons.logging.Log log
Constructor Detail |
public DefaultComponentFactory()
Method Detail |
public Component getInstance(String logicalComponentName)
Builds the component specified by the name parameter.
getInstance
in interface ComponentFactory
logicalComponentName
- the component to build
private ComponentConfiguration getComponentConfig(String logicalComponentName)
Gets the configuration of the component specified by the name.
logicalComponentName
- the path to the requested logical component
private Component assembleComponent(ComponentConfiguration componentConfiguration)
This method does the actual work of constructing a component. It performs the following steps:
componentConfiguration
- the configuration object for the
component being created
private void initializeComponent(Component component)
Calls lifecycle methods to initialize the component. Component should be in LifecycleStateEnum.STOPPED state when complete.
component
- the component to be initializedprivate FunctionalInterface buildFunctionalImplementation(ComponentConfiguration componentConfiguration)
Factory method for the components functional implementation.
componentConfiguration
- the configuration object for the
component being created
private ComponentProxyInvocationHandler buildProxyInvocationHandler(ComponentTemplateConfiguration componentTemplateConfiguration)
Factory method for the component proxy invocation handler.
componentTemplateConfiguration
- the component template
configuration that defines the construction of the requested component
private Decorator buildDecorator(DecoratorConfiguration decoratorConfiguration, FunctionalInterface functionalImplementation, ComponentConfiguration componentConfiguration, ComponentProxyInvocationHandler proxyInvocationHandler)
Factory method for component assistants.
proxyInvocationHandler
- the invocation handler of the component
being builtdecoratorConfiguration
- the configuration object containing the
name and DecoratorFactory class object for the decortatorfunctionalImplementation
- the component's functional implementation
objectcomponentConfiguration
- the component's configuration
private ComponentTemplateConfiguration getComponentTemplateConfiguration(ComponentConfiguration componentConfiguration)
Gets the ComponentTemplateConfiguration for this component.
This implementation is hardcoded to always look in one spot in Config ("/core/component/componentTemplate") for the template.
componentConfiguration
- this parameter is not used in this
implementation. If ComponentConfiguration is modified to have a
getComponentTemplateConfiguration method, this method can be modified
to use the componet specific component template.
private void checkAllMethodNames(Set interfaces, String componentName)
Checks if duplicate methods are defined in interfaces. If they are then this method logs a warning in the log file about the duplicate
interfaces
- various interfaces being implementedcomponentName
- name of the component
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |