001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
005: * (C) 2005, Refractions Research Inc.
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation;
010: * version 2.1 of the License.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: */
017: package org.geotools.catalog;
018:
019: import java.io.IOException;
020: import org.geotools.util.ProgressListener;
021:
022: /**
023: * Represents a handle to a spatial resource.
024: *
025: * <p>
026: * The resource is not guaranteed to exist, nor do we guarantee that we can
027: * connect with the resource. Some/All potions of this handle may be loaded as
028: * required. This resource handle may also be the result a metadata service
029: * query.
030: * </p>
031: *
032: * @author David Zwiers, Refractions Research
033: * @author Justin Deoliveira, The Open Planning Project
034: *
035: * @since 0.6
036: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/api/src/main/java/org/geotools/catalog/GeoResource.java $
037: */
038: public interface GeoResource extends Resolve {
039: /**
040: * Blocking operation to resolve into the adaptee, if available.
041: *
042: * <p>
043: * Required adaptions:
044: *
045: * <ul>
046: * <li>
047: * IGeoResourceInfo.class
048: * </li>
049: * <li>
050: * IService.class
051: * </li>
052: * </ul>
053: * </p>
054: *
055: * <p>
056: * Example (no casting required):
057: * <pre><code>
058: * IGeoResourceInfo info = resovle(IGeoResourceInfo.class);
059: * </code></pre>
060: * </p>
061: *
062: * <p>
063: * Recommendated adaptions:
064: *
065: * <ul>
066: * <li>
067: * ImageDescriptor.class (for icon provided by external service)
068: * </li>
069: * </ul>
070: * </p>
071: *
072: * @param adaptee
073: * @param monitor
074: *
075: * @return instance of adaptee, or null if unavailable (IGeoResourceInfo
076: * and IService must be supported)
077: *
078: * @throws IOException DOCUMENT ME!
079: *
080: * @see GeoResourceInfo
081: * @see IService
082: * @see IResolve#resolve(Class, ProgressListener)
083: */
084: Object resolve(Class adaptee, ProgressListener monitor)
085: throws IOException;
086:
087: /**
088: * Blocking operation to describe this service.
089: *
090: * <p>
091: * As an example this method is used by LabelDecorators to aquire title,
092: * and icon.
093: * </p>
094: *
095: * @param monitor DOCUMENT ME!
096: *
097: * @return IGeoResourceInfo resolve(IGeoResourceInfo.class,ProgressListener
098: * monitor);
099: *
100: * @throws IOException DOCUMENT ME!
101: *
102: * @see AbstractGeoResource#resolve(Class, ProgressListener)
103: */
104: GeoResourceInfo getInfo(ProgressListener monitor)
105: throws IOException;
106: }
|