Class MetaData

  • Direct Known Subclasses:
    ITRegistryMetaData, JarMetaData

    public abstract class MetaData
    extends java.lang.Object
    An abstract class that declares the routines to be used to retrieve the CDM meta-data.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static ResourceHash resHash
      NLS Property set holding name-value pairs for the resource.
    • Constructor Summary

      Constructors 
      Constructor Description
      MetaData()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      Attribute createExplicitAttribute​(org.w3c.dom.Node currentNode, java.lang.String name)
      Creates an explicit attribute with the corresponding name and adds it to the provided node.
      Attribute createImplicitAttribute​(org.w3c.dom.Node currentNode, java.lang.String classType, java.lang.String parentName, java.lang.String childName, java.lang.String relatedID)
      Creates an implicit attribute using the provided information.
      abstract java.util.Vector<Entry> getAttributes​(java.lang.String artifactType, java.lang.String classType)
      Retrieves the attributes of a given artifact (CI or a Relationship).
      abstract java.lang.String getCdmVersion()
      Retrieves the version of the Common Data Model, which meta-data is extracted.
      java.lang.String getClassType​(java.lang.String classType)
      Returns the correct class type.
      java.lang.String getExtendedAttributeName​(java.lang.String attributeName)
      Prefixes the provided string as an extended attribute.
      protected java.lang.String getIdentifierName​(NamingRuleIdentifier identifier)
      Generate proper name for provided NamingRuleIdentifier.
      java.lang.String getMSSClassName()
      Returns the name of the ManagementSoftwareSystem class type.
      protected NamingRuleIdentifier getNamingRuleIdentifier​(java.lang.String classType, java.lang.String originalName)
      Create NamingRuleIdentifier be provided class type and attribute name.
      protected abstract java.util.List<NamingRule> getNamingRules​(java.lang.String classType)
      Returns the CDM naming rules for the provided class.
      protected java.util.Vector<Entry> getRelationshipAttributes()
      Returns the attributes supported by a Relationship.
      abstract java.util.Map<java.lang.String,​java.lang.Object> getTypes​(java.lang.String artifactType)
      Returns the CDM meta-data types artifacts (CIs or Relationships).
      java.util.List<NamingRule> getUnsatisfiedNamingRules​(java.lang.String classType, java.util.Set<java.lang.String> attributeNames)
      Compute delta of naming rules for the class type and provided attributes.
      boolean matchesNamingRules​(java.lang.String classType, java.util.Set<java.lang.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 java.util.Vector<Entry> getAttributes​(java.lang.String artifactType,
                                                              java.lang.String classType)
                                                       throws java.lang.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:
        java.lang.Exception - if a problem occurs.
      • getCdmVersion

        public abstract java.lang.String getCdmVersion()
                                                throws java.lang.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:
        java.lang.Exception - if a problem occurs.
      • getTypes

        public abstract java.util.Map<java.lang.String,​java.lang.Object> getTypes​(java.lang.String artifactType)
                                                                                 throws java.lang.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:
        java.lang.Exception - if a problem occurs.
      • getRelationshipAttributes

        protected java.util.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 java.lang.String getExtendedAttributeName​(java.lang.String attributeName)
        Prefixes the provided string as an extended attribute.
        Parameters:
        attributeName - input name.
        Returns:
        prefixed name.
      • getClassType

        public java.lang.String getClassType​(java.lang.String classType)
        Returns the correct class type.
        Parameters:
        classType - the native class name.
        Returns:
        CDM class name.
      • getMSSClassName

        public java.lang.String getMSSClassName()
        Returns the name of the ManagementSoftwareSystem class type.
        Returns:
        the MSS class type.
      • createExplicitAttribute

        public Attribute createExplicitAttribute​(org.w3c.dom.Node currentNode,
                                                 java.lang.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​(org.w3c.dom.Node currentNode,
                                                 java.lang.String classType,
                                                 java.lang.String parentName,
                                                 java.lang.String childName,
                                                 java.lang.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 java.util.List<NamingRule> getNamingRules​(java.lang.String classType)
                                                              throws java.lang.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:
        java.lang.Exception - if a problem occurs when reading the rules.
      • matchesNamingRules

        public boolean matchesNamingRules​(java.lang.String classType,
                                          java.util.Set<java.lang.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 java.util.List<NamingRule> getUnsatisfiedNamingRules​(java.lang.String classType,
                                                                    java.util.Set<java.lang.String> attributeNames)
                                                             throws java.lang.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:
        java.lang.Exception - if an error occurs.
      • getNamingRuleIdentifier

        protected NamingRuleIdentifier getNamingRuleIdentifier​(java.lang.String classType,
                                                               java.lang.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 java.lang.String getIdentifierName​(NamingRuleIdentifier identifier)
        Generate proper name for provided NamingRuleIdentifier.
        Parameters:
        identifier - whose name will be generate.
        Returns:
        a proper name