com.collation.platform.model.util
Class MigrationNamingUtility

java.lang.Object
  extended by com.collation.platform.model.util.MigrationNamingUtility

public class MigrationNamingUtility
extends java.lang.Object

NamingUtility class is used to provide a mapping of Object pointers to unique Guids for the names of the objects


Field Summary
protected  NamingUtilityCache cache
           
protected static java.lang.String hexString_
           
protected static com.collation.platform.logger.Logger log_
           
protected static java.lang.String NAMESPACE
           
protected static byte[] NAMESPACE_GUID
           
protected  java.lang.String preFix
           
 
Constructor Summary
MigrationNamingUtility(java.util.List objectClassList)
          Constructor accepts a list of ObjectClass objects and initializes the meta cache and the internal guid and name maps
 
Method Summary
 java.util.HashMap computeGuids(ModelObject mo)
          computeGuids is used to compute the Guids for a given object tree.
protected static Guid getGUID(byte[] nameSpaceGuid, java.lang.String name)
          convert a name space GUID and a qualified name into a GUID that can be used as an instance identifier
protected static java.lang.String transform(java.lang.String input)
          transform changes URI reserved characters into their escaped equivalents.
protected static java.lang.String transformChar(char ch)
          transformChar converts a single character into its escaped representation.
protected  void traverseAllRules(java.lang.String objCls, ModelObject mo, java.util.HashMap guidMap, java.util.HashMap nameMap, ModelObject parentPtr, java.util.HashSet traversedList)
          traverseAllRules traverses all the rules idenitified for this class and all the classes in its hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected NamingUtilityCache cache

log_

protected static com.collation.platform.logger.Logger log_

preFix

protected java.lang.String preFix

NAMESPACE

protected static final java.lang.String NAMESPACE
See Also:
Constant Field Values

NAMESPACE_GUID

protected static final byte[] NAMESPACE_GUID

hexString_

protected static final java.lang.String hexString_
See Also:
Constant Field Values
Constructor Detail

MigrationNamingUtility

public MigrationNamingUtility(java.util.List objectClassList)
Constructor accepts a list of ObjectClass objects and initializes the meta cache and the internal guid and name maps

Parameters:
objectClassList:ArrayList - - An ArrayList of ObjectClass objects
name:String - - Name of this instance of NamingUtility
Method Detail

computeGuids

public java.util.HashMap computeGuids(ModelObject mo)
computeGuids is used to compute the Guids for a given object tree. The function accepts the modelObject and a pointer to a HashMap that is used to store the Guid to object pointers dependency list. The ModelObject may be a single object or a tree of ModelObjects. The function traverses the object looking for contained objects and stores the list of Guids per object in a HashMap that is returned to the caller. As each Guid is formed, a dependency list is also maintained which is then used by the caller to determine the objects that were used to form this Guid

Parameters:
mo:ModelObject - - ModelObject tree
Returns:
HashMap - Map of object pointers to Guids

traverseAllRules

protected void traverseAllRules(java.lang.String objCls,
                                ModelObject mo,
                                java.util.HashMap guidMap,
                                java.util.HashMap nameMap,
                                ModelObject parentPtr,
                                java.util.HashSet traversedList)
traverseAllRules traverses all the rules idenitified for this class and all the classes in its hierarchy. When a rule that is valid is found a Guid is formed for the name string and the Guid is stored in an ArrayList. When all the Guids have been traversed, the guidMap HashMap is updated.

Parameters:
objCls:String - - Class name of the ModelObject
mo:ModelObject - - The ModelObject for which we want to calculate Guids
guidMap:HashMap - - Map of object pointer to Guid List
nameMap:HashMap - - Map of object pointer to Names List
parentPtr:ModelObject - - The parent of the ModelObject mo
traversedList:HashSet - - Set containing object pointers for which traverseAllRules has already been called

getGUID

protected static Guid getGUID(byte[] nameSpaceGuid,
                              java.lang.String name)
convert a name space GUID and a qualified name into a GUID that can be used as an instance identifier

Parameters:
nameSpaceGuid:byte[] - - The IBM CDM name space GUID.
name:String - - Name
Returns:
Guid

transform

protected static java.lang.String transform(java.lang.String input)
transform changes URI reserved characters into their escaped equivalents.

Parameters:
input - The name to be escaped.
Returns:
Escaped string.

transformChar

protected static java.lang.String transformChar(char ch)
transformChar converts a single character into its escaped representation.

Parameters:
ch - The character to be escaped.
Returns:
A String containing the escaped version of the character.