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

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

public abstract class TopologyProviderImpl
extends java.lang.Object
implements TopologyProvider

TopologyProviderImpl provides a default implementation of TopologyProvider. This implementation provides the foundation for a Provider and binds together a set of supporting classes for TopologyProvider and TopologyObject. In addition to implementing the public TopologyProvider methods, it also provides several helper methods for the custom provider to use.


Constructor Summary
protected TopologyProviderImpl(java.net.URL objectTypeMap)
          Constructor for building default Provider implementation.
 
Method Summary
protected  void addProviderExtension(TopologyProviderExtensionImpl extension)
           
protected  void addRelationship(RelationshipMetaInfo relationship)
          Helper method that registers the specified relationship for this provider.
protected  void cacheObjectProperties(TopologyObject object, PropertyList props)
          Deprecated. replaced by TopologyObjectImpl.cacheProperties(PropertyList)
protected  void cacheParentObject(TopologyObject childObject, TopologyObject parentObject)
          Deprecated. replaced by cacheRelatedObjects(TopologyObjectImpl, TopologyObjectImpl, RelationshipMetaInfo)
protected  void cacheRelatedObject(TopologyObject sourceObject, TopologyObject targetObject, RelationshipMetaInfo relationship)
          Deprecated. replaced by cacheRelatedObjects(TopologyObjectImpl, TopologyObjectImpl, RelationshipMetaInfo)
 void cacheRelatedObjects(TopologyObjectImpl sourceObject, TopologyObjectImpl targetObject, RelationshipMetaInfo relationship)
          Helper method that binds together related TopologyObject instances using the specified relationship.
protected  void cacheTopologyObject(TopologyObjectImpl to)
          Helper method that caches a TopologyObject to the TopologyProvider and TopologyObjectType caches if caching is enabled.
protected  TopologyObjectType createObjectType(java.lang.String type, java.lang.String superType, java.lang.String internalType)
          Helper method that registers the specified creates and registers a TopologyObjectType for this provider.
protected  TopologyObjectImpl createTopologyObject(java.lang.String internalId, java.lang.String displayName, TopologyObjectType objectType)
          Helper method that creates a TopologyObject instance and caches it in the TopologyProvider and TopologyObjectType caches (if caching is enabled).
protected  TopologyObject[] filterTopologyObjects(TopologyObject[] objects, java.lang.String objectKey)
          Helper method that filters the specified TopologyObject instances by the specified key.
protected  void finalizeRelationshipMap()
          Helper method that finalizes the relationships map.
 java.lang.String generateUniqueId()
          Helper method that generates returns a provider uniqueId.
 java.lang.String[] getApplicationTypes()
          Get all registered TopologyObject types that are of supertype TopologyObjectType.APPLICATION.
 java.lang.String[] getArtifactTypes()
          Get all registered TopologyObject types that are of supertype TopologyObjectType.ARTIFACT.
 java.lang.String[] getComputerSystemTypes()
          Get all registered TopologyObject types that are of supertype TopologyObjectType.COMPUTER_SYSTEM.
abstract  java.lang.String getId()
          Gets the id associated with the Provider.
 TopologyObjectImpl getObjectByInternalId(java.lang.String internalId)
          Helper method that returns the TopologyObjectImpl instance associated with the specified internalId.
 TopologyObjectImpl getObjectByUniqueId(java.lang.String uniqueId)
          Helper method that returns the TopologyObjectImpl instance associated with the specified uniqueId.
 TopologyObjectImpl[] getObjectsByTopologyObjectType(TopologyObjectType type)
          Helper method that returns the cached TopologyObjectImpl objects of the specified public type.
 TopologyObjectType getObjectTypeByInternalType(java.lang.String internalType)
          Helper method that returns the TopologyObjectType instance associated with the specified internal type.
 TopologyObjectType getObjectTypeByPublicType(java.lang.String publicType)
          Helper method that returns the TopologyObjectType instance associated with the specified well-known type.
 java.lang.String getObjectTypeNamespace()
          Helper method that returns the TopologyObjectType namespace as was defined by the Provider implementation.
 java.util.Collection getObjectTypes()
          Helper method that returns a collection of TopologyObjectType objects registered for this provider.
 TopologyObject getProviderTopologyObject()
          Get the root TopologyObject instance for the Provider.
 java.lang.String getProviderType()
          Get the TopologyProvider type.
 RelationshipMetaInfo getRelationshipByUniqueId(java.lang.String uniqueId)
          Helper method that returns the RelationshipMetaInfo instance associated with the specified uniqueId.
 RelationshipMetaInfo[] getRelationshipsMetaInfo(java.lang.String sourceRelationshipKey)
          Get all defined relationships that correspond to specified relationshipKey.
 java.lang.String[] getResourceTypes()
          Get all registered TopologyObject types that are of supertype TopologyObjectType.RESOURCE.
 java.lang.String[] getServerCollectionTypes()
          Get all registered TopologyObject types that are of supertype TopologyObjectType.SERVER_COLLECTION.
 java.lang.String[] getServerTypes()
          Get all registered TopologyObject types that are of supertype TopologyObjectType.SERVER.
 TopologyObject[] getTopologyObjects(java.lang.String objectKey)
          Get all TopologyObject instances that correspond to the given objectKey.
 java.lang.String[] getTopologyObjectTypes()
          Get all registered TopologyObject types.
abstract  void initialize(ProviderInfo info)
          Initializes the provider instance using the specified ProviderInfo.
 boolean isCacheObjects()
          Helper method to test if TopologyObject caching is enabled for this Provider.
 boolean isCacheProperties()
          Helper method to test if Property caching is enabled for this Provider.
 boolean isObjectsCached(TopologyObjectType type)
          Helper method to test if TopologyObject instances of the specified type have been cached.
 void logError(java.lang.String errMsg)
          Logs provider initialization errors to the "errorMessages" property of the provider TopologyObject.
 void registerTopologyService(TopologyService service)
          Registers this provider instance with the specified service instance.
 boolean setObjectCachingEnabled(boolean enable)
          Controls provider TopologyObject caching.
 void setObjectsCached(TopologyObjectType type)
          Helper method that sets the "objects cached" indicator for TopologyObjects of the specified type.
protected  void setObjectTypeNamespace(java.lang.String objectTypeNamespace)
          Helper method that sets the object type namespace for the provider.
 boolean setPropertyCachingEnabled(boolean enable)
          Controls provider Property caching.
 void shutdown()
          To override this method, super.shutdown() must be called from the overridden method.
 void unregisterTopologyService(TopologyService service)
          Unregisters this provider instance with the specified service instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopologyProviderImpl

protected TopologyProviderImpl(java.net.URL objectTypeMap)
                        throws TopologyException
Constructor for building default Provider implementation. Provider implementation should not override this constructor, but should call it from it's mandatory default constructor.

Parameters:
objectTypeMap - points to the XML file that defines the object type map for this provider.
Throws:
TopologyException
Method Detail

getId

public abstract java.lang.String getId()
Description copied from interface: TopologyProvider
Gets the id associated with the Provider.

Specified by:
getId in interface TopologyProvider
Returns:
the provider Id

initialize

public abstract void initialize(ProviderInfo info)
                         throws TopologyException
Description copied from interface: TopologyProvider
Initializes the provider instance using the specified ProviderInfo.

Specified by:
initialize in interface TopologyProvider
Parameters:
info - a ProviderInfo object that specifies the initialization parameters.
Throws:
TopologyException

getProviderTopologyObject

public TopologyObject getProviderTopologyObject()
                                         throws TopologyException
Description copied from interface: TopologyProvider
Get the root TopologyObject instance for the Provider.

Specified by:
getProviderTopologyObject in interface TopologyProvider
Returns:
the provider's TopologyObject instance
Throws:
TopologyException

getTopologyObjectTypes

public java.lang.String[] getTopologyObjectTypes()
Description copied from interface: TopologyProvider
Get all registered TopologyObject types.

Specified by:
getTopologyObjectTypes in interface TopologyProvider
Returns:
an array of object types

getTopologyObjects

public TopologyObject[] getTopologyObjects(java.lang.String objectKey)
                                    throws TopologyException
Description copied from interface: TopologyProvider
Get all TopologyObject instances that correspond to the given objectKey.

Specified by:
getTopologyObjects in interface TopologyProvider
Parameters:
objectKey - in the form of "objectType::objectName/objectType::objectName/..."
Returns:
an array of TopologyObject(s)
Throws:
TopologyException

getProviderType

public final java.lang.String getProviderType()
Description copied from interface: TopologyProvider
Get the TopologyProvider type.

Specified by:
getProviderType in interface TopologyProvider
Returns:
the provider's type

getServerTypes

public final java.lang.String[] getServerTypes()
Description copied from interface: TopologyProvider
Get all registered TopologyObject types that are of supertype TopologyObjectType.SERVER.

Specified by:
getServerTypes in interface TopologyProvider
Returns:
an array of object types

getComputerSystemTypes

public final java.lang.String[] getComputerSystemTypes()
Description copied from interface: TopologyProvider
Get all registered TopologyObject types that are of supertype TopologyObjectType.COMPUTER_SYSTEM.

Specified by:
getComputerSystemTypes in interface TopologyProvider
Returns:
an array of object types

getArtifactTypes

public final java.lang.String[] getArtifactTypes()
Description copied from interface: TopologyProvider
Get all registered TopologyObject types that are of supertype TopologyObjectType.ARTIFACT.

Specified by:
getArtifactTypes in interface TopologyProvider
Returns:
an array of object types

getServerCollectionTypes

public final java.lang.String[] getServerCollectionTypes()
Description copied from interface: TopologyProvider
Get all registered TopologyObject types that are of supertype TopologyObjectType.SERVER_COLLECTION.

Specified by:
getServerCollectionTypes in interface TopologyProvider
Returns:
an array of object types

getResourceTypes

public final java.lang.String[] getResourceTypes()
Description copied from interface: TopologyProvider
Get all registered TopologyObject types that are of supertype TopologyObjectType.RESOURCE.

Specified by:
getResourceTypes in interface TopologyProvider
Returns:
an array of object types

getApplicationTypes

public final java.lang.String[] getApplicationTypes()
Description copied from interface: TopologyProvider
Get all registered TopologyObject types that are of supertype TopologyObjectType.APPLICATION.

Specified by:
getApplicationTypes in interface TopologyProvider
Returns:
an array of object types

getRelationshipsMetaInfo

public final RelationshipMetaInfo[] getRelationshipsMetaInfo(java.lang.String sourceRelationshipKey)
                                                      throws TopologyException
Description copied from interface: TopologyProvider
Get all defined relationships that correspond to specified relationshipKey.

Specified by:
getRelationshipsMetaInfo in interface TopologyProvider
Parameters:
sourceRelationshipKey - 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:
an array of RelationshipMetaInfo objects
Throws:
TopologyException

registerTopologyService

public final void registerTopologyService(TopologyService service)
Description copied from interface: TopologyProvider
Registers this provider instance with the specified service instance.

Specified by:
registerTopologyService in interface TopologyProvider

unregisterTopologyService

public final void unregisterTopologyService(TopologyService service)
Description copied from interface: TopologyProvider
Unregisters this provider instance with the specified service instance.

Specified by:
unregisterTopologyService in interface TopologyProvider

shutdown

public void shutdown()
              throws TopologyException
To override this method, super.shutdown() must be called from the overridden method.

Specified by:
shutdown in interface TopologyProvider
Throws:
TopologyException
See Also:
TopologyProvider.shutdown()

getObjectTypeByPublicType

public final TopologyObjectType getObjectTypeByPublicType(java.lang.String publicType)
Helper method that returns the TopologyObjectType instance associated with the specified well-known type.

Parameters:
publicType -
Returns:
TopolgyObjectType instance

getObjectTypeByInternalType

public final TopologyObjectType getObjectTypeByInternalType(java.lang.String internalType)
Helper method that returns the TopologyObjectType instance associated with the specified internal type.

Parameters:
internalType -
Returns:
TopolgyObjectType instance

getObjectsByTopologyObjectType

public final TopologyObjectImpl[] getObjectsByTopologyObjectType(TopologyObjectType type)
Helper method that returns the cached TopologyObjectImpl objects of the specified public type.

Parameters:
type -
Returns:
an array of TopologyObjectImpl instances

getObjectByInternalId

public final TopologyObjectImpl getObjectByInternalId(java.lang.String internalId)
Helper method that returns the TopologyObjectImpl instance associated with the specified internalId.

Parameters:
internalId -
Returns:
The TopologyObject instance associated with the specified uniqueId

getObjectByUniqueId

public final TopologyObjectImpl getObjectByUniqueId(java.lang.String uniqueId)
Helper method that returns the TopologyObjectImpl instance associated with the specified uniqueId.

Parameters:
uniqueId -
Returns:
The TopologyObject instance associated with the specified uniqueId

getRelationshipByUniqueId

public final RelationshipMetaInfo getRelationshipByUniqueId(java.lang.String uniqueId)
Helper method that returns the RelationshipMetaInfo instance associated with the specified uniqueId.

Parameters:
uniqueId -
Returns:
the RelationshipMetaInfo instance

generateUniqueId

public final java.lang.String generateUniqueId()
Helper method that generates returns a provider uniqueId.

Returns:
A provider unique id

getObjectTypes

public final java.util.Collection getObjectTypes()
Helper method that returns a collection of TopologyObjectType objects registered for this provider.

Returns:
a Collection

getObjectTypeNamespace

public final java.lang.String getObjectTypeNamespace()
Helper method that returns the TopologyObjectType namespace as was defined by the Provider implementation.

Returns:
the namespace

setObjectsCached

public final void setObjectsCached(TopologyObjectType type)
Helper method that sets the "objects cached" indicator for TopologyObjects of the specified type. Used when a Provider implementation has a backend implementation where it queries for configuration artifacts as needed.

Parameters:
type -

isObjectsCached

public final boolean isObjectsCached(TopologyObjectType type)
Helper method to test if TopologyObject instances of the specified type have been cached.

Parameters:
type -
Returns:
true if TopologyObjects already cached

isCacheObjects

public final boolean isCacheObjects()
Helper method to test if TopologyObject caching is enabled for this Provider.

Returns:
true if enabled

isCacheProperties

public final boolean isCacheProperties()
Helper method to test if Property caching is enabled for this Provider.

Returns:
true if enabled

cacheRelatedObjects

public final void cacheRelatedObjects(TopologyObjectImpl sourceObject,
                                      TopologyObjectImpl targetObject,
                                      RelationshipMetaInfo relationship)
                               throws TopologyException
Helper method that binds together related TopologyObject instances using the specified relationship. This method takes care of all the required bookkeeping for both TopologyObject instances, so it is only neccessary to call this method once for each relationship between an pair of TopologyObject instances.

Parameters:
sourceObject - specifies source object. For composition relationships, the source object must specify the parent object.
targetObject - specifies target object. For composition relationships, the target object must specify the child object.
relationship -
Throws:
TopologyException

logError

public final void logError(java.lang.String errMsg)
Logs provider initialization errors to the "errorMessages" property of the provider TopologyObject.

Parameters:
errMsg - the error to log

filterTopologyObjects

protected final TopologyObject[] filterTopologyObjects(TopologyObject[] objects,
                                                       java.lang.String objectKey)
                                                throws TopologyException
Helper method that filters the specified TopologyObject instances by the specified key.

Parameters:
objects - - the TopologyObjects to be filtered
objectKey - - objectKey in the form of "objectType::objectName/objectType::objectName/..."
Returns:
the filtered TopologyObjects
Throws:
TopologyException

createTopologyObject

protected final TopologyObjectImpl createTopologyObject(java.lang.String internalId,
                                                        java.lang.String displayName,
                                                        TopologyObjectType objectType)
                                                 throws TopologyException
Helper method that creates a TopologyObject instance and caches it in the TopologyProvider and TopologyObjectType caches (if caching is enabled). Use this method when a default implementation of a TopologyObject is sufficient. If the provider implementation dictates that provider-specific TopologyObjects be created, then the preferred method is to create unique objects extending the TopologyObjectImpl class, and calling TopologyProviderImpl.cacheTopologyObject() in the objects' constructor.

Parameters:
internalId -
displayName -
objectType -
Returns:
a new TopologyObjectImpl instance
Throws:
TopologyException

cacheTopologyObject

protected final void cacheTopologyObject(TopologyObjectImpl to)
                                  throws TopologyException
Helper method that caches a TopologyObject to the TopologyProvider and TopologyObjectType caches if caching is enabled. It is not required to call this method if if the TopologyObject was created with TopologyProviderImpl.createTopologyObject().

Parameters:
to -
Throws:
TopologyException

cacheRelatedObject

protected void cacheRelatedObject(TopologyObject sourceObject,
                                  TopologyObject targetObject,
                                  RelationshipMetaInfo relationship)
                           throws TopologyException
Deprecated. replaced by cacheRelatedObjects(TopologyObjectImpl, TopologyObjectImpl, RelationshipMetaInfo)

Caches a related TopologyObject reference using the specified relationship

Parameters:
sourceObject -
targetObject -
relationship -
Throws:
TopologyException

cacheParentObject

protected void cacheParentObject(TopologyObject childObject,
                                 TopologyObject parentObject)
Deprecated. replaced by cacheRelatedObjects(TopologyObjectImpl, TopologyObjectImpl, RelationshipMetaInfo)

Caches the parent TopologyObject reference for the specified child

Parameters:
childObject -
parentObject -

cacheObjectProperties

protected void cacheObjectProperties(TopologyObject object,
                                     PropertyList props)
                              throws TopologyException
Deprecated. replaced by TopologyObjectImpl.cacheProperties(PropertyList)

Sets properties for the referenced TopologyObject (Note: soon to be deprecated).

Parameters:
object -
props -
Throws:
TopologyException

addRelationship

protected final void addRelationship(RelationshipMetaInfo relationship)
Helper method that registers the specified relationship for this provider. Use this method if the Provider implementation needs to dynamically create RelationshipMetaInfo objects.

Parameters:
relationship -

createObjectType

protected final TopologyObjectType createObjectType(java.lang.String type,
                                                    java.lang.String superType,
                                                    java.lang.String internalType)
Helper method that registers the specified creates and registers a TopologyObjectType for this provider. Use this method if the Provider implementation needs to dynamically create TopologyObjectType objects.

Parameters:
type -
superType -
internalType -
Returns:
the new TopologyObjectType instance

addProviderExtension

protected void addProviderExtension(TopologyProviderExtensionImpl extension)
                             throws TopologyException
Parameters:
extension -
Throws:
TopologyException

finalizeRelationshipMap

protected final void finalizeRelationshipMap()
                                      throws TopologyException
Helper method that finalizes the relationships map. This method must be called if the Provider implementation dynamically creates ToologyObjectType or RelationshipMetaInfo objects, i.e. outside of the TopologyObjectTypeMap.xml file.

Throws:
TopologyException

setObjectTypeNamespace

protected final void setObjectTypeNamespace(java.lang.String objectTypeNamespace)
Helper method that sets the object type namespace for the provider.

Parameters:
objectTypeNamespace - the objectTypeNamespace to set

setObjectCachingEnabled

public final boolean setObjectCachingEnabled(boolean enable)
Description copied from interface: TopologyProvider
Controls provider TopologyObject caching. Used to temporarily disable provider TopologyObject caching if the provider supports it. Method returns the current caching value so that it may be restored to the initial value.

Specified by:
setObjectCachingEnabled in interface TopologyProvider
Returns:
the previous value

setPropertyCachingEnabled

public final boolean setPropertyCachingEnabled(boolean enable)
Description copied from interface: TopologyProvider
Controls provider Property caching. Used to temporarily disable provider Property caching if the provider supports it. Method returns the current caching value so that it may be restored to the initial value.

Specified by:
setPropertyCachingEnabled in interface TopologyProvider
Returns:
the previous value


© Copyright 2006 IBM Corp. 2006 All Rights Reserved