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 java.net.URI;
021: import java.util.List;
022: import com.vividsolutions.jts.geom.Envelope;
023: import org.geotools.util.ProgressListener;
024:
025: /**
026: * Extension of Resolve which represents a local catalog or web registry
027: * service.
028: * <p>
029: * Conceptually provides a searchable Catalog of "Spatial Data Sources".
030: * Metadata search is abitrary.
031: * </p>
032: *
033: * @author David Zwiers, Refractions Research
034: * @author Justin Deoliveira, The Open Planning Project
035: * @since 0.7.0
036: *
037: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/api/src/main/java/org/geotools/catalog/Catalog.java $
038: */
039: public interface Catalog extends Resolve {
040: /**
041: * Will attempt to morph into the adaptee, and return that object. Required adaptions:
042: * <ul>
043: * <li>ICatalogInfo.class
044: * <li>List.class <IService>
045: * </ul>
046: * May Block.
047: *
048: * @param adaptee
049: * @param monitor May Be Null
050: * @see CatalogInfo
051: * @see IService
052: */
053: Object resolve(Class adaptee, ProgressListener monitor)
054: throws IOException;
055:
056: /**
057: * Adds the specified entry to this catalog. In some cases the catalog will be backed onto a
058: * server, which may not allow for additions.
059: * <p>
060: * An IService may belong to more than one Catalog.
061: * </p>
062: *
063: * @param service the Service to add to the catalog
064: * @throws UnsupportedOperationException
065: */
066: void add(Service service) throws UnsupportedOperationException;
067:
068: /**
069: * Removes the specified entry to this catalog. In some cases the catalog will be backed onto a
070: * server, which may not allow for deletions.
071: *
072: * @param service
073: * @throws UnsupportedOperationException
074: */
075: void remove(Service service) throws UnsupportedOperationException;
076:
077: /**
078: * Replaces the specified entry in this catalog. In some cases the catalog will be backed onto a
079: * server, which may not allow for deletions.
080: *
081: * @param id
082: * @param service
083: * @throws UnsupportedOperationException
084: */
085: void replace(URI id, Service service)
086: throws UnsupportedOperationException;
087:
088: /**
089: * Find resources matching this id directly from this Catalog.
090: *
091: * @param id used to match resolves
092: * @param monitor used to show the progress of the find.
093: *
094: * @return List (possibly empty) of resolves (objects implementing the
095: * Resolve interface)
096: */
097: List find(URI id, ProgressListener monitor);
098:
099: /**
100: * Find Service matching this id directly from this Catalog. This method is guaranteed to be non-blocking.
101: *
102: * @param query a URI used to match resolves
103: * @param monitor monitor used to watch progress
104: *
105: * @return a List (possibly empty) of matching services (objects of type
106: * Service).
107: */
108: List findService(URI query, ProgressListener monitor);
109:
110: /**
111: * Performs a search on this catalog based on the specified inputs.
112: * <p>
113: * The pattern uses the following conventions:
114: * <ul>
115: * <li>
116: * <li> use " " to surround a phase
117: * <li> use + to represent 'AND'
118: * <li> use - to represent 'OR'
119: * <li> use ! to represent 'NOT'
120: * <li> use ( ) to designate scope
121: * </ul>
122: * The bbox provided shall be in Lat - Long, or null if the search is not to be contained within
123: * a specified area.
124: * </p>
125: *
126: * @param pattern Search pattern (see above)
127: * @param bbox The bbox in Lat-Long (ESPG 4269), or null
128: * @param monitor for progress, or null if monitoring is not desired
129: *
130: * @return List containg objects of type Resolve.
131: */
132: List search(String pattern, Envelope bbox, ProgressListener monitor)
133: throws IOException;
134:
135: /**
136: * Aquire info on this Catalog.
137: * <p>
138: * This is functionally equivalent to: <core>resolve(ICatalogInfo.class,monitor)</code>
139: * </p>
140: *
141: * @see Catalog#resolve(Class, ProgressListener)
142: * @return ICatalogInfo resolve(ICatalogInfo.class,ProgressListener monitor);
143: */
144: CatalogInfo getInfo(ProgressListener monitor) throws IOException;
145: }
|