Overview of the Base Classes
The Managed Object Framework Toolkit (COM.ibm.jaws.motk) provides a
number of classes which are intended to provide a base for
implementing the various interfaces of the Managed Object Framework
(COM.ibm.jaws.mofw). This document summarizes these classes.
Summary of Base Classes
BaseAO
Implements: Lifecycle, Manaageable,
IdentityDelegator, and Dependent. Objects that implements these
interfaces (or a subset of them), but not the Managed interface are
usually call application objects or AOs. Objects that implements the
application objects interfaces (or a subset of them) as well as
Managed are usually called MOs.
Field Summary
- protected transient Object self
Set by IdentityDelegator.setSelf(), but initialized to
"this". The value of this field is to used whenever this object
needs to pass itself out thru an interface either as a parameter
or a return value.
- protected transient KeyedCollection dependentContext
Set by Dependent.setDependentContext, initialized to null.
This is the dependent context for this object. BaseAO does not
look for anything in the dependent context.
Method Summary
- Lifecycle
- void release() - Implemented
This method does nothing, override it if you have
self-managed resources to manage.
- void remove() - Implemented
This method just calls release. This should be find for any
AO, but must be overridden by MOs.
- Manageable
- void externalizeToStream(OutputEDStream out) - Abstract
- void internalizeFromStream(InputEDStream in) - Abstract
- IdentityDelegator
- void setSelf(Object self) - Implemented
Just saves the argument in a protected transient field
called "self". This should be fine for all objects unless they
don't need a self-pointer.
- Dependent
- void setDependentContext(KeyedCollection context) - Implemented
Saves the argument in a protected transient field
called "dependentContext". It may be necessary to
override this method (while chaining to super) to extract
information from the dependentContext.
BaseMO
Implements: Support for Managed
Unlike the other Base classes you will not be able to derive
from this class as MOs must be derived from their AOs. Therefore
this class provides static helper methods for implementing an MO.
It also provides (as comments) sample code to include in your MO
when using this class.
Sample Field Summary (these would be in your MO)
- protected transient BaseCollection <mybc>Base
This is the base collection that this MO is contained
in. This value is set by a BC specifice method such as
<mybc>SetBase.
- protected transient String <mybc>Key
This is the key for this object. This can be set in a
number of ways including a BC specific method such as
<mybc>SetKey.
Sample Method Summary (these would be in your MO)
- String getIdentifier(BaseCollection relativeTo)
Uses the key and base fields described above.
- Overrides: void setDependentContext(KeyedCollection dependentContext)
Just forwards the call to its parent.
- void <mybc>SetBase(BaseCollection base)
Sets <mybc>Base
- void <mybc>SetKey(String key)
Sets <mybc>Key
Method Summary
- static String getIdentifier(BaseCollection relativeTo, String key,
BaseCollection base) - Implemented
Uses the key and base fields described above.
BaseQC
Implements: QueryableCollection
Method Summery
- Iterator evaluate(String query) - Abstract
- Iterator dispatchAll(String query, CommandOn command) - Implemented
Uses evaluate to get a Iterator that must be an Iterator over
the type of objects required by the command. Uses clone to
make copies of the command and then applies each copy to one of
the objects returned from the query. Returns an Iterator over the
command copies after they have be applied in the same order as the
objects returned in the query.
BaseKC
Implements: QueryableKeyedCollection
Field Summery
- protected transient KeyedCollection rootKC
This is the value used by this KC when given an absolute
key path to resolve. This value is taken from the dependentContext
under the key "MOFW::rootBase".
Method Summery
- Object resolve(String key, String interfaceName) - Abstract
- void dispatch(String key, CommandOn command) - Implemented
Uses resolve to get the target object and then applies the
command to it. Returns the CommandOn object that was passed
in.
- Overrides: void setDependentContext(KeyedCollection
dependentContext) - Implemented
Override to get "MOFW::rootBase" from the dependentContext.
BaseBC
Implements: QueryableBaseCollection
Method Summery
- Managed createManaged(Manageable object,
String interfaceName) - Implemented
Uses externalizeToStream to produce an InputEDStream and then
calls createManaged(InputEDStream, String). Externalization is
done to a stream with this BC as its default relativeTo value.
- Managed createManaged(InputEDStream initialData,
String interfaceName) - Abstract
BaseRC
Implements: ReferenceCollection
Method Summery
- boolean insertElement(Object element) - Abstract
- void removeElement(Object element) - Abstract
BaseNC
Implements: NamedCollection
Method Summery
- boolean bind(String name, Object target) - Abstract
- void unbind(String name) - Abstract
- void rebind(String name, Object object) - Implemented
Does an unbind followed by a bind.
Quick Summary of Base Classes
- BaseAO
Implements: Lifecycle, Manaageable,
IdentityDelegator, and Dependent
Fields:
- BaseAO self
- KeyedCollection dependentContext
Methods for Interface: Lifecycle
- void release() - Implemented
- void remove() - Implemented
Methods for Interface: Manaageable
- void externalizeToStream(OutputEDStream out) - Abstract
- void internalizeFromStream(InputEDStream in) - Abstract
Methods for Interface: IdentityDelegator
- void setSelf(Object self) - Implemented
Methods for Interface: Dependent
- void setDependentContext(KeyedCollection context) - Implemented
- BaseMO
Implements: Support for Managed
Sample Fields:
- BaseCollection base
- BaseCollection relativeTo
- String key
Sample Methods:
- String getIdentifier(BaseCollection relativeTo)
- Overrides: void setDependentContext(KeyedCollection dependentContext)
Class Methods:
- String getIdentifier(BaseCollection relativeTo, String key,
BaseCollection base) - Implemented
- BaseCollection getBase(KeyedCollection dependentContext) -
Implemented
- BaseCollection getRelativeTo(KeyedCollection dependentContext) -
Implemented
- BaseQC
Implements: QueryableCollection
Methods:
- Iterator evaluate(String query) - Abstract
- Iterator dispatchAll(String query, CommandOn command) - Implemented
- BaseKC
Implements: QueryableKeyedCollection
Fields:
Methods:
- Object resolve(String key, String interfaceName) - Abstract
- void dispatch(String key, CommandOn command) - Implemented
- Overrides: void setDependentContext(KeyedCollection
dependentContext) - Implemented
- BaseBC
Implements: QueryableBaseCollection
Methods:
- Managed createManaged(Manageable object,
String interfaceName) - Implemented
- Managed createManaged(InputEDStream initialData,
String interfaceName) - Abstract
- BaseRC
Implements: ReferenceCollection
Methods:
- boolean insertElement(Object element) - Abstract
- void removeElement(Object element) - Abstract
- BaseNC
Implements: NamedCollection
Methods:
- boolean bind(String name, Object target) - Abstract
- void unbind(String name) - Abstract
- void rebind(String name, Object object) - Implemented