com.ibm.di.cdm.core
Class MetaData

java.lang.Object
  extended by com.ibm.di.cdm.core.MetaData
Direct Known Subclasses:
ITRegistryMetaData, JarMetaData

public abstract class MetaData
extends Object

An abstract class that declares the routines to be used to retrieve the CDM meta-data.


Field Summary
protected static ResourceHash resHash
          NLS Property set holding name-value pairs for the resource.
 
Constructor Summary
MetaData()
           
 
Method Summary
 Attribute createExplicitAttribute(Node currentNode, String name)
          Creates an explicit attribute with the corresponding name and adds it to the provided node.
 Attribute createImplicitAttribute(Node currentNode, String classType, String parentName, String childName, String relatedID)
          Creates an implicit attribute using the provided information.
abstract  Vector<Entry> getAttributes(String artifactType, String classType)
          Retrieves the attributes of a given artifact (CI or a Relationship).
abstract  String getCdmVersion()
          Retrieves the version of the Common Data Model, which meta-data is extracted.
 String getClassType(String classType)
          Returns the correct class type.
 String getExtendedAttributeName(String attributeName)
          Prefixes the provided string as an extended attribute.
protected  String getIdentifierName(NamingRuleIdentifier identifier)
          Generate proper name for provided NamingRuleIdentifier.
 String getMSSClassName()
          Returns the name of the ManagementSoftwareSystem class type.
protected  NamingRuleIdentifier getNamingRuleIdentifier(String classType, String originalName)
          Create NamingRuleIdentifier be provided class type and attribute name.
protected abstract  List<NamingRule> getNamingRules(String classType)
          Returns the CDM naming rules for the provided class.
protected  Vector<Entry> getRelationshipAttributes()
          Returns the attributes supported by a Relationship.
abstract  Map<String,Object> getTypes(String artifactType)
          Returns the CDM meta-data types artifacts (CIs or Relationships).
 List<NamingRule> getUnsatisfiedNamingRules(String classType, Set<String> attributeNames)
          Compute delta of naming rules for the class type and provided attributes.
 boolean matchesNamingRules(String classType, Set<String> attributes)
          Returns true if the provided set of attributes matches any of the rules of that class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resHash

protected static final ResourceHash resHash
NLS Property set holding name-value pairs for the resource.

Constructor Detail

MetaData

public MetaData()
Method Detail

getAttributes

public abstract Vector<Entry> getAttributes(String artifactType,
                                            String classType)
                                     throws Exception
Retrieves the attributes of a given artifact (CI or a Relationship).

Parameters:
artifactType - determines the type of artifact, which attributes we want. Accepts either IdMLConstants.ARTIFACT_CI or IdMLConstants.ARTIFACT_RELATIONSHIP.
classType - the type of the artifact, which attributes we want.
Returns:
a Vector containing the CI/Relationship attributes.
Throws:
Exception - if a problem occurs.

getCdmVersion

public abstract String getCdmVersion()
                              throws Exception
Retrieves the version of the Common Data Model, which meta-data is extracted.

Returns:
a string representing the CDM version. Its format is '<version>.<release>.<modifier>'.
Throws:
Exception - if a problem occurs.

getTypes

public abstract Map<String,Object> getTypes(String artifactType)
                                     throws Exception
Returns the CDM meta-data types artifacts (CIs or Relationships).

Parameters:
artifactType - determines the type of artifact - either IdMLConstants.ARTIFACT_CI or IdMLConstants.ARTIFACT_RELATIONSHIP.
Returns:
a Map containing the CDM type names and additional data for them as an Object.
Throws:
Exception - if a problem occurs.

getRelationshipAttributes

protected Vector<Entry> getRelationshipAttributes()
Returns the attributes supported by a Relationship. Each Relationship has two mandatory attributes - source and target.

Returns:
a Vector containing the Relationship attributes.

getExtendedAttributeName

public String getExtendedAttributeName(String attributeName)
Prefixes the provided string as an extended attribute.

Parameters:
attributeName - input name.
Returns:
prefixed name.

getClassType

public String getClassType(String classType)
Returns the correct class type.

Parameters:
classType - the native class name.
Returns:
CDM class name.

getMSSClassName

public String getMSSClassName()
Returns the name of the ManagementSoftwareSystem class type.

Returns:
the MSS class type.

createExplicitAttribute

public Attribute createExplicitAttribute(Node currentNode,
                                         String name)
Creates an explicit attribute with the corresponding name and adds it to the provided node.

Parameters:
currentNode - the node where the attribute is to be added.
name - the name of the new attribute.
Returns:
the created attribute.

createImplicitAttribute

public Attribute createImplicitAttribute(Node currentNode,
                                         String classType,
                                         String parentName,
                                         String childName,
                                         String relatedID)
Creates an implicit attribute using the provided information. A check for existing duplicates is performed.

Parameters:
currentNode - the node where the attribute is to be added.
classType - the type of the class owning the implicit attribute.
parentName - the name of the relationship represented by this implicit attribute.
childName - the type of the other item which the implicit attribute points to.
relatedID - the ID of the related item. If provided the current hierarchy will be checked for a duplicate and if such is found the implicit attribute will not be added. To skip the duplicate check set this parameter to null.
Returns:
the created attribute.

getNamingRules

protected abstract List<NamingRule> getNamingRules(String classType)
                                            throws Exception
Returns the CDM naming rules for the provided class.

Parameters:
classType - the class type of interest.
Returns:
a list of the available naming rules.
Throws:
Exception - if a problem occurs when reading the rules.

matchesNamingRules

public boolean matchesNamingRules(String classType,
                                  Set<String> attributes)
Returns true if the provided set of attributes matches any of the rules of that class.

Parameters:
classType - the class type of interest.
attributes - a list of available attribute names.
Returns:
true if a matching rule is found, false otherwise.

getUnsatisfiedNamingRules

public List<NamingRule> getUnsatisfiedNamingRules(String classType,
                                                  Set<String> attributeNames)
                                           throws Exception
Compute delta of naming rules for the class type and provided attributes.

Parameters:
classType - the class whose rules will be processed.
attributeNames - Set of attribute names.
Returns:
list of delta naming rules.
Throws:
Exception - if an error occurs.

getNamingRuleIdentifier

protected NamingRuleIdentifier getNamingRuleIdentifier(String classType,
                                                       String originalName)
Create NamingRuleIdentifier be provided class type and attribute name.

Parameters:
classType - the class whose attribute is processed.
originalName - original attribute name.
Returns:
new NamingRuleIdentifier for provided attribute.

getIdentifierName

protected String getIdentifierName(NamingRuleIdentifier identifier)
Generate proper name for provided NamingRuleIdentifier.

Parameters:
identifier - whose name will be generate.
Returns:
a proper name