001: /*
002: * Copyright (c) 1998 - 2005 Versant Corporation
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * Versant Corporation - initial API and implementation
010: */
011: package com.versant.core.common.config;
012:
013: import java.util.*;
014:
015: import com.versant.core.common.BindingSupportImpl;
016: import com.versant.core.metadata.parser.JdoRoot;
017:
018: /**
019: * This wraps a properties instance to provide access to the keys in a sorted
020: * order.
021: */
022: public class ConfigInfo {
023:
024: public Properties props;
025: public String url;
026: public String db;
027: public String serverName;
028: public boolean allowPmCloseWithOpenTx;
029: public boolean precompileNamedQueries;
030: public boolean checkModelConsistencyOnCommit;
031: public boolean interceptDfgFieldAccess;
032: public boolean hyperdrive;
033: public String hyperdriveSrcDir;
034: public String hyperdriveClassDir;
035: public boolean keepHyperdriveBytecode;
036: public int pmCacheRefType;
037: public boolean testing;
038:
039: public String remoteAccess;
040:
041: public boolean retainValues;
042: public boolean restoreValues;
043: public boolean optimistic;
044: public boolean nontransactionalRead;
045: public boolean nontransactionalWrite;
046: public boolean ignoreCache;
047: public boolean multithreaded;
048: public String connectionFactoryName;
049: public String connectionFactory2Name;
050:
051: public boolean pmpoolEnabled;
052: public int pmpoolMaxIdle;
053:
054: public boolean remotePmpoolEnabled;
055: public int remotePmpoolMaxIdle;
056: public int remotePmpoolMaxActive;
057:
058: /**
059: * If query results to be cached.
060: */
061: public boolean queryCacheEnabled;
062: public int maxQueriesToCache;
063: public int compiledQueryCacheSize;
064:
065: /**
066: * The names of .jdo and .jdoql resources.
067: */
068: public ArrayList jdoResources = new ArrayList();
069: public JdoRoot[] jdoMetaData;
070:
071: public Map perfProps;
072:
073: public boolean useCache;
074: public int cacheMaxObjects;
075: public String cacheListenerClass;
076: public Map cacheListenerProps;
077:
078: public int flushThreshold;
079: public int datastoreTxLocking;
080: public int retainConnectionInOptTx; // MdStatics.NOT_SET, FALSE, TRUE
081:
082: public int metricStoreCapacity;
083: public int metricSnapshotIntervalMs;
084: public ArrayList userBaseMetrics = new ArrayList(); // of UserBaseMetric
085:
086: public String logDownloaderClass;
087: public Map logDownloaderProps;
088:
089: public List externalizers = new ArrayList(); // of ExternalizerInfo
090: public Map scoFactoryRegistryMappings = new HashMap();
091: public String metaDataPreProcessor;
092:
093: /**
094: * Info on a user-defined base metric.
095: */
096: public static class UserBaseMetric {
097: public String name;
098: public String displayName;
099: public String category;
100: public String description;
101: public int defaultCalc;
102: public int decimals;
103: }
104:
105: /**
106: * Info on an externalizer.
107: */
108: public static class ExternalizerInfo {
109: public String typeName;
110: public boolean enabled;
111: public String externalizerName;
112: public Map args = new HashMap(17);
113: }
114:
115: /**
116: * Perform basic validation. There must be at least one store and jdo
117: * file.
118: */
119: public void validate() {
120: if (jdoResources.isEmpty()) {
121: throw BindingSupportImpl.getInstance().runtime(
122: "At least one jdoNNN property is required");
123: }
124: }
125:
126: /**
127: * Get the names of .jdo and .jdoql resources.
128: */
129: public String[] getJdoResources() {
130: String[] a = new String[jdoResources.size()];
131: jdoResources.toArray(a);
132: return a;
133: }
134: }
|