org.ejen
Class EjenMergeNode

java.lang.Object
  |
  +--org.ejen.EjenChildNode
        |
        +--org.ejen.EjenMergeNode
All Implemented Interfaces:
EjenConstants

public class EjenMergeNode
extends EjenChildNode

Merge node class.

A merge node merges an XML file into the current in memory DOM tree. Attributes give a basic way to control the merge origin and destination. If this is not sufficient, it is still possible to use an XMLInclude extension.

Usage (ant build file)

  <?xml version="1.0" encoding="UTF-8"?>

  <project name="generate" default="build">

    <taskdef name="ejen" classname="org.ejen.EjenTask"/>

    <target name="build">
      <ejen ...>
        ...
        <merge file="merged.xml"
              [select="/ejen/entity-bean"]
              [to="/ejen/others"]
        />
        ...
      </ejen>
    </target>

  </project>
 

Parent nodes:

Version:
1.0
Author:
F. Wolff
See Also:
EjenSourceNode, EjenSaveNode, XMLInclude

Field Summary
protected  String _file
           
protected  String _select
           
protected  String _to
           
 
Fields inherited from class org.ejen.EjenChildNode
_messageIndent
 
Fields inherited from interface org.ejen.EjenConstants
CTX_DOM_SOURCE, CTX_STYLESHEET_HANDLER, CTX_STYLESHEET_ROOT, CTX_TRANSFORMER_FACTORY_IMPL, CTX_TRANSFORMER_IMPL, DEFAULT_XML_DATA, DEFAULT_XML_DATA_ENCODING, DEFAULT_XSL_DATA, LOG_INDENT_STR1, LOG_INDENT_STR2, MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE, MSG_WARN, STATE_AFTER_PROCESS, STATE_BEFORE_PROCESS, STATE_CHECK, STATE_IDLE, STATE_PROCESS, STATES
 
Constructor Summary
EjenMergeNode()
           
 
Method Summary
 void check()
          Checks this EjenMergeNode for mandatory attributes.
 Properties getAttributes()
          Returns all non null attributes of this EjenSaveNode.
 String nodeName()
          Returns the name of this EjenMergeNode (always "merge").
 void process()
          Executes this EjenMergeNode.
 void setFile(String file)
          [mandatory/AVT] - sets the file attribute.
 void setSelect(String select)
          [optional/AVT] - sets the select attribute.
 void setTo(String to)
          [optional/AVT] - sets the to attribute.
 
Methods inherited from class org.ejen.EjenChildNode
afterProcess, beforeProcess, cloneContext, evaluateAVT, evaluateAVT, getChildren, getFromContext, getFromContext, getFromGlobalContext, getListener, getState, idle, popContext, pushContext, putInContext, putInGlobalContext, sendMessageEvent, sendMessageEvent, sendStateEvent, sendXSLMessageEvent, sendXSLMessageEvent, setListener, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_file

protected String _file

_select

protected String _select

_to

protected String _to
Constructor Detail

EjenMergeNode

public EjenMergeNode()
Method Detail

nodeName

public String nodeName()
Returns the name of this EjenMergeNode (always "merge").

Specified by:
nodeName in class EjenChildNode
Returns:
the name of this EjenMergeNode.

getAttributes

public Properties getAttributes()
Returns all non null attributes of this EjenSaveNode.

Overrides:
getAttributes in class EjenChildNode
Returns:
non null attributes of this EjenSaveNode.

setFile

public void setFile(String file)
[mandatory/AVT] - sets the file attribute.

Parameters:
file - name of the XML file to be merged into the current in memory DOM tree.

setSelect

public void setSelect(String select)
[optional/AVT] - sets the select attribute.

Parameters:
select - may be used to select only a sub-nodes set in the XML file to be merged. Default is root node.

setTo

public void setTo(String to)
[optional/AVT] - sets the to attribute.

Parameters:
to - may be used to change the destination node (parent node of the nodes to be merged). Default is root node.

check

public void check()
Checks this EjenMergeNode for mandatory attributes.

Overrides:
check in class EjenChildNode
Throws:
EjenException - if file attribute is not set.

process

public void process()
Executes this EjenMergeNode.

Overrides:
process in class EjenChildNode
Throws:
EjenException - if something goes wrong...