org.inria.ns.reflex.processor.asl
Class ActiveSchemaAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.asl.ActiveSchemaAction
All Implemented Interfaces:
Schema, Executable, Localizable, Presentable, NamespaceContextFactory

public class ActiveSchemaAction
extends AbstractAction
implements Schema

The <asl:active-shema> element is the root element of an Active Shema.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.core.AbstractAction
AbstractAction.ParameterAdapter, AbstractAction.UselessAction
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Constructor Summary
ActiveSchemaAction(String targetNamespaceURI, Node node, AbstractAction parent)
          Creates a new instance of ActiveSchemaAction.
 
Method Summary
 void addAttributeDefinition(AttributeDefinitionAction attributeDefinition)
          Adds an attribute definition.
 void addElementDefinition(ElementDefinitionAction elementDefinition)
          Adds an element definition.
 void addIdAction(AbstractAction action)
          Adds an action that has an ID.
 void addTypeDefinition(Type type)
          Adds a type definition.
 AttributeDefinition getAttributeDefinition(Attr attribute)
          Return an attribute definition defined in this schema.
 AttributeDefinition getAttributeDefinition(QName name)
          Return an attribute definition defined in this schema.
 ElementDefinition getElementDefinition(Element element)
          Return an element definition defined in this schema.
 ElementDefinition getElementDefinition(QName name)
          Return an element definition defined in this schema.
 ElementDefinition getElementDefinition(String namespaceURI)
          Return the fallback element definition defined in this schema.
 Identifiable getIdentifiable(QName id)
          Return an action that has an ID.
 XFile getLocation()
          Return the location of this schema.
 String getTargetNamespaceURI()
          Return the target namespace URI of the schema.
 Type getTypeDefinition(QName name)
          Return a type definition defined in this schema.
 Type getTypeDefinition(String namespaceURI)
          Return the fallback type definition.
 boolean isLocalizable()
          Indicates whether this instance is localizable or not.
 void runAction(DataSet dataSet)
          Set the current object to this schema.
static ActiveSchemaAction schemaLookup(AbstractAction action)
          Schema lookup.
 void setLocation(XFile location)
          Set a base URI for this schema.
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for ActiveSchemaAction.
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractAction
addAction, addFallbackAction, createContext, getCanonicalPath, getFallbackAction, getLocalFallbackAction, getLogger, getNamespaceContext, getNode, getParent, recover, recover, removeFallbackAction, reorganize, run, runActions, toPrettyString, toPrettyString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActiveSchemaAction

public ActiveSchemaAction(String targetNamespaceURI,
                          Node node,
                          AbstractAction parent)
Creates a new instance of ActiveSchemaAction.

Parameters:
targetNamespaceURI - The target namespace URI.
node - The node from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from.
Method Detail

unmarshal

public static AbstractAction unmarshal(AbstractAction parent,
                                       Element element)
                                throws XMLException
XML unmarshaller for ActiveSchemaAction.

Parameters:
parent - The action depending from.
element - The XML element to unmarshall.
Returns:
The ActiveSchemaAction created.
Throws:
UnmarshalException - When the element and its content is not those expected.
XMLException

runAction

public void runAction(DataSet dataSet)
               throws ExecutionException,
                      XPathException
Set the current object to this schema.

Overrides:
runAction in class AbstractAction
Parameters:
dataSet - The set of datas used when the action is running.
Throws:
ExecutionException - If the action can't be performed.
XPathException

getTargetNamespaceURI

public String getTargetNamespaceURI()
Return the target namespace URI of the schema.

Specified by:
getTargetNamespaceURI in interface Schema
Returns:
The target namespace URI.

addIdAction

public void addIdAction(AbstractAction action)
Adds an action that has an ID.

Parameters:
action - The action that has an ID.

getIdentifiable

public Identifiable getIdentifiable(QName id)
Return an action that has an ID.

Specified by:
getIdentifiable in interface Schema
Parameters:
action - The action that has an ID.
Returns:
The action that has the ID expected.

addElementDefinition

public void addElementDefinition(ElementDefinitionAction elementDefinition)
Adds an element definition.

Parameters:
elementDefinition - The element definition to add.

addAttributeDefinition

public void addAttributeDefinition(AttributeDefinitionAction attributeDefinition)
Adds an attribute definition. Anonymous attributes are ignored.

Parameters:
attributeDefinition - The attribute definition to add.

getElementDefinition

public ElementDefinition getElementDefinition(QName name)
Return an element definition defined in this schema.

Specified by:
getElementDefinition in interface Schema
Parameters:
name - The name of the element.
Returns:
The element definition expected if any, or the fallback definition if any, null otherwise.
See Also:
Schema.getElementDefinition(QName)

getElementDefinition

public ElementDefinition getElementDefinition(Element element)
Return an element definition defined in this schema.

Specified by:
getElementDefinition in interface Schema
Parameters:
name - The name of the element.
Returns:
The element definition expected if any, or the fallback definition if any, null otherwise.
See Also:
Schema.getElementDefinition(Element)

getElementDefinition

public ElementDefinition getElementDefinition(String namespaceURI)
Return the fallback element definition defined in this schema.

Specified by:
getElementDefinition in interface Schema
Parameters:
name - The name of the element.
Returns:
The element definition expected if any, or the fallback definition if any, null otherwise.
See Also:
Schema.getElementDefinition(java.lang.String)

schemaLookup

public static ActiveSchemaAction schemaLookup(AbstractAction action)
Schema lookup.

Parameters:
action - The non-null action, that itself or one of its ancestor must be an active schema.
Returns:
The schema that contains the action given.

addTypeDefinition

public void addTypeDefinition(Type type)
Adds a type definition. Anonymous types are ignored.

Parameters:
type - The type definition to add.

getTypeDefinition

public Type getTypeDefinition(QName name)
Return a type definition defined in this schema.

Specified by:
getTypeDefinition in interface Schema
Parameters:
name - The name of the type.
Returns:
The type definition expected if any.
See Also:
Schema.getTypeDefinition(QName)

getTypeDefinition

public Type getTypeDefinition(String namespaceURI)
Return the fallback type definition.

Specified by:
getTypeDefinition in interface Schema
Parameters:
name - The name of the type.
Returns:
The type definition expected if any.
See Also:
Schema.getTypeDefinition(java.lang.String)

getAttributeDefinition

public AttributeDefinition getAttributeDefinition(QName name)
Return an attribute definition defined in this schema.

Specified by:
getAttributeDefinition in interface Schema
Parameters:
name - The name of the attribute.
Returns:
The attribute definition expected if any, null otherwise.
See Also:
Schema.getAttributeDefinition(QName)

getAttributeDefinition

public AttributeDefinition getAttributeDefinition(Attr attribute)
Return an attribute definition defined in this schema.

Specified by:
getAttributeDefinition in interface Schema
Parameters:
name - The name of the attribute.
Returns:
The attribute definition expected if any, null otherwise.
See Also:
Schema.getAttributeDefinition(org.w3c.dom.Attr)

getLocation

public XFile getLocation()
                  throws UnlocalizableException
Return the location of this schema. This method is involved to resolve relative URIs.

Specified by:
getLocation in interface Localizable
Returns:
The non-null path to this schema, which is those of the underlying Active Sheet.
Throws:
UnlocalizableException - If this schema can't be localized.
See Also:
ProcessorInstance.getLocation(), Localizable.getLocation()

isLocalizable

public boolean isLocalizable()
Indicates whether this instance is localizable or not.

Specified by:
isLocalizable in interface Localizable
Returns:
true if this instance is localizable, false otherwise.
See Also:
Localizable.isLocalizable()

setLocation

public void setLocation(XFile location)
                 throws UnlocalizableException
Set a base URI for this schema.

Specified by:
setLocation in interface Localizable
Parameters:
location - The URI where this schema is located.
Throws:
UnlocalizableException - If a base URI is irrelevant for this instance.
See Also:
ProcessorInstance.setLocation(XFile), Localizable.setLocation(org.inria.ns.reflex.modules.io.XFile)