|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for objects which serve has handles to actual data objects.
The resolve pattern is based on the IAdaptable pattern used extensivly by the Eclipse framework. Also known as the Extensible Interface pattern, objects implementing the IAdaptable interface morph or adapt themselves into objects implementing a different interface.
The resolve pattern is slightly different in that morphing or adapting (ie. resolving) into a different object involves a blocking call in which I/O is being performed, possibly with the local disk, or with a remote service.
The following code illustrates the use of the resolve pattern:
Resolve resolve = ....
ProgressListener listener = ....
FeatureSource featureSource = resolve.resolve(FeatureSource.class,listener);
if (featureSource != null) {
//do something
}
As a convenience, the canResolve(Class)
method is used to
determine if a particular type of object is supported, but not to perform
the resolve. This method can be useful in situations where it is not
desirable to block.
An implementation of resolve supports the notion of resolving into a parent, or into a list of children, called members. Like any other resolve, these are blocking operations. Parents and members must also implement the Resolve interface.
Nested Class Summary | |
static class |
Resolve.Status
Enumeration class for representing the status or state of a Resolve. |
Method Summary | |
void |
addListener(ResolveChangeListener listener)
Adds a listener to the Resolve. |
boolean |
canResolve(java.lang.Class adaptee)
Non blocking method which is used to determine if a resolve into an instance of a particular class is supported. |
void |
fire(ResolveChangeEvent event)
Fires a change event against the Resolve. |
java.net.URI |
getIdentifier()
Returns a URI which uniqley identifies the Resolve. |
java.lang.Throwable |
getMessage()
In the event that an error occurs during a resolve, that error can be reported back with this method. |
Resolve.Status |
getStatus()
Status of the resolve. |
java.util.List |
members(ProgressListener monitor)
Blocking method which resolves this instance into its members (children). |
Resolve |
parent(ProgressListener monitor)
Blocking method which resolves this instance into its parent. |
void |
removeListener(ResolveChangeListener listener)
Removes a listener from the Resolve. |
java.lang.Object |
resolve(java.lang.Class adaptee,
ProgressListener monitor)
Blocking method which is used to resolve into an instance of a particular class. |
Method Detail |
public java.lang.Object resolve(java.lang.Class adaptee, ProgressListener monitor) throws java.io.IOException
Required adaptions will be listed in Abstract Classes that implement this interface.
adaptee
- Class of object to resolve into.monitor
- Progress monitor used to report status while blocking.
May be null.
java.io.IOException
- in the result of an I/O error.public boolean canResolve(java.lang.Class adaptee)
adaptee
- Class of object to resolve into.
IResolve#resolve(Class,ProgressListener)
public Resolve parent(ProgressListener monitor) throws java.io.IOException
monitor
- Progress monitor used to report status while blocking.
May be null.
java.io.IOException
- in the result of an I/O error.public java.util.List members(ProgressListener monitor) throws java.io.IOException
monitor
- Progress monitor used to report status while blocking.
May be null.
java.io.IOException
- in the result of an I/O error.public Resolve.Status getStatus()
Resolve.Status.BROKEN
,Resolve.Status.CONNECTED
, or
Resolve.Status.NOTCONNECTED
.public java.lang.Throwable getMessage()
getStatus()
returns Resolve.Status.BROKEN
, otherwise it
return null.
Resolve.Status
public java.net.URI getIdentifier()
public void addListener(ResolveChangeListener listener) throws java.lang.UnsupportedOperationException
listener
- The observer.
java.lang.UnsupportedOperationException
- When event notification is not
supported.public void removeListener(ResolveChangeListener listener)
listener
- The observer.public void fire(ResolveChangeEvent event)
event
- The event describing the change.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |