| net.refractions.udig.catalog.IResolve
All known Subclasses: net.refractions.udig.catalog.IService, net.refractions.udig.catalog.IGeoResource, net.refractions.udig.catalog.ICatalog,
IResolve | public interface IResolve (Code) | | Blocking IAdaptable, used to contact external services.
author: David Zwiers, Refractions Research since: 0.7.0 See Also: IAdaptable |
Inner Class :public enum Status | |
Method Summary | |
public boolean | canResolve(Class<T> adaptee) Required adaptions will be listed in Abstract Classes under the resolve() method. | public void | dispose(IProgressMonitor monitor) Clean up after aquired resources - the handle will not function
after being disposed. | abstract public URL | getIdentifier() A unique resource identifier ... | public Throwable | getMessage() Text description for this serice status. | public Status | getStatus() Status information for this service. | public List<? extends IResolve> | members(IProgressMonitor monitor) Contents of this handle, Collections.EMPTY_LIST iff this is a leaf.
Parameters: monitor - Monitor used to provide feedback during member lookup List, possibly empty, of members. | public IResolve | parent(IProgressMonitor monitor) The parent of this handle, may be null if parent unknown. | public T | resolve(Class<T> adaptee, IProgressMonitor monitor) Will attempt to morph into the adaptee, and return that object.
Required adaptions will be listed in Abstract Classes,
along with the method they will call. |
canResolve | public boolean canResolve(Class<T> adaptee)(Code) | | Required adaptions will be listed in Abstract Classes under the resolve() method.
Restrictions on implementations:
- May not Block
- *MUST NOT* throw any exceptions (be sure to check for null!)
- Must delegate to ResolveManger - to recognize adapters contributed by others
When defining a new AbstractClass you are also asked to please list the
required adaptations in your javadocs.
The following code example shows intended practice:
public boolean canResolve( Class adaptee ){
return adaptee != null && (
adaptee.isAssignableFrom(TYPE.class) ||
CatalogPlugin.getDefault().getResolveManager().canResolve(this, adaptee)
);
}
See Also: IResolve#resolve(Class, IProgressMonitor); true if a resolution for adaptee is avaialble |
dispose | public void dispose(IProgressMonitor monitor)(Code) | | Clean up after aquired resources - the handle will not function
after being disposed.
Parameters: monitor - |
getIdentifier | abstract public URL getIdentifier()(Code) | | A unique resource identifier ... this should be unique for each service.
Must Not Block.
ID for this IResolve, should not be null. |
getMessage | public Throwable getMessage()(Code) | | Text description for this serice status.
For a BROKEN status this will contain the error message, null will be returned if there is
nothing interesting to report.
Not the Exception is ecpected to be in humar readable, terms.
Text describing service status |
getStatus | public Status getStatus()(Code) | | Status information for this service.
In the future this may be extended into a bit mask of connection status.
Status of the resource |
members | public List<? extends IResolve> members(IProgressMonitor monitor) throws IOException(Code) | | Contents of this handle, Collections.EMPTY_LIST iff this is a leaf.
Parameters: monitor - Monitor used to provide feedback during member lookup List, possibly empty, of members. Will be EMPTY_LIST if this is a leaf. throws: IOException - in the event of a technical problem |
parent | public IResolve parent(IProgressMonitor monitor) throws IOException(Code) | | The parent of this handle, may be null if parent unknown.
Parameters: monitor - used to provide feedback during parent lookup Parent IResolve, null if unknown throws: IOException - in the event of a technical problem |
resolve | public T resolve(Class<T> adaptee, IProgressMonitor monitor) throws IOException(Code) | | Will attempt to morph into the adaptee, and return that object.
Required adaptions will be listed in Abstract Classes,
along with the method they will call. IResolve implementations
are encouraged to follow this practice - documenting what
adapters are required.
The extensible interface pattern also demands that the set of
adapters be open-ended; we have provided an extention point
to let others teach the system new tricks at configuration time.
Here is a code example that every implementation needs to follow
in order to make use of the IResolveManager:
- TYPE - an example required class (like URL.class)
- METHOD - an example method that will produce the adapter
public T resolve( Class adaptee, IProgressMonitor monitor ) throws IOException {
if (monitor == null)
monitor = new NullProgressMonitor();
if (adaptee == null)
throw new NullPointerException("No adaptor specified" );
if (adaptee.isAssignableFrom(TYPE.class)) {
return adaptee.cast(METHOD(monitor));
}
...
IResolveManager rm = CatalogPlugin.getDefault().getResolveManager();
if (rm.canResolve(this, adaptee)) {
return rm.resolve(this, adaptee, monitor);
}
return null; // could not find adapter
}
May Block.
Parameters: adaptee - Parameters: monitor - May Be Null Instance of type adaptee, or null if adaptee is unsuported. throws: IOException - if result was unavailable due to a technical problem |
|
|