COSMOS ${releaseVersion} resource-modeling Project
Internal API Specification

org.eclipse.cosmos.rm.smlif.internal.common
Class SMLCommonUtil

java.lang.Object
  extended by org.eclipse.cosmos.rm.smlif.internal.common.SMLCommonUtil

public class SMLCommonUtil
extends java.lang.Object

Provides common utility methods that used by multiple classes under different packages.


Constructor Summary
SMLCommonUtil()
           
 
Method Summary
static org.w3c.dom.Node createElement(org.w3c.dom.Node parentNode, java.lang.String uri, java.lang.String localName)
           
static org.w3c.dom.Node createFormattedElement(org.w3c.dom.Node parentNode, java.lang.String uri, java.lang.String localName, boolean append)
           
static org.w3c.dom.Node nestedNodeRetrieval(org.w3c.dom.Node node, java.lang.String[][] nodeNames)
          Equivalent to nestedNodeRetrieval (node, nodeNames, false, true)
static org.w3c.dom.Node nestedNodeRetrieval(org.w3c.dom.Node node, java.lang.String[][] nodeNames, boolean create, boolean append)
          Retrieve the nested node as specified by nodeNames (starting from 'node').
static java.lang.String[] retrieveAliases(java.util.Map userDefinedAliases, org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument document)
          Retrieves and returns the aliases associated with document
static org.w3c.dom.Node retrieveChildNode(org.w3c.dom.Node parent, java.lang.String uri, java.lang.String localName)
          Retrive the child node of 'parent' with the uri and localName passed in
static java.lang.String retrieveTextNode(org.w3c.dom.Node node)
          Retrieve the text child node of the argument node passed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMLCommonUtil

public SMLCommonUtil()
Method Detail

retrieveChildNode

public static org.w3c.dom.Node retrieveChildNode(org.w3c.dom.Node parent,
                                                 java.lang.String uri,
                                                 java.lang.String localName)
Retrive the child node of 'parent' with the uri and localName passed in

Parameters:
parent - The parent node
uri - The URI
localName - The local name of the element
Returns:
The element node or null if it cannot be found

retrieveTextNode

public static java.lang.String retrieveTextNode(org.w3c.dom.Node node)
Retrieve the text child node of the argument node passed

Parameters:
node - The node
Returns:
The child text of node

nestedNodeRetrieval

public static org.w3c.dom.Node nestedNodeRetrieval(org.w3c.dom.Node node,
                                                   java.lang.String[][] nodeNames)
Equivalent to nestedNodeRetrieval (node, nodeNames, false, true)


nestedNodeRetrieval

public static org.w3c.dom.Node nestedNodeRetrieval(org.w3c.dom.Node node,
                                                   java.lang.String[][] nodeNames,
                                                   boolean create,
                                                   boolean append)
Retrieve the nested node as specified by nodeNames (starting from 'node'). The nodeNames are expected to be any array of String[] where String[0] = URI of a node and String[1] = localName. For example, given:
        
 
The node 'c' can be retrieved using nestedNodeRetrieval(node, new String[][] {new String[]{b's URI, "b"}, new String[]{c's URI, "c"}}); where node corresponds to a's node.

Parameters:
node - The starting node
nodeNames - The node names
create - Creates the node if none is found
Returns:
The node representing the last entry of nodeNames or null if none is found

createElement

public static org.w3c.dom.Node createElement(org.w3c.dom.Node parentNode,
                                             java.lang.String uri,
                                             java.lang.String localName)

createFormattedElement

public static org.w3c.dom.Node createFormattedElement(org.w3c.dom.Node parentNode,
                                                      java.lang.String uri,
                                                      java.lang.String localName,
                                                      boolean append)

retrieveAliases

public static java.lang.String[] retrieveAliases(java.util.Map userDefinedAliases,
                                                 org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument document)
Retrieves and returns the aliases associated with document

Parameters:
userDefinedAliases - The user defined aliases
document - The document
Returns:
The aliases associated with document

COSMOS ${releaseVersion} resource-modeling Project
Internal API Specification