com.oakgrovesystems.reactor.client
Class ClientLabelPathToIdMapperAndCreator

java.lang.Object
  |
  +--com.oakgrovesystems.reactor.client.ClientLabelPathToIdMapper
        |
        +--com.oakgrovesystems.reactor.client.ClientLabelPathToIdMapperAndCreator
All Implemented Interfaces:
LabelPathToIdMapper

public class ClientLabelPathToIdMapperAndCreator
extends ClientLabelPathToIdMapper

Maps LabelPaths to ReactorObjectIds. Uses a Map to dereference ReactorObjectIds as necessary to do the mapping. This class was written with the assumption that the Map contains properly initialized ProcessMediation objects. For example, an Operand's getProcess() method should not return the id of a Status. However, this precondition is not enforced and errors that result from this precondition not being met were not taken into consideration when writing the class. This class should be improved to either enforce this precondition or gracefully handle errors that result from it not being met.


Constructor Summary
ClientLabelPathToIdMapperAndCreator()
          Constructs a ClientLabelPathToIdMapperAndCreator that utilizes caching to improve performance.
ClientLabelPathToIdMapperAndCreator(java.util.Map objectMap)
          Constructs a mapper that uses objectMap to look up objects by their ids and utilizes caching to improve performance.
 
Method Summary
 java.util.Set getIdSet(com.oakgrovesystems.reactor.LabelPath pathToMap, java.lang.Class filterClass)
          Maps a LabelPath to a Set of ReactorObjectIds
 
Methods inherited from class com.oakgrovesystems.reactor.client.ClientLabelPathToIdMapper
addToCache, emptyCache, getId, getId, getId, getId, getIdForUniqueLabelPath, getIdForUniqueLabelPath, getIdForUniqueLabelPath, getIdForUniqueLabelPath, getIdSet, getIdSet, getIdSet, getIdSet, getIdSet, getObjectMap, setObjectMap, setUseCaching, usesCaching
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientLabelPathToIdMapperAndCreator

public ClientLabelPathToIdMapperAndCreator()
Constructs a ClientLabelPathToIdMapperAndCreator that utilizes caching to improve performance. The new mapper will not be useful until it is given a Map to use to look up ProcessMediationObjects by a call to setObjectMap().


ClientLabelPathToIdMapperAndCreator

public ClientLabelPathToIdMapperAndCreator(java.util.Map objectMap)
                                    throws ProcessMediationException
Constructs a mapper that uses objectMap to look up objects by their ids and utilizes caching to improve performance.

Parameters:
objectMap - the Map to use to look up objects by their ids
Throws:
ProcessMediationException - if the Map contains values other than ProcessMediationObjects or Maps an id to an object with a different id.
Method Detail

getIdSet

public java.util.Set getIdSet(com.oakgrovesystems.reactor.LabelPath pathToMap,
                              java.lang.Class filterClass)
Maps a LabelPath to a Set of ReactorObjectIds

Specified by:
getIdSet in interface LabelPathToIdMapper
Overrides:
getIdSet in class ClientLabelPathToIdMapper
Parameters:
pathToMap - The LabelPath that must resolve to an object for that object to be included in the returned Set.
filterClass - The Class with which an object must be assignment compatible in order to be included in the returned Set.
Returns:
The Set of ReactorObjectIds of all Objects o available to the mapper such that the LabelPath pathToMap will resolve to o and filterClass.isInstance(o)==true. Returns an empty set if no such objects are available to the mapper.


Copyright (c) 1999-2004 Oak Grove Systems. All Rights Reserved.