Interface COM.ibm.jaws.mofw.KeyedCollection
All Packages Class Hierarchy This Package Previous Next Index
Interface COM.ibm.jaws.mofw.KeyedCollection
- public interface KeyedCollection
- extends Object
- extends QueryableCollection
The KeyedCollection is the highest level collection in the class
tree that can return a single object via a unique name called a
keyPath.
Select a KeyedCollection in your application object's methods when
there is no need to specify how the entries in a collection are
created and/or bound. Otherwise, select one of its subtypes
(BaseCollection or NamedCollection).
-
dispatch(String, CommandOn)
- Use this method to resolve a target by a key and execute a command
against it (with parameters already set).
-
resolve(String)
- Use this method to locate an object by its keyPath.
resolve
public abstract Object resolve(String keyPath) throws InvalidKeyError
- Use this method to locate an object by its keyPath.
There are 2 cases for each component in the keyPath, depending
on how the key component was determined:
- If the key component was determined by a
BaseCollection.createFromXXX(), then the key component is
an Identifier key.
- If the key component was determined by a
NamedCollection.bind() or rebind(), then the key component is
a name key.
(name or identifier).
The user of resolve() does not have to be aware of this difference.
The key must be relative to the KC. The rules for implementing
resolve() are (eg, keyPath is "abc/xyz"):
- If the object with the first key component (eg, "abc") is
not found in this KeyedCollection, return a null.
- If the object with the first key component (eg, "abc") is
found in this KeyedCollection and there is no more in the
keyPath (eg, "xyz" is more), return the found object.
- If the object with the first key component (eg, "abc") is
found in this KeyedCollection and there is more keyPath
(eg, "xyz") and the found object is not a KeyedCollection,
return InvalidKeyError.
- If the object with the first key component (eg, "abc") is
found in this KeyedCollection and there is more keyPath
(eg, "xyz") and the found object is a KeyedCollection,
return foundObject.resolve(restOfKeyPath, interfaceName)
- eg, foundObject.resolve("xyz", interfaceName).
- Parameters:
- keyPath - a
String
that indicates the object to be
retrieved.
- Returns:
- the
Object
identified by the key.
- Throws: InvalidKeyError
- is thrown when the key is not valid.
dispatch
public abstract CommandOn dispatch(String key,
CommandOn command) throws InvalidKeyError, InvalidTargetError, CommandOnNotReadyError
- Use this method to resolve a target by a key and execute a command
against it (with parameters already set).
The same rules apply to the resolve as for the resolve() method.
The command will end up in the "done" or "error" states where
the result can be retrieved and possibly undone.
- Parameters:
- key - a
string
representing the key of
the object to be used as the target in the command.
- command - a
CommandOn
object that is
ready to run (i.e. has parameters set) on the target represented
by the key.
- Returns:
- a
CommandOn
object in the done/error state.
- Throws: InvalidKeyError
- is thrown when
the key format is bad.
- Throws: InvalidTargetError
- is thrown when the key resolves
to an object that cannot be the CommandOn target.
- Throws: CommandOnNotReadyError
- is thrown when the
CommandOn object needs parameters set.
All Packages Class Hierarchy This Package Previous Next Index