org.objectweb.fractal.fraclet
Class FractalPlugin

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

public abstract class FractalPlugin
extends Plugin

Abstract Fractal plugin supporting Jelly and Velocity as template engines.

Version:
$Revision: 1.12 $
Author:
Romain Rouvoy

Field Summary
protected static String ATTR_CTRL
           
protected static String ATTR_NAME
           
protected static String ATTRIBUTE_NAME
           
protected static String COMP_PREFIX
           
protected static String COMPONENT
           
protected static String CONTROL
           
protected static String FC_CONTROL
          Fractal control interface package exluded by the generation engine.
protected static String LIFECYCLE
           
protected static String LOGGER_NAME
           
protected static String PROVIDES
           
protected static String REQUIRES
           
 
Fields inherited from class org.objectweb.fractal.fraclet.Plugin
OBJECT, shouldGenerate
 
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)
           
FractalPlugin(VelocityTemplateEngine velocity, QDoxCapableMetadataProvider qdox, WriterMapper writer)
           
 
Method Summary
 String attributeController(JavaClass cls)
          Returns the name of the attribute controller.
 String attributeControllerFullname(JavaClass cls)
          Provides the fullname of the attribute-controller associated to the component.
 String attributeControllerName(JavaClass cls)
          Provides the fullname of the attribute-controller associated to the component.
 String attributeName(JavaField f)
          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 f)
          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 f)
          Computes the binding signature (the field signature if no tag specified).
 String componentFullname(JavaClass cls)
          Provides the fully qualified name of the component depending on the filename.
 String componentName(JavaClass cls)
          Provides the short name of the component depending on the filename.
 String componentPackage(JavaClass cls)
          Provides the label of the component's package.
protected  JavaClass[] extend(JavaClass cls)
          Provides a list of business classes at the first level.
 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 hasLifecycles(JavaClass cls, boolean all)
          Checks if the component defines some lifecycle handler.
 boolean hasLogger(JavaClass cls, boolean all)
          Checks if the class defines a logger.
 boolean hasPackage(JavaClass cls)
          Checks if the class defines a package.
 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 isData(JavaClass cls)
          Checks if the class defines fractal interface(s).
 boolean isInterface(JavaClass cls)
          Checks if the class defines fractal interface(s).
 boolean isPrimitive(JavaClass cls)
          Checks if the class is a primitive component.
 JavaMethod[] lifecycles(JavaClass cls, boolean all)
          Provides the list of lifecycle handlers.
 String loggerName(JavaField f)
          Provides the name of the logger associated to the field.
 JavaField[] loggers(JavaClass cls, boolean all)
          Provides the reference to the last logger declared.
 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.objectweb.fractal.fraclet.Plugin
debug, failure, fields, getDestinationFilename, getDestinationPackage, methods, setDestination, shouldGenerate, toInt
 
Methods inherited from class org.generama.defaults.QDoxPlugin
getMetadata, getMetadataProvider, setRestrictedpath
 
Methods inherited from class org.generama.Plugin
assertTrue, getContextObjects, getDestdirFile, 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

COMP_PREFIX

protected static final String COMP_PREFIX
See Also:
Constant Field Values

COMPONENT

protected static final String COMPONENT
See Also:
Constant Field Values

PROVIDES

protected static final String PROVIDES
See Also:
Constant Field Values

REQUIRES

protected static final String REQUIRES
See Also:
Constant Field Values

ATTRIBUTE_NAME

protected static final String ATTRIBUTE_NAME
See Also:
Constant Field Values

CONTROL

protected static final String CONTROL
See Also:
Constant Field Values

LOGGER_NAME

protected static final String LOGGER_NAME
See Also:
Constant Field Values

LIFECYCLE

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

FractalPlugin

public FractalPlugin(JellyTemplateEngine jelly,
                     QDoxCapableMetadataProvider qdox,
                     WriterMapper writer)

FractalPlugin

public FractalPlugin(VelocityTemplateEngine velocity,
                     QDoxCapableMetadataProvider qdox,
                     WriterMapper writer)
Method Detail

componentName

public String componentName(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.

componentPackage

public String componentPackage(JavaClass cls)
Provides the label of the component's package.

Parameters:
cls - the class associated to the component.
Returns:
the package of the component (an empty string if no package).

hasPackage

public boolean hasPackage(JavaClass cls)
Checks if the class defines a package.

Parameters:
cls - the class to check.
Returns:
true if a package is defined.

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. ).

componentFullname

public String componentFullname(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.

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.

isData

public boolean isData(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.

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.
all - performs the search recursively.
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.
all - performs the search recursively.
Returns:
true if the java class has fractal client interfaces.

bindingName

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

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

bindingSignature

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

Parameters:
f - 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.
all - performs the search recursively.
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.
all - performs the search recursively.
Returns:
true if the JavaClass has fractal attributes.

attributeControllerName

public String attributeControllerName(JavaClass cls)
Provides the fullname of the attribute-controller associated to the component.

Parameters:
cls - the component.
Returns:
the attribute-controller fullname.

attributeControllerFullname

public String attributeControllerFullname(JavaClass cls)
Provides the fullname of the attribute-controller associated to the component.

Parameters:
cls - the component.
Returns:
the attribute-controller fullname.

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 f)
Computes the name of the attribute (field name if no tag specified).

Parameters:
f - 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.
all - performs the search recursively.
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.
all - performs the search recursively.
Returns:
true if the java class has fractal client interfaces.

loggers

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

Parameters:
cls - the reference to the logger.
all - performs the search recursively.
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.
all - performs the search recursively.
Returns:
true if a logger is defined in this class (use logger(cls) to retrieve it).

loggerName

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

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

lifecycles

public JavaMethod[] lifecycles(JavaClass cls,
                               boolean all)
Provides the list of lifecycle handlers.

Parameters:
cls - the java class source file parsed.
all - performs the search recursively.
Returns:
the list of methods that handle a lifecyle step.

hasLifecycles

public boolean hasLifecycles(JavaClass cls,
                             boolean all)
Checks if the component defines some lifecycle handler.

Parameters:
cls - the java class source file parsed.
all - performs the search recursively.
Returns:
true if the java class has at least one lifecycle handler.