org.inria.ns.reflex.processor
Class Module

java.lang.Object
  extended by org.inria.ns.reflex.processor.Module
Direct Known Subclasses:
Module.DeferredModule

public class Module
extends Object

A module allows to group related Active Tags features together.

Each concrete class of item managed is invoked only if it is expected, that is to say encountered in the active sheet.

The items managed are stored with their qualified name. The null qualified named (QName.QNULL) is supported.

Author:
Philippe Poulard

Nested Class Summary
static class Module.DeferredModule
          A module that unmarshals itself only when it is invoked.
 
Constructor Summary
Module(Module module, String version)
          Creates a new module, and attach it to the list of versions.
Module(String ns, String version)
          Creates a new module.
 
Method Summary
 void addAction(QName activeTagName, String actionClass)
          Binds an active tag to a concrete action class or factory class.
 void addExtendedFunction(QName functionName, String functionClass)
          Binds an extended function to a concrete class.
 void addFactory(QName qualifiedName, ClassBuilder factory)
          Binds a class factory to a qualified name.
 void addForeignAttribute(QName attributeName, String attributeClass)
          Binds a foreign attribute to a concrete class or factory class.
 void addPropertyResolver(QName predefinedProperty, String propertyResolverClass)
          Binds a property resolver class to a property name.
 void addPropertyResolver(String propertyResolverClass)
          Binds a property resolver class to the namespace.
 AbstractAction getAction(QName activeTagName, AbstractAction parent, Element element)
          Get the action bound to the given qualified name.
 XPathFunction getExtendedFunction(QName functionName)
          Gets the concrete foreign attribute class or factory class that corresponds to the qualified name given.
 ForeignAttribute getForeignAttribute(QName attributeName, String value)
          Gets the concrete foreign attribute class or factory class that corresponds to the qualified name given.
 String getNamespaceURI()
          Return the namespace URI of the module.
 PropertyResolver getPropertyResolver(QName predefinedProperty)
          Return the property resolver for the specified QName key if it exists, or with the namespace URI of the QName key.
 String getVersion()
          Return the version of the module.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Module

public Module(String ns,
              String version)
Creates a new module.

Parameters:
ns - The universal key (namespace URI) of the module.
version - The version of the module.

Module

public Module(Module module,
              String version)
Creates a new module, and attach it to the list of versions.

Parameters:
module - Another version of the same module.
version - The version of the module.
Method Detail

getVersion

public String getVersion()
Return the version of the module.

Returns:
The version of the module.

getNamespaceURI

public String getNamespaceURI()
Return the namespace URI of the module.

Returns:
The namespace URI of the module.

addFactory

public void addFactory(QName qualifiedName,
                       ClassBuilder factory)
Binds a class factory to a qualified name. If a class factory already exists for the qualified name given, it is used as a back factory.

Parameters:
qualifiedName - The qualified named of the factory.
factory - The factory that will deliver an instance of the active tag, predefined property, foreign attribute, or XPath function.

addAction

public void addAction(QName activeTagName,
                      String actionClass)
Binds an active tag to a concrete action class or factory class.

Parameters:
activeTagName - The qualified named of the active tag.
actionClass - The name of the class. The class must have the following method signature : unmarshall(AbstractAction parent, Element e) that must return an AbstractAction.

getAction

public AbstractAction getAction(QName activeTagName,
                                AbstractAction parent,
                                Element element)
                         throws XMLException
Get the action bound to the given qualified name. When necessary, the element is unmarshalled.

Parameters:
activeTagName - The name of the active tag to get.
parent - The action depending from.
element - The active tag.
Returns:
A new action that corresponds to the active tag encountered.
Throws:
XMLException

addPropertyResolver

public void addPropertyResolver(QName predefinedProperty,
                                String propertyResolverClass)
Binds a property resolver class to a property name.

Parameters:
predefinedProperty - The qualified name of the predefined property.
propertyResolverClass - The name of the class that is a PropertResolver.

addPropertyResolver

public void addPropertyResolver(String propertyResolverClass)
Binds a property resolver class to the namespace.

Parameters:
propertyResolverClass - The name of the class that is a PropertResolver.

getPropertyResolver

public PropertyResolver getPropertyResolver(QName predefinedProperty)
                                     throws UnrecoverableException
Return the property resolver for the specified QName key if it exists, or with the namespace URI of the QName key.

Parameters:
predefinedProperty - The qualified name of the predefined property to resolve.
Returns:
The property resolver for the specified QName key or its namespace, or null if none entry found. If a property resolver doesn't exist for a QName, those bound to its namespace is returned if it exists.
Throws:
UnrecoverableException

addExtendedFunction

public void addExtendedFunction(QName functionName,
                                String functionClass)
Binds an extended function to a concrete class.

Parameters:
functionName - The qualified named of the XPath function.
functionClass - The name of the class.

getExtendedFunction

public XPathFunction getExtendedFunction(QName functionName)
                                  throws UnrecoverableException
Gets the concrete foreign attribute class or factory class that corresponds to the qualified name given.

Parameters:
attributeName - The qualified named of the foreign attribute.
Returns:
The class that corresponds to the qualified name registered, or null.
Throws:
UnrecoverableException

addForeignAttribute

public void addForeignAttribute(QName attributeName,
                                String attributeClass)
Binds a foreign attribute to a concrete class or factory class.

Parameters:
attributeName - The qualified named of the foreign attribute.
actionClass - The name of the class.

getForeignAttribute

public ForeignAttribute getForeignAttribute(QName attributeName,
                                            String value)
                                     throws UnrecoverableException
Gets the concrete foreign attribute class or factory class that corresponds to the qualified name given.

Parameters:
attributeName - The qualified named of the foreign attribute.
value - The value of the foreign attribute.
Returns:
The foreign attribute that corresponds to the qualified name registered, or null.
Throws:
UnrecoverableException