org.objectweb.fractal.juliak.factory
Class AbstractGenericFactoryImpl

java.lang.Object
  extended by org.objectweb.fractal.juliak.factory.AbstractGenericFactoryImpl
All Implemented Interfaces:
GenericFactory
Direct Known Subclasses:
AbstractJuliaEnabledGenericFactoryImpl

public abstract class AbstractGenericFactoryImpl
extends Object
implements GenericFactory

Abstract super class for generic factories. This factory does not make any assumption on the way control membranes are implemented. This concern is deferred to subclasses.

Since:
2.5
Author:
Lionel Seinturier

Constructor Summary
AbstractGenericFactoryImpl()
           
 
Method Summary
protected abstract  Component bindFcMembrane(Type type, Object contentDesc, Object content, Component membrane)
          Bind a control membrane to the component defined by the given type, content description and content.
protected  void checkFcContentClassforBC(Type type, Class contentClass)
          Check that the content class implements the BindingController interface if at least one client interface is defined in its type.
protected  void checkFcContentClassImplementsServerInterfaces(Type type, Class contentClass)
          Check that the content class implements the server interfaces defined in the type.
protected  void checkFcContentDesc(Type type, Object controllerDesc, Object contentDesc)
          Check that the value given for the content description is legal.
protected  void checkFcControllerDesc(Object controllerDesc)
          Check that the given value is a legal controller description.
protected  void checkFcType(Type type, Object controllerDesc)
          Check that the value given for the type is legal.
protected  boolean isFcContentToBeCheckedForBC(Object controllerDesc)
          Return true if the content class associated to the given controller description must implement the BindingController interface when its type defines at least one client interface.
protected  Class loadFcContentClass(Object controllerDesc, String contentDescStr)
          Load the specified content class.
protected  Object newFcContent(Type type, Object controllerDesc, Object contentDesc)
          Instantiate the content part of a component.
 Component newFcInstance(Type type, Object controllerDesc, Object contentDesc)
          Create a new component.
protected abstract  Component newFcMembrane(Type type, Object controllerDesc, Object contentDesc, Object content)
          Create a new control membrane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGenericFactoryImpl

public AbstractGenericFactoryImpl()
Method Detail

newFcInstance

public Component newFcInstance(Type type,
                               Object controllerDesc,
                               Object contentDesc)
                        throws InstantiationException
Create a new component.

Specified by:
newFcInstance in interface GenericFactory
Parameters:
type - the component type
controllerDesc - the description of the control membrane associated to the component
contentDesc - the description of the content of the component
Throws:
InstantiationException

newFcMembrane

protected abstract Component newFcMembrane(Type type,
                                           Object controllerDesc,
                                           Object contentDesc,
                                           Object content)
                                    throws InstantiationException
Create a new control membrane.

Parameters:
type - the type of the component associated to this membrane
controllerDesc - the controller description of this membrane (typically a String such as "primitive" or any of the other registered membrane identifier)
contentDesc - the content description of the component associated to this membrane (e.g. the fully qualified name of the class implementing a primitive component)
content - the instance implementing the component associated to this membrane
Returns:
the fcinterface for the component interface exported by the given control membrane
Throws:
InstantiationException

bindFcMembrane

protected abstract Component bindFcMembrane(Type type,
                                            Object contentDesc,
                                            Object content,
                                            Component membrane)
                                     throws InstantiationException
Bind a control membrane to the component defined by the given type, content description and content.

Parameters:
type - the type of the component associated to this membrane
contentDesc - the content description of the component associated to this membrane (e.g. the fully qualified name of the class implementing a primitive component)
content - the instance implementing the component associated to this membrane
membrane - the control membrane
Returns:
the fcinterface for the component interface exported by the given control membrane
Throws:
InstantiationException

newFcContent

protected Object newFcContent(Type type,
                              Object controllerDesc,
                              Object contentDesc)
                       throws InstantiationException
Instantiate the content part of a component.

Throws:
InstantiationException

loadFcContentClass

protected Class loadFcContentClass(Object controllerDesc,
                                   String contentDescStr)
                            throws InstantiationException
Load the specified content class. First, try to load the class from the classpath. If that fails, assume that the specified contentDesc corresponds to an alias defined in the julia.cfg configuration file. This is case for control component where the content class is dynamically generated by the ASM mixin class generator.

Parameters:
controllerDesc - the controller descriptor of the component for which the content class is requested
contentDescStr - the content descriptor. May be a fully-qualified class name or the stringified representation of a Tree to be loaded by a Julia Loader.
Throws:
InstantiationException

checkFcType

protected void checkFcType(Type type,
                           Object controllerDesc)
                    throws InstantiationException
Check that the value given for the type is legal.

Throws:
InstantiationException

checkFcControllerDesc

protected void checkFcControllerDesc(Object controllerDesc)
                              throws InstantiationException
Check that the given value is a legal controller description.

Throws:
InstantiationException

checkFcContentDesc

protected void checkFcContentDesc(Type type,
                                  Object controllerDesc,
                                  Object contentDesc)
                           throws InstantiationException
Check that the value given for the content description is legal.

Throws:
InstantiationException

checkFcContentClassImplementsServerInterfaces

protected void checkFcContentClassImplementsServerInterfaces(Type type,
                                                             Class contentClass)
                                                      throws InstantiationException
Check that the content class implements the server interfaces defined in the type.

Throws:
InstantiationException

isFcContentToBeCheckedForBC

protected boolean isFcContentToBeCheckedForBC(Object controllerDesc)
Return true if the content class associated to the given controller description must implement the BindingController interface when its type defines at least one client interface.


checkFcContentClassforBC

protected void checkFcContentClassforBC(Type type,
                                        Class contentClass)
                                 throws InstantiationException
Check that the content class implements the BindingController interface if at least one client interface is defined in its type.

Throws:
InstantiationException