001: /*
002: * Geotools2 - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2005-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: */
017: package org.geotools.data.complex.config;
018:
019: import java.io.Serializable;
020: import java.util.ArrayList;
021: import java.util.Collections;
022: import java.util.HashMap;
023: import java.util.HashSet;
024: import java.util.List;
025: import java.util.Map;
026: import java.util.Set;
027:
028: import org.geotools.util.CheckedArrayList;
029: import org.geotools.util.CheckedHashMap;
030: import org.geotools.util.CheckedHashSet;
031:
032: /**
033: * Configuration object for a {@link org.geotools.data.complex.ComplexDataStore}.
034: * <p>
035: * This configuration object contains all the needed elements for a
036: * ComplexDataStore to aquire the source and target FeatureTypes, and apply the
037: * mappings between attributes to serve community schemas.
038: * </p>
039: *
040: * @author Gabriel Roldan, Axios Engineering
041: * @version $Id: ComplexDataStoreDTO.java 27701 2007-11-02 16:03:18Z groldan $
042: * @source $URL:
043: * http://svn.geotools.org/geotools/branches/2.4.x/modules/unsupported/community-schemas/community-schema-ds/src/main/java/org/geotools/data/complex/config/ComplexDataStoreDTO.java $
044: * @since 2.4
045: */
046: public class ComplexDataStoreDTO implements Serializable {
047: private static final long serialVersionUID = -8649884546130644668L;
048:
049: /**
050: * Url used as base path to resolve relative file names in {@link
051: * #targetSchemasUris}
052: */
053: private String baseSchemasUrl;
054:
055: /** Mapping of prefix/namespace used in the target schema */
056: private Map namespaces = Collections.EMPTY_MAP;
057:
058: /**
059: * List of configuration objects used to aquire the datastores that provides
060: * the source FeatureTypes. Source feature types are those internally
061: * defined whose Feature instances are converted to features of the target
062: * schemas by applying the FeatureTypeMappings.
063: */
064: private List /* <SourceDataStore> */sourceDataStores = Collections.EMPTY_LIST;
065:
066: private Set /* <TypeMapping> */typeMappings = Collections.EMPTY_SET;
067:
068: /**
069: * List of file names, that may be fully qualified URL's, or paths relative
070: * to {@link #baseSchemasUrl}
071: */
072: private List targetSchemasUris = Collections.EMPTY_LIST;
073:
074: private String oasisCatalogUri;
075:
076: /**
077: * DOCUMENT ME!
078: *
079: * @return DOCUMENT ME!
080: */
081: public List getTargetSchemasUris() {
082: return new ArrayList(targetSchemasUris);
083: }
084:
085: /**
086: * DOCUMENT ME!
087: *
088: * @param targetSchemasUris
089: * DOCUMENT ME!
090: */
091: public void setTargetSchemasUris(List targetSchemasUris) {
092: this .targetSchemasUris = new CheckedArrayList(String.class);
093:
094: if (targetSchemasUris != null) {
095: this .targetSchemasUris.addAll(targetSchemasUris);
096: }
097: }
098:
099: /**
100: * DOCUMENT ME!
101: *
102: * @param nameSpaces
103: * DOCUMENT ME!
104: */
105: public void setNamespaces(Map nameSpaces) {
106: if (nameSpaces == null) {
107: this .namespaces = Collections.EMPTY_MAP;
108: } else {
109: this .namespaces = new CheckedHashMap(String.class,
110: String.class);
111: this .namespaces.putAll(nameSpaces);
112: }
113: }
114:
115: /**
116: * DOCUMENT ME!
117: *
118: * @return DOCUMENT ME!
119: */
120: public Map getNamespaces() {
121: return new HashMap(namespaces);
122: }
123:
124: /**
125: * DOCUMENT ME!
126: *
127: * @param dataStores
128: * DOCUMENT ME!
129: */
130: public void setSourceDataStores(
131: List /* <SourceDataStore> */dataStores) {
132: if (dataStores == null) {
133: this .sourceDataStores = Collections.EMPTY_LIST;
134: } else {
135: this .sourceDataStores = new CheckedArrayList(
136: SourceDataStore.class);
137: this .sourceDataStores.addAll(dataStores);
138: }
139: }
140:
141: /**
142: * DOCUMENT ME!
143: *
144: * @return DOCUMENT ME!
145: */
146: public List getSourceDataStores() {
147: return new ArrayList(sourceDataStores);
148: }
149:
150: /**
151: * DOCUMENT ME!
152: *
153: * @param typeMappings
154: * DOCUMENT ME!
155: */
156: public void setTypeMappings(Set typeMappings) {
157: this .typeMappings = new CheckedHashSet(TypeMapping.class);
158:
159: if (typeMappings != null) {
160: this .typeMappings.addAll(typeMappings);
161: }
162: }
163:
164: /**
165: * DOCUMENT ME!
166: *
167: * @return DOCUMENT ME!
168: */
169: public Set getTypeMappings() {
170: return new HashSet(typeMappings);
171: }
172:
173: /**
174: * DOCUMENT ME!
175: *
176: * @return a non null URL for the base location of the resource files in
177: * order to serve as the base to resolve relative configuration
178: * paths.
179: */
180: public String getBaseSchemasUrl() {
181: return baseSchemasUrl;
182: }
183:
184: /**
185: * DOCUMENT ME!
186: *
187: * @param baseSchemasUrl
188: * URL of a resource which's going to be taken as the base
189: * location to resolve configuration path elements expressed as
190: * relative paths.
191: */
192: public void setBaseSchemasUrl(final String baseSchemasUrl) {
193: this .baseSchemasUrl = baseSchemasUrl;
194: }
195:
196: public String getCatalog() {
197: return oasisCatalogUri;
198: }
199:
200: public void setCatalog(final String oasisCatalogUri) {
201: this.oasisCatalogUri = oasisCatalogUri;
202: }
203: }
|