com.ibm.itim.dataservices.model
Class ModelMetaData

java.lang.Object
  extended by com.ibm.itim.dataservices.model.ModelMetaData

public class ModelMetaData
extends java.lang.Object

The ModelMetaData provides an interface for discovering and querying meta-data about the data model. This includes the classes and their relationships. This information can be defined through the interface of this class, or through the use of the meta-data file, enRoleModel.xml. The format of this XML file is described by the enRoleModel.dtd. The following snippet is an example:

 <MODEL>
      <CLASS name="sample.SampleEntity">
          <RELATIONSHIP name="parent" class="sample.SampleEntityParent"/>
      </CLASS>
 </MODEL>
 
This snippet defines one class within the data model from the sample package named SampleEntity. This class has one relationship, parent, that is implemented by the SampleEntityParent class also within the sample package.


Field Summary
static java.lang.String modelFileName
          Constant name of the model meta-data file, enRoleModel.xml.
 
Method Summary
 void defineClass(java.lang.Class cl)
          Defines a new class in the data model.
 void defineEntity(java.lang.String cl, java.lang.String auxClassName, java.lang.String category)
          Defines a relationship for a given class.
 void defineRelationship(java.lang.Class cl, java.lang.String relationshipName, java.lang.Class rel)
          Defines a relationship for a given class.
 void defineRelationship(java.lang.String cl, java.lang.String relationshipName, java.lang.Class rel)
          Defines a relationship for a given class.
 java.util.Collection<java.lang.String> getClasses()
          Returns the names of all classes defined for the data model.
 java.lang.Class getEntity(java.util.Collection objClasses)
          Retrieves the entity class with the given set of LDAP auxiliary class names.
 java.lang.String getEntityCategory(java.util.Collection objClasses)
          Retrieves the entity category with the given set of LDAP auxiliary class names.
static ModelMetaData getInstance()
          Provides access to the single global instance of the ModelMetaData.
 java.lang.Class getRelationship(java.lang.Class cl, java.lang.String relationshipName)
          Retrieves the relationship with the given name for a given class.
 java.util.Set<java.lang.String> getSubjectCategories(java.lang.String relationshipName)
          Returns a set of category names, whose implementation classes support the given relationship.
 java.util.Collection getSupportedRelationships(java.lang.Class cl)
          Returns the names of the supported relationships for the given class.
 void loadTable()
          Loads the table from the enRoleModel.xml file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modelFileName

public static final java.lang.String modelFileName
Constant name of the model meta-data file, enRoleModel.xml.

See Also:
Constant Field Values
Method Detail

getClasses

public java.util.Collection<java.lang.String> getClasses()
Returns the names of all classes defined for the data model.

Returns:
Collection of class names.

getRelationship

public java.lang.Class getRelationship(java.lang.Class cl,
                                       java.lang.String relationshipName)
                                throws ObjectNotFoundException
Retrieves the relationship with the given name for a given class.

Parameters:
cl - Subject class of the relationship.
relationshipName - Name of the relationship to retrieve.
Returns:
Matching Relationship implementation Class.
Throws:
ObjectNotFoundException - Thrown if unable to find a matching Relationship implementation.

getSupportedRelationships

public java.util.Collection getSupportedRelationships(java.lang.Class cl)
                                               throws ObjectNotFoundException
Returns the names of the supported relationships for the given class.

Parameters:
cl - Class for which relationships are queried.
Returns:
Collection of supported relationship names.
Throws:
ObjectNotFoundException - Thrown if unable to find the given class in the data model meta-data.

getEntity

public java.lang.Class getEntity(java.util.Collection objClasses)
                          throws ObjectNotFoundException
Retrieves the entity class with the given set of LDAP auxiliary class names.

Parameters:
objClasses - Collection of the LDAP auxiliary class.
Returns:
Matching Entity implementation Class.
Throws:
ObjectNotFoundException - Thrown if unable to find a matching Entity implementation.

getEntityCategory

public java.lang.String getEntityCategory(java.util.Collection objClasses)
Retrieves the entity category with the given set of LDAP auxiliary class names.

Parameters:
objClasses - Collection of the LDAP auxiliary class.
Returns:
entity category.
Throws:
ObjectNotFoundException - Thrown if unable to find a matching Entity implementation.

defineClass

public void defineClass(java.lang.Class cl)
Defines a new class in the data model. This definition is cached and is not saved to the enRoleModel.xml file.

Parameters:
cl - Class to add to the data model.

defineRelationship

public void defineRelationship(java.lang.Class cl,
                               java.lang.String relationshipName,
                               java.lang.Class rel)
Defines a relationship for a given class. This definition is cached and is not saved to the enRoleModel.xml file.

Parameters:
cl - Subject Class of the relationship.
relationshipName - Name of the relationship being defined.
rel - Implementation class implementing the Relationship interface.

defineRelationship

public void defineRelationship(java.lang.String cl,
                               java.lang.String relationshipName,
                               java.lang.Class rel)
Defines a relationship for a given class. This definition is cached and is not saved to the enRoleModel.xml file.

Parameters:
cl - Name of the Subject Class of the relationship.
relationshipName - Name of the relationship being defined.
rel - Implementation class implementing the Relationship interface.

defineEntity

public void defineEntity(java.lang.String cl,
                         java.lang.String auxClassName,
                         java.lang.String category)
                  throws java.lang.ClassNotFoundException
Defines a relationship for a given class. This definition is cached and is not saved to the enRoleModel.xml file.

Parameters:
cl - Name of the Subject Class of the relationship.
auxClassName - Name of the relationship being defined.
category - Implementation class implementing the Relationship interface. The category can be found at ObjectProfileCategory class.
Throws:
java.lang.ClassNotFoundException - Name of the Subject class of the relationship cannot be found.
See Also:
ObjectProfileCategory

getSubjectCategories

public java.util.Set<java.lang.String> getSubjectCategories(java.lang.String relationshipName)
Returns a set of category names, whose implementation classes support the given relationship.

Parameters:
relationshipName - - Name of the relationship
Returns:
Set of categories that support the relationship.

loadTable

public void loadTable()
               throws java.io.IOException,
                      java.io.FileNotFoundException,
                      ModelIntegrityException
Loads the table from the enRoleModel.xml file.

Throws:
java.io.IOException
java.io.FileNotFoundException
ModelIntegrityException

getInstance

public static ModelMetaData getInstance()
                                 throws ModelIntegrityException
Provides access to the single global instance of the ModelMetaData.

Returns:
Global instance of ModelMetaData.
Throws:
ModelIntegrityException - Thrown if unable to access meta-data.


IBM Security Identity Manager 6.0.0
© Copyright International Business Machines Corporation 2007, 2012. All rights reserved. US Government Users Restricited Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.