com.ibm.adt.topology.provider.impl
Class TopologyObjectImpl

java.lang.Object
  extended by com.ibm.adt.topology.provider.impl.TopologyObjectImpl
All Implemented Interfaces:
TopologyObject

public class TopologyObjectImpl
extends java.lang.Object
implements TopologyObject

TopologyObjectImpl provides a default implementation of TopologyObject that is used in conjunction with the default TopologyProvider implementation. A Provider implementation may choose to use this class directly or may extend it to provide customized function such as querying some backend for related object or property information. In addition to implementing the public APIs defined by TopologyObject, several helper methods are also availble for use by the Provider implementation.


Constructor Summary
protected TopologyObjectImpl(java.lang.String internalId, java.lang.String displayName, TopologyObjectType type, TopologyProviderImpl provider)
          Creates a TopologyObjectImpl instance.
 
Method Summary
protected  void cacheParentObject(TopologyObject object)
          Helper method to cache the reference to the parent TopologyObject.
 void cacheProperties(PropertyList properties)
          Helper method that caches the properties for the TopologyObject.
protected  void cacheRelatedObject(TopologyObjectImpl object, RelationshipMetaInfo relationship)
          Helper method to cache the related TopologyObject using the specified relationship.
protected  TopologyObject[] getCachedRelatedObjects(RelationshipMetaInfo relationship)
          Helper methid to retreive the cached related TopologyObjects for the specified relationship.
 java.lang.String getDisplayName()
           
 java.lang.String getFQName()
           
protected  java.lang.String getInternalId()
          Helper method that returns the internal TopologyObject id.
protected  TopologyObjectType getInternalType()
          Helper method that returns the TopologyObjectType instance associated with this TopologyObject.
 TopologyObject getParent()
           
 PropertyList getProperties()
           
 TopologyProvider getProvider()
           
 TopologyObject[] getRelatedObjects(RelationshipMetaInfo relationship)
           
 TopologyObject[] getRelatedObjects(RelationshipMetaInfo[] relationships)
           
 TopologyObject[] getRelatedObjects(RelationshipMetaInfo[] relationships, TopologyService serviceContext)
           
 TopologyObject[] getRelatedObjects(RelationshipMetaInfo relationship, TopologyService serviceContext)
           
 RelationshipMetaInfo[] getRelationshipsMetaInfo()
           
 RelationshipMetaInfo[] getRelationshipsMetaInfo(java.lang.String relationshipKey)
           
 TopologyObject getRoot()
           
 java.lang.String getType()
           
 java.lang.String getUniqueId()
           
protected  boolean relatedObjectsCached(RelationshipMetaInfo relationship)
          Helper method to test the "objects cached" indicator for the specified relationship.
protected  void setDisplayName(java.lang.String displayName)
          Helper method to reset the display name for the object.
protected  void setRelatedObjectsCached(RelationshipMetaInfo relationship)
          Helper method to set the "objects cached" indicator for the specified relationship.
protected  void validateRelationship(RelationshipMetaInfo relationship)
          Helper method that validates the RelationshipMetaInfo instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopologyObjectImpl

protected TopologyObjectImpl(java.lang.String internalId,
                             java.lang.String displayName,
                             TopologyObjectType type,
                             TopologyProviderImpl provider)
                      throws TopologyException
Creates a TopologyObjectImpl instance.

Parameters:
internalId - an identifier that uniquely identifies this TopologyObject within the context of the owning TopologyProviderImpl instance
displayName - a name that uniquely names this TopologyObject within it's composition heirarchy
type - the type of TopologyObject (in TopologyObjectType form)
provider -
Throws:
TopologyException
Method Detail

getParent

public TopologyObject getParent()
Specified by:
getParent in interface TopologyObject
Returns:
The parent TopologyObject

getProperties

public PropertyList getProperties()
                           throws TopologyException
Specified by:
getProperties in interface TopologyObject
Returns:
the TopologyObject properties
Throws:
TopologyException

getRelatedObjects

public TopologyObject[] getRelatedObjects(RelationshipMetaInfo relationship)
                                   throws TopologyException
Specified by:
getRelatedObjects in interface TopologyObject
Returns:
an array of related TopologyObject(s) corresponding to specified relationship
Throws:
TopologyException

getRelatedObjects

public TopologyObject[] getRelatedObjects(RelationshipMetaInfo[] relationships)
                                   throws TopologyException
Specified by:
getRelatedObjects in interface TopologyObject
Returns:
an array of related TopologyObject(s) corresponding to specified relationship
Throws:
TopologyException

getRelatedObjects

public TopologyObject[] getRelatedObjects(RelationshipMetaInfo[] relationships,
                                          TopologyService serviceContext)
                                   throws TopologyException
Specified by:
getRelatedObjects in interface TopologyObject
Returns:
an array of related TopologyObject(s) corresponding to specified relationship
Throws:
TopologyException

getRelatedObjects

public TopologyObject[] getRelatedObjects(RelationshipMetaInfo relationship,
                                          TopologyService serviceContext)
                                   throws TopologyException
Specified by:
getRelatedObjects in interface TopologyObject
Returns:
an array of related TopologyObject(s) corresponding to specified relationship
Throws:
TopologyException

getDisplayName

public final java.lang.String getDisplayName()
Specified by:
getDisplayName in interface TopologyObject
Returns:
The display name for this TopologyObject

getFQName

public final java.lang.String getFQName()
                                 throws TopologyException
Specified by:
getFQName in interface TopologyObject
Returns:
The fully-qualified TopologyObject name
Throws:
TopologyException

getProvider

public final TopologyProvider getProvider()
Specified by:
getProvider in interface TopologyObject
Returns:
The provider instance that contains this TopologyObject

getType

public final java.lang.String getType()
Specified by:
getType in interface TopologyObject
Returns:
The TopologyObject type as a string

getUniqueId

public final java.lang.String getUniqueId()
Specified by:
getUniqueId in interface TopologyObject
Returns:
The TopologyObject id

getRoot

public final TopologyObject getRoot()
                             throws TopologyException
Specified by:
getRoot in interface TopologyObject
Returns:
The root TopologyObject in the composition tree (usually the provider TopologyObject)
Throws:
TopologyException

getRelationshipsMetaInfo

public final RelationshipMetaInfo[] getRelationshipsMetaInfo()
                                                      throws TopologyException
Specified by:
getRelationshipsMetaInfo in interface TopologyObject
Returns:
all of the possible relationships for the TopologyObject
Throws:
TopologyException

getRelationshipsMetaInfo

public final RelationshipMetaInfo[] getRelationshipsMetaInfo(java.lang.String relationshipKey)
                                                      throws TopologyException
Specified by:
getRelationshipsMetaInfo in interface TopologyObject
Parameters:
relationshipKey - in the form of "key=value::key=value::..." where key can be any of the following: relationshipType, sourceType, label, targetType, isCrossProvider, sourceRole, targetRole, navigable, uniqueId
Returns:
all of the possible relationships for the TopologyObject that correspond to specifed relationshipKey
Throws:
TopologyException

cacheProperties

public final void cacheProperties(PropertyList properties)
Helper method that caches the properties for the TopologyObject.

Parameters:
properties -

validateRelationship

protected final void validateRelationship(RelationshipMetaInfo relationship)
                                   throws TopologyException
Helper method that validates the RelationshipMetaInfo instance.

Parameters:
relationship -
Throws:
TopologyException

getInternalId

protected final java.lang.String getInternalId()
Helper method that returns the internal TopologyObject id.


cacheParentObject

protected final void cacheParentObject(TopologyObject object)
Helper method to cache the reference to the parent TopologyObject.

Parameters:
object -

cacheRelatedObject

protected final void cacheRelatedObject(TopologyObjectImpl object,
                                        RelationshipMetaInfo relationship)
                                 throws TopologyException
Helper method to cache the related TopologyObject using the specified relationship.

Parameters:
object - specifies related object reference to be cached
relationship -
Throws:
TopologyException

setRelatedObjectsCached

protected final void setRelatedObjectsCached(RelationshipMetaInfo relationship)
Helper method to set the "objects cached" indicator for the specified relationship.

Parameters:
relationship -

relatedObjectsCached

protected final boolean relatedObjectsCached(RelationshipMetaInfo relationship)
Helper method to test the "objects cached" indicator for the specified relationship.

Parameters:
relationship -

getCachedRelatedObjects

protected final TopologyObject[] getCachedRelatedObjects(RelationshipMetaInfo relationship)
Helper methid to retreive the cached related TopologyObjects for the specified relationship.

Parameters:
relationship -
Returns:
the related TopologyObjects

setDisplayName

protected final void setDisplayName(java.lang.String displayName)
Helper method to reset the display name for the object. This is helpful when duplicate display names are detected.

Parameters:
displayName -

getInternalType

protected final TopologyObjectType getInternalType()
Helper method that returns the TopologyObjectType instance associated with this TopologyObject.



© Copyright 2006 IBM Corp. 2006 All Rights Reserved