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

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.asl.AbstractStepAction
          extended by org.inria.ns.reflex.processor.asl.AttributeDefinitionAction
All Implemented Interfaces:
AttributeDefinition, Executable, Identifiable, Presentable, NamespaceContextFactory

public class AttributeDefinitionAction
extends AbstractStepAction
implements AttributeDefinition

At runtime, the <asl:attribute> element with its name attribute defines an attribute.

A global attribute definition is registered to the schema. A local attribute definition is an inline definition. Both are used to test if an attribute value matches the definition. For this purpose, use the getMatchers() method. This method return a single TypeMatcher if the ref-type attribute has been specified with the <asl:attribute> element ; it returns a list of matchers (ItemMatcher) otherwise (built from the element content).

Author:
Philippe Poulard
See Also:
ItemMatcher, TypeMatcher

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.asl.AbstractStepAction
AbstractStepAction.ItemsLists
 
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.asl.AbstractStepAction
STEP_USED_BUBBLE_MESSAGE
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Constructor Summary
AttributeDefinitionAction(QName name, boolean global, QName refType, Expression defaultValue, Element element, AbstractAction parent)
          Creates a new instance of AttributeDefinitionAction.
 
Method Summary
 QName getAttributeName()
          Return the name of the attribute.
 Object getDefaultValue(DataSet dataSet)
          Return the default value of the attribute.
 List getMatchers(MasterSchema masterSchema)
          Return the matchers of this attributes.
 Schema getOwnerSchema()
          Return the schema that contains this definition.
 QName getTypeName()
          Return the name of the type of this attribute.
 
Methods inherited from class org.inria.ns.reflex.processor.asl.AbstractStepAction
computeOccurs, getId, getMaxOccurs, getMinOccurs, invokeHandler, runAction, stableRun, unstableRun
 
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, unmarshal
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeDefinitionAction

public AttributeDefinitionAction(QName name,
                                 boolean global,
                                 QName refType,
                                 Expression defaultValue,
                                 Element element,
                                 AbstractAction parent)
Creates a new instance of AttributeDefinitionAction.

Parameters:
name - The name of the attribute definition.
global - true if the attribute is global (and registered to the schema), false otherwise.
element - The element from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from.
Method Detail

getAttributeName

public QName getAttributeName()
Return the name of the attribute.

Specified by:
getAttributeName in interface AttributeDefinition
Returns:
The name of the attribute.

getDefaultValue

public Object getDefaultValue(DataSet dataSet)
                       throws XPathException
Return the default value of the attribute.

Specified by:
getDefaultValue in interface AttributeDefinition
Parameters:
dataSet - The set of datas used when the action is running.
Returns:
The default value of the attribute.
Throws:
ExecutionException - If the action can't be performed.
XPathException

getTypeName

public QName getTypeName()
Return the name of the type of this attribute.

Specified by:
getTypeName in interface AttributeDefinition
Returns:
The name of the type of this attribute or null.

getOwnerSchema

public Schema getOwnerSchema()
Return the schema that contains this definition.

Specified by:
getOwnerSchema in interface AttributeDefinition
Returns:
The schema that contains this definition.

getMatchers

public List getMatchers(MasterSchema masterSchema)
                 throws ExecutionException,
                        XPathException
Return the matchers of this attributes. The first matcher of the list that will match the attribute value will be kept. If nothing won't match the attribute value, it will be an error.

Specified by:
getMatchers in interface AttributeDefinition
Parameters:
The - non-null master schema to use when a foreign type definition must be get.
Returns:
The non-null list of matchers for this attributes. The matchers of the list have to be tested on an attribute value.
Throws:
ExecutionException
XPathException