org.objectweb.fractal.fraclet
Class FractalPlugin

java.lang.Object
  extended byorg.generama.Plugin
      extended byorg.generama.defaults.QDoxPlugin
          extended byorg.objectweb.fractal.fraclet.FractalPlugin
All Implemented Interfaces:
org.picocontainer.Startable
Direct Known Subclasses:
AttributeControllerPlugin, MonologConfigurationPlugin, PrimitiveDefinitionPlugin

public abstract class FractalPlugin
extends QDoxPlugin

Abstract Fractal plugin supporting Jelly and Velocity as template engines.

Version:
$Revision: 1.4 $
Author:
Romain Rouvoy

Field Summary
protected static String AC_NAME
           
protected static String ATTR_CTRL
           
protected static String ATTR_NAME
           
protected static String BC_NAME
           
protected static String FC_CONTROL
          Fractal control interface package exluded by the generation engine.
protected static String ITF_NAME
           
protected static String LOG_NAME
           
protected static String OBJECT
           
protected static String RC_NAME
           
 
Fields inherited from class org.generama.defaults.QDoxPlugin
metadataProvider
 
Fields inherited from class org.generama.Plugin
DONTEDIT, writerMapper
 
Constructor Summary
FractalPlugin(JellyTemplateEngine jelly, QDoxCapableMetadataProvider qdox, WriterMapper writer)
          Constructor used to generate XML files.
FractalPlugin(VelocityTemplateEngine velocity, QDoxCapableMetadataProvider qdox, WriterMapper writer)
          Constructor used to generate Java or Property files.
 
Method Summary
 String attributeController(JavaClass cls)
          Returns the name of the attribute controller.
 String attributeName(JavaField fld)
          Computes the name of the attribute (field name if no tag specified).
 JavaField[] attributes(JavaClass cls, boolean all)
          Provides the list of component attribute fields.
 String bindingName(JavaField fld)
          Computes the binding name (the field name if no tag specified).
 JavaField[] bindings(JavaClass cls, boolean all)
          Provides the list of bindings defined by the class.
 String bindingSignature(JavaField fld)
          Computes the binding signature (the field signature if no tag specified).
protected  JavaClass[] extend(JavaClass cls)
          Provides a list of business classes at the first level.
protected  JavaField[] fields(JavaClass cls, String doclet, boolean all)
          Provides a list of filtered fields.
 String fullname(JavaClass cls)
          Provides the fully qualified name of the component depending on the filename.
 boolean hasAttributes(JavaClass cls, boolean all)
          Checks if the component defines some attribute.
 boolean hasBindings(JavaClass cls, boolean all)
          Checks if the class defines some binding.
 boolean hasGlue(JavaClass cls)
          Checks if a component glue need to be generated.
 boolean hasLogger(JavaClass cls, boolean all)
          Checks if the class defines a logger.
 boolean hasReflects(JavaClass cls, boolean all)
          Checks if the component defines some control fields.
 boolean isAttributeController(JavaClass cls)
          Checks if the interface is an attribute controller.
 boolean isComponent(JavaClass cls)
          Checks if the class is considered as a component.
 boolean isController(JavaClass cls)
          Checks if the class is a controller (attribute, binding, lifecycle, etc.).
 boolean isInterface(JavaClass cls)
          Checks if the class defines fractal interface(s).
 boolean isPrimitive(JavaClass cls)
          Checks if the class is a primitive component.
 JavaField logger(JavaClass cls, boolean all)
          Provides the reference to the last logger declared.
 String loggerName(JavaField fld)
          Provides the name of the logger associated to the field.
 String name(JavaClass cls)
          Provides the short name of the component depending on the filename.
 String packagePrefix(JavaClass cls)
          Provides the prefix of the package (empty if no package).
 JavaField[] reflects(JavaClass cls, boolean all)
          Provides the list of component control fields.
 String superAttributeController(JavaClass cls)
          Return the name of super attribute controller.
 
Methods inherited from class org.generama.defaults.QDoxPlugin
getMetadata, getMetadataProvider, setRestrictedpath, shouldGenerate
 
Methods inherited from class org.generama.Plugin
assertTrue, getContextObjects, getDestdirFile, getDestinationFilename, getDestinationPackage, getEncoding, getOutputValidator, getPackageName, getWriterMapper, isEmpty, isMultioutput, isValidate, populateContextMap, preGenerate, setDestdir, setEncoding, setFileregex, setFilereplace, setMultioutput, setOutputValidator, setPackageregex, setPackagereplace, setValidate, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FC_CONTROL

protected static final String FC_CONTROL
Fractal control interface package exluded by the generation engine.

See Also:
Constant Field Values

ATTR_NAME

protected static final String ATTR_NAME
See Also:
Constant Field Values

ATTR_CTRL

protected static final String ATTR_CTRL
See Also:
Constant Field Values

OBJECT

protected static final String OBJECT
See Also:
Constant Field Values

ITF_NAME

protected static final String ITF_NAME
See Also:
Constant Field Values

BC_NAME

protected static final String BC_NAME
See Also:
Constant Field Values

AC_NAME

protected static final String AC_NAME
See Also:
Constant Field Values

RC_NAME

protected static final String RC_NAME
See Also:
Constant Field Values

LOG_NAME

protected static final String LOG_NAME
See Also:
Constant Field Values
Constructor Detail

FractalPlugin

public FractalPlugin(JellyTemplateEngine jelly,
                     QDoxCapableMetadataProvider qdox,
                     WriterMapper writer)
Constructor used to generate XML files.

Parameters:
jelly - Jelly template engine used to generate artifacts.
qdox - QDox source code metadata provider.
writer - the output writer.

FractalPlugin

public FractalPlugin(VelocityTemplateEngine velocity,
                     QDoxCapableMetadataProvider qdox,
                     WriterMapper writer)
Constructor used to generate Java or Property files.

Parameters:
velocity - Velocity template engine used to generate artifacts.
qdox - QDox source code metadata provider.
writer - the output writer.
Method Detail

name

public String name(JavaClass cls)
Provides the short name of the component depending on the filename.

Parameters:
cls - the java class source file parsed.
Returns:
the fully qualified name of the associated definition.

fullname

public String fullname(JavaClass cls)
Provides the fully qualified name of the component depending on the filename.

Parameters:
cls - the java class source file parsed.
Returns:
the fully qualified name of the associated definition.

packagePrefix

public String packagePrefix(JavaClass cls)
Provides the prefix of the package (empty if no package).

Parameters:
cls - the class used.
Returns:
the prefix of the package (e.g., org.objectweb.fractal. ).

hasGlue

public boolean hasGlue(JavaClass cls)
Checks if a component glue need to be generated.

Parameters:
cls - the class to check.
Returns:
true if some component glue should be generated.

isInterface

public boolean isInterface(JavaClass cls)
Checks if the class defines fractal interface(s).

Parameters:
cls - the class to check.
Returns:
true if at least one fractal interface is defined.

isComponent

public boolean isComponent(JavaClass cls)
Checks if the class is considered as a component.

Parameters:
cls - the class to check.
Returns:
true if cls or its parent has a doclet tag.

isPrimitive

public boolean isPrimitive(JavaClass cls)
Checks if the class is a primitive component.

Parameters:
cls - the class to check.
Returns:
true if cls is a non-abstract class.

isController

public boolean isController(JavaClass cls)
Checks if the class is a controller (attribute, binding, lifecycle, etc.).

Parameters:
cls - the class to check.
Returns:
true if cls is an interface of the org.objectweb.fractal.control package.

isAttributeController

public boolean isAttributeController(JavaClass cls)
Checks if the interface is an attribute controller.

Parameters:
cls - the java class source file parsed.
Returns:
true if the java class source file describes an attribute controller.

extend

protected JavaClass[] extend(JavaClass cls)
Provides a list of business classes at the first level.

Parameters:
cls - the class considered.
Returns:
the list of business interfaces and class.

fields

protected JavaField[] fields(JavaClass cls,
                             String doclet,
                             boolean all)
Provides a list of filtered fields.

Parameters:
cls - the java class source file parsed.
doclet - the name of the doclet to retrieve.
Returns:
the list of fields having the doclet tag.

bindings

public JavaField[] bindings(JavaClass cls,
                            boolean all)
Provides the list of bindings defined by the class.

Parameters:
cls - the java class source file parsed.
Returns:
the list of fields associated to fractal client interfaces.

hasBindings

public boolean hasBindings(JavaClass cls,
                           boolean all)
Checks if the class defines some binding.

Parameters:
cls - the java class source file parsed.
Returns:
true if the java class has fractal client interfaces.

bindingName

public String bindingName(JavaField fld)
Computes the binding name (the field name if no tag specified).

Parameters:
fld - the java field source file parsed.
Returns:
the name of the binding.

bindingSignature

public String bindingSignature(JavaField fld)
Computes the binding signature (the field signature if no tag specified).

Parameters:
fld - the java field source file parsed.
Returns:
the signature of the binding.

attributes

public JavaField[] attributes(JavaClass cls,
                              boolean all)
Provides the list of component attribute fields.

Parameters:
cls - the java class source file parsed.
Returns:
the list of fields associated to fractal attributes.

hasAttributes

public boolean hasAttributes(JavaClass cls,
                             boolean all)
Checks if the component defines some attribute.

Parameters:
cls - the java class source file parsed.
Returns:
true if the JavaClass has fractal attributes.

superAttributeController

public String superAttributeController(JavaClass cls)
Return the name of super attribute controller.

Parameters:
cls - the class considered.
Returns:
the name of the nearer class needing an attribute controller.

attributeController

public String attributeController(JavaClass cls)
Returns the name of the attribute controller.

Parameters:
cls - the class considered.
Returns:
the name of the nearer class needing an attribute controller.

attributeName

public String attributeName(JavaField fld)
Computes the name of the attribute (field name if no tag specified).

Parameters:
fld - the java field source file parsed.
Returns:
the name of the associated attribute.

reflects

public JavaField[] reflects(JavaClass cls,
                            boolean all)
Provides the list of component control fields.

Parameters:
cls - the java class source file parsed.
Returns:
the list of fields associated to fractal client interfaces.

hasReflects

public boolean hasReflects(JavaClass cls,
                           boolean all)
Checks if the component defines some control fields.

Parameters:
cls - the java class source file parsed.
Returns:
true if the java class has fractal client interfaces.

logger

public JavaField logger(JavaClass cls,
                        boolean all)
Provides the reference to the last logger declared.

Parameters:
cls - the reference to the logger.
Returns:
the field describing the logger.

hasLogger

public boolean hasLogger(JavaClass cls,
                         boolean all)
Checks if the class defines a logger.

Parameters:
cls - the class to check.
Returns:
true if a logger is defined in this class (use logger(cls) to retrieve it).

loggerName

public String loggerName(JavaField fld)
Provides the name of the logger associated to the field.

Parameters:
fld - the field referencing the logger.
Returns:
the name of the logger.