001: /**
002: * Speedo: an implementation of JDO compliant personality on top of JORM generic
003: * I/O sub-system.
004: * Copyright (C) 2001-2004 France Telecom R&D
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; either
009: * version 2 of the License, or (at your option) any later version.
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: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: *
021: *
022: * Contact: speedo@objectweb.org
023: *
024: * Authors: S.Chassande-Barrioz.
025: *
026: */package org.objectweb.speedo.api;
027:
028: import java.util.List;
029: import java.util.Arrays;
030: import java.util.Collections;
031:
032: /**
033: * Defines the Speedo options which can be passed as properties to the
034: * PersistenceManagerFactory
035: */
036: public interface SpeedoProperties {
037:
038: String SPEEDO = "org.objectweb.speedo";
039:
040: String LOGGER_NAME = SPEEDO;
041:
042: String DEBUG = SPEEDO + ".debug";
043:
044: // Constant usable in the Properties of a PersistenceManagerFactory
045:
046: /**
047: * Is the property value to pass to the PersistenceManagerFactory to
048: * indicate that the size is unlimited.
049: */
050: String NO_LIMIT = "nolimit";
051:
052: /**
053: * Is the property to pass to the PersistenceManagerFactory to assign the
054: * cache size.
055: */
056: String CACHE_SIZE = SPEEDO + ".cache.size";
057:
058: String CACHE_AUTO_CLEAN_SIZE = SPEEDO + ".cache.autoCleanSize";
059: String CACHE_AUTO_CLEAN_THRESHOLD = SPEEDO
060: + ".cache.autoCleanThreshold";
061:
062: String CACHE_REPLCAEMENT = SPEEDO + ".cache.policy";
063: String CACHE_REPLCAEMENT_FIFO = "FIFO";
064: String CACHE_REPLCAEMENT_LRU = "LRU";
065: String CACHE_REPLCAEMENT_MRU = "MRU";
066:
067: String CACHE_CLASS_POLICY = SPEEDO + ".cache.classPolicy";
068: String CACHE_CLASS_POLICY_NOCACHE = "nocache";
069: String CACHE_CLASS_POLICY_CACHED = "cache";
070: String CACHE_CLASS_POLICY_FIXED = "fixed";
071: String CACHE_CLASS_POLICY_ALL = "all";
072:
073: String USER_CACHE = "user-cache";
074: String USER_CACHE_CLASS_POLICY = SPEEDO + ".user-cache.classPolicy";
075:
076: String SHAREABLE = SPEEDO + ".shareable";
077:
078: /**
079: * Is the property to pass to the PersistenceManagerFactory to indicate
080: * if the transactionnal environnement is managed.
081: */
082: String MANAGED = "org.objectweb.perseus.connector.ra.jdo.managed";
083:
084: String TM_NAME = SPEEDO + ".jca.TMName";
085: /**
086: * @deprecated use TM_NAME
087: */
088: String TM_NAME_OLD = "org.objectweb.perseus.connector.ra.jdo.TMName";
089: /**
090: * Is the property to pass to the PersistenceManagerFactory to assign the
091: * maximum size of PersistenceManager pool.
092: */
093: String PM_POOL_MIN = SPEEDO + ".persistencemanager.pool.min";
094:
095: /**
096: * Is the property to pass to the PersistenceManagerFactory to assign the
097: * minimum size of PersistenceManager pool.
098: */
099: String PM_POOL_MAX = SPEEDO + ".persistencemanager.pool.max";
100: String PM_POOL_TTL = SPEEDO + ".persistencemanager.pool.ttl";
101: String PM_POOL_INACTIVETTL = SPEEDO
102: + ".persistencemanager.pool.inactivettl";
103: String PM_POOL_TIMEOUT = SPEEDO
104: + ".persistencemanager.pool.timeout";
105:
106: /**
107: * Is the property to pass to the PersistenceManagerFactory to assign the
108: * minimum size of compiled query pool.
109: */
110: String COMPILED_QUERY_CACHE_SIZE = SPEEDO
111: + ".compiledquery.cache.size";
112: String COMPILED_QUERY_CACHE_AUTO_CLEAN_SIZE = SPEEDO
113: + ".compiledquery.cache.autoCleanSize";
114: String COMPILED_QUERY_CACHE_AUTO_CLEAN_THRESHOLD = SPEEDO
115: + ".compiledquery.cache.autoCleanThreshold";
116: String COMPILED_QUERY_CACHE_POLICY = SPEEDO
117: + ".compiledquery.cache.policy";
118:
119: /**
120: * Is the property to pass to the PersistenceManagerFactory to specify if
121: * the query must prefetch the data. The default value is true.
122: */
123: String PREFETCH = SPEEDO + ".query.prefetch";
124: String PREFETCH_ON_QUERY = SPEEDO + ".query.prefetch.query";
125: String PREFETCH_ON_EXTENT = SPEEDO + ".query.prefetch.extent";
126: String PREFETCH_ON_GENCLASS = SPEEDO + ".genclass.prefetch";
127:
128: /**
129: * Is the property to pass to the PersistenceManagerFactory to specify the
130: * mapping structure management:
131: * - DO_NOTHING
132: * - CREATE_IF_REQUIRED
133: * - FORCE_CREATE
134: */
135: String MAPPING_STRUCTURE = SPEEDO + ".mappingStructure";
136: String MAPPING_STRUCTURE_DN = "DO_NOTHING";
137: String MAPPING_STRUCTURE_CIR = "CREATE_IF_REQUIRED";
138: String MAPPING_STRUCTURE_FC = "FORCE_CREATE";
139: String MAPPING_STRUCTURE_DD = "DELETE_DATA";
140:
141: /**
142: * Is the property to pass to the PersistenceManagerFactory to specify if
143: * the query must prefetch the data. The default value is true.
144: */
145: String TX_LISTENER = SPEEDO + ".txListener";
146: String CONNECTION_POOL_MIN = SPEEDO + ".connection.pool.min";
147: String CONNECTION_POOL_MAX = SPEEDO + ".connection.pool.max";
148: String CONNECTION_POOL_TTL = SPEEDO + ".connection.pool.ttl";
149: String CONNECTION_POOL_INACTIVETTL = SPEEDO
150: + ".connection.pool.inactivettl";
151: String CONNECTION_POOL_TIMEOUT = SPEEDO
152: + ".connection.pool.timeout";
153:
154: // Constant usable in the .jdo files (keys of the extension tags)
155:
156: String VENDOR_NAME = "speedo";
157:
158: String ID = "id";
159: String ID_SEQUENCE = "sequence";
160: String ID_POLYMORPH_2L = "polymorph2l";
161: String ID_LONG = "long";
162: String ID_OLONG = "java.lang.Long";
163:
164: /**
165: * is a string used in an extension tag in a.jdo file to specify
166: * the sql column for a primitive field (not a reference).
167: */
168: String SQL_NAME = "sql-name";
169:
170: /**
171: * the INHERITANCE_MAPPING property permits to specifies the mapping type
172: * concerning the inheritance aspect.
173: */
174: String INHERITANCE_MAPPING = "inheritance-mapping";
175: String INHERITANCE_FILTERED_MAPPING = "filtered";
176: String INHERITANCE_HORIZONTAL_MAPPING = "horizontal";
177: String INHERITANCE_VERTICAL_MAPPING = "vertical";
178:
179: String INHERITANCE_FILTER = "inheritance-filter";
180: String INHERITANCE_KEY = "inheritance-key";
181:
182: /**
183: * is a string used in an extension tag in a.jdo file to specify
184: * the name of the sequence used for the datastore id.
185: */
186: String SQL_SEQ_NAME = "sql-seq-name";
187: String SQL_SEQ_START = "sql-seq-start";
188: String SQL_SEQ_INC = "sql-seq-increment";
189: String SQL_SEQ_CACHE = "sql-seq-cache";
190: String SQL_SEQ_ALLOCATOR = "sql-seq-allocator";
191:
192: /**
193: * is a string to used in an extension tag in a.jdo file to specify
194: * the sql type for a primitive field (not a reference).
195: */
196: String SQL_TYPE = "sql-type";
197:
198: /**
199: * is a string to used in an extension tag in a.jdo file to specify
200: * the size of primitive field (not a reference).
201: */
202: String SIZE = "size";
203:
204: /**
205: * is a string to used in an extension tag in a.jdo file to specify
206: * the scale of primitive field (not a reference).
207: */
208: String SCALE = "scale";
209:
210: /**
211: * is a string to used in an extension tag in a.jdo file to specify
212: * the foreign keys referencing the current persistent object.
213: */
214: String SOURCE_FK = "source-foreign-keys";
215:
216: /**
217: * is a string to used in an extension tag in a.jdo file to specify
218: * the foreign keys referencing the referenced persistent object.
219: */
220: String TARGET_FK = "target-foreign-keys";
221:
222: /**
223: * is a string to used in an extension tag in a.jdo file to specify
224: * the name of the reverse field.
225: */
226: String REVERSE_FIELD = "reverse-field";
227:
228: /**
229: * is a string to used in an extension tag in a.jdo file to specify
230: * the if persistent instance referenced by a field, must be removed when
231: * the current class is deleted.
232: */
233: String CASCADE_DELETE = "cascade-delete";
234:
235: /**
236: * is a string to used in an extension tag in a.jdo file to specify
237: * the name of the join table in a multivalued reference (Collection, Map,
238: * Array, Set, List).
239: */
240: String JOIN_TABLE = "join-table";
241:
242: /**
243: * is a string to used in an extension tag in a.jdo file to specify
244: * the name of the class permiting the conversion of a field between the
245: * memory and the data support.
246: */
247: String FIELD_CONVERTER = "field-converter";
248:
249: /**
250: * is a string to used in an extension tag in a.jdo file to specify
251: * the column name of the index of the list or of the key in a map.
252: */
253: String INDEX = "index-sql-name";
254:
255: String INDEX_TYPE = "index-sql-type";
256:
257: /**
258: * is a string to used in an extension tag in a.jdo file to specify
259: * the column name of the element of the list or of the value in a map,
260: * when the element is a prmitive.
261: */
262: String ELEMENT = "element-sql-name";
263:
264: String ELEMENT_TYPE = "element-sql-type";
265:
266: String KEY_FIELD = "key-field";
267:
268: /**
269: * Optionals features supported by JDO implementation (see supportedOptions();)
270: */
271: String JDO_OPTION_TRANSIENT_TRANSACTIONAL = "javax.jdo.option.TransientTransactional";
272: String JDO_OPTION_NON_TRANSACTIONAL_READ = "javax.jdo.option.NontransactionalRead";
273: String JDO_OPTION_NON_TRANSACTIONAL_WRITE = "javax.jdo.option.NontransactionalWrite";
274: String JDO_OPTION_RETAIN_VALUES = "javax.jdo.option.RetainValues";
275: String JDO_OPTION_OPTIMISTIC = "javax.jdo.option.Optimistic";
276: String JDO_OPTION_APPLICATION_IDENTITY = "javax.jdo.option.ApplicationIdentity";
277: String JDO_OPTION_DATASTORE_IDENTITY = "javax.jdo.option.DatastoreIdentity";
278: String JDO_OPTION_NON_DURABLE_IDENTITY = "javax.jdo.option.NonDurableIdentity";
279: String JDO_OPTION_ARRAY_LIST = "javax.jdo.option.ArrayList";
280: String JDO_OPTION_HASH_MAP = "javax.jdo.option.HashMap";
281: String JDO_OPTION_HASH_TABLE = "javax.jdo.option.Hashtable";
282: String JDO_OPTION_LINKED_LIST = "javax.jdo.option.LinkedList";
283: String JDO_OPTION_TREE_MAP = "javax.jdo.option.TreeMap";
284: String JDO_OPTION_TREE_SET = "javax.jdo.option.TreeSet";
285: String JDO_OPTION_VECTOR = "javax.jdo.option.Vector";
286: String JDO_OPTION_MAP = "javax.jdo.option.Map";
287: String JDO_OPTION_LIST = "javax.jdo.option.List";
288: String JDO_OPTION_ARRAY = "javax.jdo.option.Array";
289: String JDO_OPTION_NULL_COLLECTION = "javax.jdo.option.NullCollection";
290: String JDO_OPTION_CHANGE_APPLICATION_IDENTITY = "javax.jdo.option.ChangeApplicationIdentity";
291: String JDO_QUERY_JDOQL = "javax.jdo.query.JDOQL";
292:
293: /**
294: * Key values for Properties configuration options
295: */
296: String JDO_PERSISTENCE_MANAGER_FACTORY_CLASS = "javax.jdo.PersistenceManagerFactoryClass";
297: String JDO_OPTION_RESTORE_VALUES = "javax.jdo.option.RestoreValues";
298: String JDO_OPTION_IGNORE_CACHE = "javax.jdo.option.IgnoreCache";
299: String JDO_OPTION_MULTITREADED = "javax.jdo.option.Multithreaded";
300: String JDO_OPTION_CONNECTION_DRIVER_NAME_OLD = "javax.jdo.option.DriverClassName";
301: String JDO_OPTION_CONNECTION_DRIVER_NAME_OLD2 = "javax.jdo.option.DriverName";
302: String JDO_OPTION_CONNECTION_DRIVER_NAME = "javax.jdo.option.ConnectionDriverName";
303: String JDO_OPTION_CONNECTION_USER_NAME = "javax.jdo.option.ConnectionUserName";
304: String JDO_OPTION_CONNECTION_PASSWORD = "javax.jdo.option.ConnectionPassword";
305: String JDO_OPTION_CONNECTION_URL = "javax.jdo.option.ConnectionURL";
306: String JDO_OPTION_CONNECTION_FACTORY_NAME = "javax.jdo.option.ConnectionFactoryName";
307: String JDO_OPTION_CONNECTION_FACTORY2_NAME = "javax.jdo.option.ConnectionFactory2Name";
308: String JDO_OPTION_MAPPING = "javax.jdo.option.mapping";
309:
310: String CONNECTION = SPEEDO + ".connection";
311: String CONNECTION_FACTORY = CONNECTION + ".Factory";
312: String CONNECTION_FACTORY_NAME = CONNECTION + ".FactoryName";
313: String CONNECTION2_FACTORY = CONNECTION + "2.Factory";
314: String CONNECTION2_FACTORY_NAME = CONNECTION + "2.FactoryName";
315: String CONNECTION_DRIVER_NAME = CONNECTION + ".DriverName";
316: String CONNECTION_USER_NAME = CONNECTION + ".UserName";
317: String CONNECTION_PASSWORD = CONNECTION + ".Password";
318: String CONNECTION_URL = CONNECTION + ".URL";
319:
320: String MAPPER_NAME = SPEEDO + ".mapperName";
321: String TRANSACTION_LOCKING = SPEEDO + ".transaction.locking";
322: String SPEEDO_TRANSACTION_LOCKING = "speedo";
323: String DB_TRANSACTION_LOCKING = "database";
324:
325: String TRANSACTION_LOCKING_PESSIMISTIC_POLICY = SPEEDO
326: + ".transaction.locking.pessimistic.policy";
327: String TRANSACTION_LOCKING_PESSIMISTIC_POLICY_MUTEX = "mutex";
328: String TRANSACTION_LOCKING_PESSIMISTIC_POLICY_RW_FIFO = "rw";
329:
330: String TRANSACTION_LOCKING_LEVEL_ENABLETHIN = SPEEDO
331: + ".transaction.locking.level.enablethin";
332: String TRANSACTION_LOCKING_LEVEL = SPEEDO
333: + ".transaction.locking.level";
334: String TRANSACTION_LOCKING_LEVEL_INSTANCE = "instance";
335: String TRANSACTION_LOCKING_LEVEL_FIELD = "field";
336: String TRANSACTION_MODE = SPEEDO + ".transaction.mode";
337: String TRANSACTION_MODE_NORMAL = "NORMAL";
338: String TRANSACTION_MODE_REQUIRED = "REQUIRED";
339: String TRANSACTION_MODE_UT = "USER_TRANSACTION";
340: byte TRANSACTION_BMODE_NORMAL = 0x1;
341: byte TRANSACTION_BMODE_REQUIRED = 0x2;
342: byte TRANSACTION_BMODE_UT = 0x3;
343: String TRANSACTION_FILTERS = SPEEDO + ".transaction.filters";
344:
345: String IMRICATED_PM_ALLOWED = SPEEDO
346: + ".imbricated-persistence-manager";
347: String CONNECTION_CHECK = SPEEDO + ".connection.check";
348:
349: String JMX = SPEEDO + ".jmx";
350: String JMX_HTTP_PORT = SPEEDO + ".jmx.http.port";
351: String JMX_HTTP_HOST = SPEEDO + ".jmx.host";
352: String JMX_HTTP_DEFAULT_HOST = "localhost";
353:
354: public final static int EXTENSION_JDO_IDX = 0;
355: public final static int EXTENSION_PACKAGE_IDX = 1;
356: public final static int EXTENSION_CLASS_IDX = 2;
357: public final static int EXTENSION_FIELD_IDX = 3;
358: public final static int EXTENSION_COLLECTION_IDX = 4;
359: public final static int EXTENSION_MAP_IDX = 5;
360:
361: /**
362: * Defines the supported speedo extentsion on each xml node of the .jdo file
363: */
364: public final static List SUPPORTED_EXTENSION = Arrays
365: .asList(new List[] {
366: Collections.EMPTY_LIST, //jdo
367: Collections.EMPTY_LIST, //package
368: Arrays.asList(new String[] { SQL_NAME,
369: SQL_SEQ_CACHE, SQL_SEQ_INC, SQL_SEQ_NAME,
370: SQL_SEQ_START, SQL_SEQ_ALLOCATOR, ID,
371: INHERITANCE_MAPPING, INHERITANCE_KEY,
372: INHERITANCE_FILTER }), //class
373: Arrays.asList(new String[] { SQL_NAME, SQL_TYPE,
374: SIZE, SOURCE_FK, TARGET_FK, JOIN_TABLE,
375: REVERSE_FIELD, ELEMENT, ELEMENT_TYPE,
376: INDEX, INDEX_TYPE, FIELD_CONVERTER,
377: CASCADE_DELETE, KEY_FIELD, USER_CACHE }),//field
378: Arrays.asList(new String[] { ELEMENT, ELEMENT_TYPE,
379: INDEX, INDEX_TYPE }),//collection
380: Arrays.asList(new String[] { ELEMENT, ELEMENT_TYPE,
381: INDEX, INDEX_TYPE, KEY_FIELD }),//map
382: });
383: }
|