001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-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: * Created on 8/01/2004
017: */
018: package org.geotools.data.jdbc;
019:
020: import java.util.Collections;
021: import java.util.Map;
022:
023: /**
024: * Configuration object for JDBCDataStore.
025: *
026: * @author Sean Geoghegan, Defence Science and Technology Organisation
027: * @author $Author: aaime $
028: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/jdbc/src/main/java/org/geotools/data/jdbc/JDBCDataStoreConfig.java $
029: * @version $Id: JDBCDataStoreConfig.java 22347 2006-10-24 01:57:23Z jdeolive $ Last Modified: $Date: 2004/04/18 09:19:43 $
030: */
031: public class JDBCDataStoreConfig {
032: public static final String FID_GEN_INSERT_NULL = "INSERT_NULL";
033: public static final String FID_GEN_MANUAL_INC = "MANUAL_INC";
034: public static final String DEFAULT_FID_GEN_KEY = "DEFAULT_GEN";
035: public static final String DEFAULT_FID_GEN = FID_GEN_INSERT_NULL;
036:
037: /**
038: * Namespace of schema describing this JDBCDatastore.
039: * <p>
040: * Assume this is in the GML sense?
041: * </p>
042: */
043: private final String namespace;
044:
045: /** Name of database schema */
046: private final String databaseSchemaName;
047:
048: protected final long typeHandlerCacheTimout;
049:
050: /**
051: * Construct <code>JDBCDataStoreConfig</code>.
052: *
053: */
054: public JDBCDataStoreConfig() {
055: this (null, null, Collections.EMPTY_MAP, Collections.EMPTY_MAP);
056: }
057:
058: /**
059: * Construct <code>JDBCDataStoreConfig</code>.
060: *
061: * @param namespace
062: * @param databaseSchemaName
063: * @param fidColumnOverrideMap
064: * @param fidGenerationMap
065: */
066: public JDBCDataStoreConfig(String namespace,
067: String databaseSchemaName, Map fidColumnOverrideMap,
068: Map fidGenerationMap) {
069: this (namespace, databaseSchemaName, Long.MAX_VALUE);
070: }
071:
072: /**
073: * Construct <code>JDBCDataStoreConfig</code>.
074: *
075: * @param namespace
076: * @param databaseSchemaName
077: * @param typeHandlerCacheTimeout
078: */
079: public JDBCDataStoreConfig(String namespace,
080: String databaseSchemaName, long typeHandlerCacheTimeout) {
081: this .namespace = namespace;
082: if (databaseSchemaName == null || databaseSchemaName.equals("")) {
083: this .databaseSchemaName = null;
084: } else {
085: this .databaseSchemaName = databaseSchemaName;
086: }
087: this .typeHandlerCacheTimout = typeHandlerCacheTimeout;
088: }
089:
090: /**
091: * TODO summary sentence for createWithNameSpaceAndSchemaName ...
092: *
093: * @param namespace
094: * @param schemaName
095: */
096: public static JDBCDataStoreConfig createWithNameSpaceAndSchemaName(
097: String namespace, String schemaName) {
098: return new JDBCDataStoreConfig(namespace, schemaName,
099: Collections.EMPTY_MAP, Collections.EMPTY_MAP);
100: }
101:
102: public static JDBCDataStoreConfig createWithSchemaNameAndFIDGenMap(
103: String schemaName, Map fidGenerationMap) {
104: return new JDBCDataStoreConfig(null, schemaName,
105: Collections.EMPTY_MAP, fidGenerationMap);
106: }
107:
108: /**
109: * DOCUMENT ME!
110: *
111: * @return Returns the databaseSchemaName.
112: */
113: public String getDatabaseSchemaName() {
114: return databaseSchemaName;
115: }
116:
117: /**
118: * DOCUMENT ME!
119: *
120: * @return Returns the namespace.
121: */
122: public String getNamespace() {
123: return namespace;
124: }
125:
126: /**
127: */
128: public long getTypeHandlerTimeout() {
129: return typeHandlerCacheTimout;
130: }
131:
132: }
|