001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.data;
017:
018: import java.io.IOException;
019: import java.util.Map;
020: import java.util.Set;
021: import java.util.SortedMap;
022:
023: /**
024: * Provides a Repository of available FeatureTypes allowing Catalog metadata queries.
025: *
026: * <p>
027: * Currently GeoServer is providing requirements:
028: * </p>
029: *
030: * <ul>
031: * <li>
032: * Manage cross DataStore concepts (like Locks)
033: * </li>
034: * <li>
035: * Provide metadata information on FeatureType
036: * </li>
037: * </ul>
038: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/api/src/main/java/org/geotools/data/Repository.java $
039: */
040: public interface Repository {
041: /**
042: * All FeatureSources by typeRef ( aka dataStoreId:typeName)
043: */
044: public SortedMap getFeatureSources();
045:
046: /**
047: * Retrieve Set of Namespaces prefixes registered by DataStores in this
048: * Catalog.
049: *
050: * <p>
051: * Namespace seems to be the gml prefix used when writing out GML. We may
052: * need to promote this to a "first class" object.
053: * </p>
054: *
055: * <p>
056: * GeoServer maintains the following information in a NamespaceInfo
057: * object:
058: * </p>
059: *
060: * <ul>
061: * <li>
062: * prefix: uml prefix representing the namespace
063: * </li>
064: * <li>
065: * uri: uri used to reference namespace
066: * </li>
067: * <li>
068: * default: true if this is the "Default" namespace for the Catalog
069: * </li>
070: * </ul>
071: *
072: * <p>
073: * GeoServer global.Data implements this interface. You may use the
074: * namespace strings returned by this method to look up NamespaceInfo
075: * objets by prefix.
076: * </p>
077: *
078: * @return Set of available Namespace prefixes.
079: */
080: Set getPrefixes() throws IOException;
081:
082: /**
083: * The default Namespace prefix for this Catalog.
084: * @return Namespace prefix to be used as a default
085: */
086:
087: //String getDefaultPrefix();
088: /**
089: * FeatureSoruce access.
090: * </p>
091: * @param dataStoreId
092: * @param typeName
093: */
094: FeatureSource source(String dataStoreId, String typeName)
095: throws IOException;
096:
097: /**
098: * Registers all FeatureTypes provided by dataStore with this catalog
099: * service.
100: *
101: * <p>
102: * Catalog can be seen as aggregating multiple DataStores and providing
103: * higher level functionality. Such as derived metadata like lat long
104: * bounding box information.
105: * </p>
106: *
107: * <p>
108: * The Catalog may choose to supplement the information provided by the
109: * DataStore with information provided from elsewhere (like config files).
110: * </p>
111: *
112: * <p>
113: * The namespace declared by the FeatureTypes will be lazly created if it
114: * has not already been provided. There may be no duplication of typeName
115: * within one Namespace.
116: * </p>
117: *
118: * @param namespace Catalog namespace
119: * @param dataStore Datastore providing FeatureTypes
120: *
121: * @throws IOException If registration fails such as for namespace conflict
122: */
123:
124: //void register( String dataStoreId, DataStore dataStore) throws IOException;
125: /**
126: * Access to the DataStores registed to this Catalog.
127: *
128: * @return Map of registered dataStoreId:DataStore
129: */
130: Map getDataStores();
131:
132: //
133: // Lock Management
134: //
135:
136: /**
137: * Refresh feature lock as indicated by the WFS locking specification.
138: *
139: * <p>
140: * Refresh the indicated locks for each each DataStore managed by this
141: * Catalog.
142: * </p>
143: *
144: * @param lockID Authorization identifing lock
145: * @param transaction Transaction with authorization for lock
146: *
147: * @return true if lock was found and refreshed
148: *
149: * @throws IOException If a problem occurs
150: */
151: boolean lockRefresh(String lockID, Transaction transaction)
152: throws IOException;
153:
154: /**
155: * Release feature lock by lockID.
156: * <p>
157: * Release the indicated locks for each each DataStore managed by this
158: * Catalog.
159: * </p>
160: *
161: * @param lockID Authorization identifing lock
162: * @param transaction Transaction with authorization for lock
163: *
164: * @return true if lock was found and released
165: *
166: * @throws IOException If a problem occurs
167: */
168: boolean lockRelease(String lockID, Transaction transaction)
169: throws IOException;
170:
171: /**
172: * Tests if a lock exists in this Catalog.
173: *
174: * <p>
175: * This method will search all the DataStores to see if the indicated lock
176: * exists.
177: * </p>
178: *
179: * @param lockID Authorization identifing lock
180: *
181: * @return true if lock was found
182: */
183: boolean lockExists(String lockID);
184: }
|