net.sf.doolin.oxml
Class OXMLContext

java.lang.Object
  extended by net.sf.doolin.oxml.OXMLContext

public class OXMLContext
extends Object

Execution context

Author:
Damien Coraboeuf

Constructor Summary
OXMLContext(Document document)
          Constructor.
 
Method Summary
protected  void checkUsed(Node node, OXMLReaderOutput output)
          Checks if the node has been used.
 void collect(String collectionName, Object collectionItem)
          Collects a value.
 void contextPutAll(Map<String,Object> context)
          Puts all the instances in the context instance map.
 void fill(OXMLReaderOutput output)
          Fills the output.
protected  void fillCollections(Map<String,Set<Object>> collections)
          Merges the collections.
protected  void fillWarnings(OXMLReaderOutput output)
          Fills the warnings.
 OXMLContextConfig getConfig()
          Gets the config.
 NodeList getNodeList(String path)
          Returns a list of nodes from the current node using an XPath expression.
 Object getTargetRoot()
          Returns the generated target.
 XPathUtils getXpath()
          Returns the XPath utility.
 Object instanceGet(String id)
          Gets a registered instance.
 Object instancePeek()
          Peeks an instance from the stack
 Object instancePop()
          Pops an instance from the stack
 void instancePush(Object instance)
          Pushes an instance onto the stack.
 void instancePut(String id, Object instance)
          Registers an instance.
 void markUsed(Node node)
          Marks the node as being used.
 Object newInstance(String className)
          New instance.
 Node nodePeek()
          Peeks a node from the stack
 Node nodePop()
          Pops a node from the stack
 void nodePush(Node node)
          Pushes a node onto the stack.
protected  boolean nodeUsed(Node node)
          Node used.
 SequenceOXMLAction sequenceGet(String id)
          Gets a sequence.
 void sequencePut(SequenceOXMLAction sequence)
          Registers a sequence.
 void setConfig(OXMLContextConfig config)
          Sets the config.
 void setPackageName(String packageName)
          Sets the root package name to use when loading classes whose only a simple name is given
 void setRoot(Object instance)
          Sets an instance as being the root.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OXMLContext

public OXMLContext(Document document)
Constructor.

Parameters:
document - Source document
Method Detail

checkUsed

protected void checkUsed(Node node,
                         OXMLReaderOutput output)
Checks if the node has been used.

Parameters:
node - Node to check
output - Output to fill

collect

public void collect(String collectionName,
                    Object collectionItem)
Collects a value.

Parameters:
collectionName - Name of the collection
collectionItem - Item to add into the collection

contextPutAll

public void contextPutAll(Map<String,Object> context)
Puts all the instances in the context instance map.

Parameters:
context - Index of instance to load in the context

fill

public void fill(OXMLReaderOutput output)
Fills the output.

Parameters:
output - Output to fill

fillCollections

protected void fillCollections(Map<String,Set<Object>> collections)
Merges the collections.

Parameters:
collections - Collections to fill

fillWarnings

protected void fillWarnings(OXMLReaderOutput output)
Fills the warnings.

Parameters:
output - Output to fill

getConfig

public OXMLContextConfig getConfig()
Gets the config.

Returns:
the config

getNodeList

public NodeList getNodeList(String path)
Returns a list of nodes from the current node using an XPath expression.

Parameters:
path - XPath expression
Returns:
Node list
See Also:
XPathUtils.selectNodeList(org.w3c.dom.Node, String)

getTargetRoot

public Object getTargetRoot()
Returns the generated target.

Returns:
Target

getXpath

public XPathUtils getXpath()
Returns the XPath utility.

Returns:
XPath utility.

instanceGet

public Object instanceGet(String id)
Gets a registered instance.

Parameters:
id - ID for the instance
Returns:
Registered instance or null if not registered.

instancePeek

public Object instancePeek()
Peeks an instance from the stack

Returns:
Top instance
See Also:
Stack.peek()

instancePop

public Object instancePop()
Pops an instance from the stack

Returns:
Popped instance
See Also:
Stack.pop()

instancePush

public void instancePush(Object instance)
Pushes an instance onto the stack.

Parameters:
instance - Instance to push
See Also:
Stack.push(Object)

instancePut

public void instancePut(String id,
                        Object instance)
Registers an instance.

Parameters:
id - ID for the instance
instance - Instance to register

markUsed

public void markUsed(Node node)
Marks the node as being used.

Parameters:
node - Node to mark (if null, nothing is node)

newInstance

public Object newInstance(String className)
New instance.

Parameters:
className - the class name
Returns:
the object

nodePeek

public Node nodePeek()
Peeks a node from the stack

Returns:
Top node
See Also:
Stack.peek()

nodePop

public Node nodePop()
Pops a node from the stack

Returns:
Popped node
See Also:
Stack.pop()

nodePush

public void nodePush(Node node)
Pushes a node onto the stack.

Parameters:
node - Node to push
See Also:
Stack.push(Object)

nodeUsed

protected boolean nodeUsed(Node node)
Node used.

Parameters:
node - the node
Returns:
true, if successful

sequenceGet

public SequenceOXMLAction sequenceGet(String id)
Gets a sequence.

Parameters:
id - Sequence ID
Returns:
Sequence

sequencePut

public void sequencePut(SequenceOXMLAction sequence)
Registers a sequence.

Parameters:
sequence - the sequence to register

setConfig

public void setConfig(OXMLContextConfig config)
Sets the config.

Parameters:
config - the new config

setPackageName

public void setPackageName(String packageName)
Sets the root package name to use when loading classes whose only a simple name is given

Parameters:
packageName - Package name

setRoot

public void setRoot(Object instance)
Sets an instance as being the root.

Parameters:
instance - Instance


Copyright © 2011. All Rights Reserved.