Source Code Cross Referenced for PersistenceConfiguration.java in  » Database-ORM » JPOX » org » jpox » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » JPOX » org.jpox 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /**********************************************************************
0002:        Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
0003:        Licensed under the Apache License, Version 2.0 (the "License");
0004:        you may not use this file except in compliance with the License.
0005:        You may obtain a copy of the License at
0006:
0007:            http://www.apache.org/licenses/LICENSE-2.0
0008:
0009:        Unless required by applicable law or agreed to in writing, software
0010:        distributed under the License is distributed on an "AS IS" BASIS,
0011:        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012:        See the License for the specific language governing permissions and
0013:        limitations under the License.
0014:
0015:        Contributors:
0016:        2004 Andy Jefferson - added description of addition process.
0017:        2004 Andy Jefferson - added constructor, and try-catch on initialisation
0018:        2006 Andy Jefferson - renamed to PersistenceConfiguration so that it is API agnostic
0019:            ...
0020:         **********************************************************************/package org.jpox;
0021:
0022:        import java.io.File;
0023:        import java.io.FileInputStream;
0024:        import java.io.FileNotFoundException;
0025:        import java.io.IOException;
0026:        import java.io.InputStream;
0027:        import java.util.Calendar;
0028:        import java.util.Enumeration;
0029:        import java.util.GregorianCalendar;
0030:        import java.util.HashMap;
0031:        import java.util.Iterator;
0032:        import java.util.Map;
0033:        import java.util.Properties;
0034:        import java.util.Set;
0035:        import java.util.TimeZone;
0036:
0037:        import javax.jdo.JDOUserException;
0038:
0039:        import org.jpox.exceptions.JPOXUserException;
0040:        import org.jpox.metadata.TransactionType;
0041:        import org.jpox.plugin.PluginRegistry;
0042:        import org.jpox.store.AutoStartMechanism;
0043:        import org.jpox.transaction.TransactionUtils;
0044:        import org.jpox.util.JPOXLogger;
0045:        import org.jpox.util.Localiser;
0046:        import org.jpox.util.StringUtils;
0047:
0048:        /**
0049:         * Class providing configuration for persistence.
0050:         * Can be extended by PersistenceManagerFactory/EntityManagerFactory to provide their own additions if required.
0051:         * All properties should have setter/getter, and should have a "PropertySetter"
0052:         * to allow loading of the property from the persistence factory Properties.
0053:         *
0054:         * @version $Revision: 1.52 $
0055:         */
0056:        public abstract class PersistenceConfiguration {
0057:            /** Localisation of messages. */
0058:            protected static final Localiser LOCALISER = Localiser.getInstance(
0059:                    "org.jpox.Localisation", ObjectManager.class
0060:                            .getClassLoader());
0061:
0062:            // ------------------------------ JDO standard properties ---------------------------------
0063:
0064:            /** JDO PMF class property. */
0065:            public static final String JDO_PMF_CLASS_PROPERTY = "javax.jdo.PersistenceManagerFactoryClass";
0066:
0067:            /** Datastore driver name property. */
0068:            public static final String JDO_DATASTORE_DRIVERNAME_PROPERTY = "javax.jdo.option.ConnectionDriverName";
0069:
0070:            /** Datastore URL property. */
0071:            public static final String JDO_DATASTORE_URL_PROPERTY = "javax.jdo.option.ConnectionURL";
0072:
0073:            /** Datastore connection username property. */
0074:            public static final String JDO_DATASTORE_USERNAME_PROPERTY = "javax.jdo.option.ConnectionUserName";
0075:
0076:            /** Datastore connection password property. */
0077:            public static final String JDO_DATASTORE_PASSWORD_PROPERTY = "javax.jdo.option.ConnectionPassword";
0078:
0079:            /** Datastore connection factory name property. */
0080:            public static final String JDO_CONNECTION_FACTORY_NAME_PROPERTY = "javax.jdo.option.ConnectionFactoryName";
0081:
0082:            /** Datastore connection factory 2 name property. */
0083:            public static final String JDO_CONNECTION_FACTORY2_NAME_PROPERTY = "javax.jdo.option.ConnectionFactory2Name";
0084:
0085:            /** Datastore connection factory property. */
0086:            public static final String JDO_CONNECTION_FACTORY_PROPERTY = "javax.jdo.option.ConnectionFactory";
0087:
0088:            /** Datastore connection factory 2 property. */
0089:            public static final String JDO_CONNECTION_FACTORY2_PROPERTY = "javax.jdo.option.ConnectionFactory2";
0090:
0091:            /** Ignore Cache property. */
0092:            public static final String JDO_IGNORECACHE_PROPERTY = "javax.jdo.option.IgnoreCache";
0093:
0094:            /** Optimistic transaction property. */
0095:            public static final String JDO_OPTIMISTIC_PROPERTY = "javax.jdo.option.Optimistic";
0096:
0097:            /** Multithreaded property. */
0098:            public static final String JDO_MULTITHREADED_PROPERTY = "javax.jdo.option.Multithreaded";
0099:
0100:            /** Retain values property. */
0101:            public static final String JDO_RETAINVALUES_PROPERTY = "javax.jdo.option.RetainValues";
0102:
0103:            /** Restore values property. */
0104:            public static final String JDO_RESTOREVALUES_PROPERTY = "javax.jdo.option.RestoreValues";
0105:
0106:            /** Non-transactional Read property. */
0107:            public static final String JDO_NONTRANSACTIONAL_READ_PROPERTY = "javax.jdo.option.NontransactionalRead";
0108:
0109:            /** Non-transactional Write property. */
0110:            public static final String JDO_NONTRANSACTIONAL_WRITE_PROPERTY = "javax.jdo.option.NontransactionalWrite";
0111:
0112:            /** Mapping suffix property. */
0113:            public static final String JDO_MAPPING_PROPERTY = "javax.jdo.option.Mapping";
0114:
0115:            /** Catalog name property. */
0116:            public static final String JDO_MAPPING_CATALOG_PROPERTY = "javax.jdo.mapping.Catalog";
0117:
0118:            /** Schema name property. */
0119:            public static final String JDO_MAPPING_SCHEMA_PROPERTY = "javax.jdo.mapping.Schema";
0120:
0121:            /** Detach-all-on-commit property */
0122:            public static final String JDO_DETACHALLONCOMMIT_PROPERTY = "javax.jdo.option.DetachAllOnCommit";
0123:
0124:            /** Copy-on-attach property */
0125:            public static final String JDO_COPYONATTACH_PROPERTY = "javax.jdo.option.CopyOnAttach";
0126:
0127:            /** JDO Transaction type property. */
0128:            public static final String JDO_TRANSACTION_TYPE_PROPERTY = "javax.jdo.option.TransactionType";
0129:
0130:            /** Property representing the name of the persistence factory. */
0131:            public static final String JDO_NAME_PROPERTY = "javax.jdo.option.Name";
0132:
0133:            /** "persistence-unit" name property. */
0134:            public static final String JDO_PERSISTENCE_UNIT_NAME_PROPERTY = "javax.jdo.option.PersistenceUnitName";
0135:
0136:            /** Server timezone "id". */
0137:            public static final String JDO_SERVER_TIMEZONE_ID_PROPERTY = "javax.jdo.option.ServerTimeZoneID";
0138:
0139:            // ------------------------------ JPA standard properties ---------------------------------
0140:
0141:            /** JPA Transaction type property. */
0142:            public static final String JPA_TRANSACTION_TYPE_PROPERTY = "javax.persistence.TransactionType";
0143:
0144:            /** JPA persistence provider property. */
0145:            public static final String JPA_PERSISTENCE_PROVIDER_PROPERTY = "javax.persistence.provider";
0146:
0147:            /** Name of property to use to define if we should support 1-N uni FK relations. */
0148:            public static final String JPA_ONE_TO_MANY_UNI_FK_PROPERTY = "org.jpox.jpa.oneToManyUniFkRelations";
0149:
0150:            // ------------------------------ JPOX extension properties ---------------------------------
0151:
0152:            /** Property defining whether to include codes in messages. */
0153:            public static final String MESSAGES_INCLUDE_CODES_PROPERTY = "org.jpox.messageCodesIncluded";
0154:
0155:            /** Property defining the StoreManager to use. Only used when we dont have a datastore URL. */
0156:            public static final String STORE_MANAGER_TYPE = "org.jpox.storeManagerType";
0157:
0158:            /** Property defining whether to register MBeans for use as part of a managed runtime system. */
0159:            public static final String MANAGED_RUNTIME_PROPERTY = "org.jpox.managedRuntime";
0160:
0161:            /** The API name to use for persistence. Defaults to JDO, but can also be JPA. */
0162:            public static final String PERSISTENCE_API_NAME = "org.jpox.persistenceApiName";
0163:
0164:            /** ClassLoaderResolver name property. */
0165:            public static final String CLASS_LOADER_RESOLVER_NAME_PROPERTY = "org.jpox.classLoaderResolverName";
0166:
0167:            /** Implementation Creator name property. */
0168:            public static final String IMPLEMENTATION_CREATOR_NAME_PROPERTY = "org.jpox.implementationCreatorName";
0169:
0170:            /** datastore-identity class name property. */
0171:            public static final String DATASTORE_IDENTITY_CLASS_NAME_PROPERTY = "org.jpox.datastoreIdentityClassName";
0172:
0173:            /** Property for whether to manage relationships. */
0174:            public static final String MANAGE_RELATIONSHIPS_PROPERTY = "org.jpox.manageRelationships";
0175:
0176:            /** Property for whether to check managed relationships. */
0177:            public static final String MANAGE_RELATIONSHIPS_CHECKS_PROPERTY = "org.jpox.manageRelationshipsChecks";
0178:
0179:            /** Detach-on-close property. */
0180:            public static final String DETACH_ON_CLOSE_PROPERTY = "org.jpox.DetachOnClose";
0181:
0182:            /** Property defining if attach operations should assume that detached objects are from the same datastore. */
0183:            public static final String ATTACH_SAME_DATASTORE_PROPERTY = "org.jpox.attachSameDatastore";
0184:
0185:            /** Property for whether to check inheritance on findObject requests. */
0186:            public static final String FIND_OBJECT_CHECK_INHERITANCE_PROPERTY = "org.jpox.findObjectCheckInheritance";
0187:
0188:            /** Property defining the classname of the datastore adapter to use. */
0189:            public static final String DATASTORE_ADAPTER_CLASSNAME_PROPERTY = "org.jpox.datastoreAdapterClassName";
0190:
0191:            /** Property for whether to validate the tables upon loading. */
0192:            public static final String VALIDATE_TABLES_PROPERTY = "org.jpox.validateTables";
0193:
0194:            /** Property for whether to validate the columns upon loading. */
0195:            public static final String VALIDATE_COLUMNS_PROPERTY = "org.jpox.validateColumns";
0196:
0197:            /** Property for whether the validate the constraints upon loading */
0198:            public static final String VALIDATE_CONSTRAINTS_PROPERTY = "org.jpox.validateConstraints";
0199:
0200:            /** Property for whether to warn only when receiving an error on auto creation. */
0201:            public static final String AUTO_CREATE_WARN_ON_ERROR_PROPERTY = "org.jpox.autoCreateWarnOnError";
0202:
0203:            /** Property for whether to auto create the schema upon loading. */
0204:            public static final String AUTO_CREATE_SCHEMA_PROPERTY = "org.jpox.autoCreateSchema";
0205:
0206:            /** Property for whether to auto create the tables upon loading. */
0207:            public static final String AUTO_CREATE_TABLES_PROPERTY = "org.jpox.autoCreateTables";
0208:
0209:            /** Property for whether to auto create the columns upon loading. */
0210:            public static final String AUTO_CREATE_COLUMNS_PROPERTY = "org.jpox.autoCreateColumns";
0211:
0212:            /** The system property that selects the default value for the AutoCreateConstraints setting. */
0213:            public static final String AUTO_CREATE_CONSTRAINTS_PROPERTY = "org.jpox.autoCreateConstraints";
0214:
0215:            /** Whether the datastore schema is read-only and so writes should not be performed. */
0216:            public static final String READ_ONLY_DATASTORE_PROPERTY = "org.jpox.readOnlyDatastore";
0217:
0218:            /** What should happen when using a read-only datastore and an update is attempted. */
0219:            public static final String READ_ONLY_DATASTORE_ACTION_PROPERTY = "org.jpox.readOnlyDatastoreAction";
0220:
0221:            /** Whether the datastore schema is read-only and so writes should not be performed. */
0222:            public static final String FIXED_DATASTORE_PROPERTY = "org.jpox.fixedDatastore";
0223:
0224:            /** The system property that defines the process for deletions. */
0225:            public static final String DELETION_POLICY_PROPERTY = "org.jpox.deletionPolicy";
0226:
0227:            /** Property defining the default strategy for inheritance, allowing change of behaviour from JDO2. */
0228:            public static final String DEFAULT_INHERITANCE_STRATEGY_PROPERTY = "org.jpox.defaultInheritanceStrategy";
0229:
0230:            /** Property defining the transaction isolation mode to use. */
0231:            public static final String TRANSACTION_ISOLATION_PROPERTY = "org.jpox.transactionIsolation";
0232:
0233:            /** Property defining the JTA locator to use. */
0234:            public static final String JTA_LOCATOR_PROPERTY = "org.jpox.jtaLocator";
0235:
0236:            /** Property defining the JTA JNDI location to use (if known). */
0237:            public static final String JTA_JNDI_LOCATION_PROPERTY = "org.jpox.jtaJndiLocation";
0238:
0239:            /** Property defining if we should delay operations til commit/flush with datastore txns. */
0240:            public static final String DATASTORE_TXN_DELAY_OPERATIONS_PROPERTY = "org.jpox.datastoreTransactionDelayOperations";
0241:
0242:            /** Property defining the limit on number of dirty objects before flush occurs with datastore txns. */
0243:            public static final String DATASTORE_TXN_FLUSH_LIMIT_PROPERTY = "org.jpox.datastoreTransactionFlushLimit";
0244:
0245:            /** Property defining the transaction isolation to use when obtaining POIDs. */
0246:            public static final String POID_TRANSACTION_ISOLATION_PROPERTY = "org.jpox.poid.transactionIsolation";
0247:
0248:            /** Property defining how to obtain a datastore connection when generating POIDs */
0249:            public static final String POID_TRANSACTION_ATTRIBUTE_PROPERTY = "org.jpox.poid.transactionAttribute";
0250:
0251:            /** Property defining the auto-start mechanism to use (if any).  */
0252:            public static final String AUTO_START_MECHANISM_PROPERTY = "org.jpox.autoStartMechanism";
0253:
0254:            /** Property defining the mode of operation of any auto-start mechanism. */
0255:            public static final String AUTO_START_MECHANISM_MODE_PROPERTY = "org.jpox.autoStartMechanismMode";
0256:
0257:            /** Property defining the name of the file used when using the XML AutoStartMechanism. */
0258:            public static final String AUTO_START_MECHANISM_XML_FILE_PROPERTY = "org.jpox.autoStartMechanismXmlFile";
0259:
0260:            /** Property defining the names of the classes whose MetaData is to be loaded at startup. */
0261:            public static final String AUTO_START_CLASS_NAMES_PROPERTY = "org.jpox.autoStartClassNames";
0262:
0263:            /** Property defining whether PBR is run at commit time (JDO default is true). */
0264:            public static final String PERSISTENCE_BY_REACHABILITY_AT_COMMIT = "org.jpox.persistenceByReachabilityAtCommit";
0265:
0266:            /** Property defining the maximum fetch depth to use by default. */
0267:            public static final String MAX_FETCH_DEPTH_PROPERTY = "org.jpox.maxFetchDepth";
0268:
0269:            /** Property defining the identifier factory to use. */
0270:            public static final String IDENTIFIER_FACTORY_PROPERTY = "org.jpox.identifierFactory";
0271:
0272:            /** Property defining the identifier case to be used. */
0273:            public static final String IDENTIFIER_CASE_PROPERTY = "org.jpox.identifier.case";
0274:
0275:            /** Property defining the word separator for use in identifiers (if supported by the factory). */
0276:            public static final String IDENTIFIER_WORD_SEPARATOR_PROPERTY = "org.jpox.identifier.wordSeparator";
0277:
0278:            /** Property defining the table prefix for use in identifiers (if supported by the factory). */
0279:            public static final String IDENTIFIER_TABLE_PREFIX_PROPERTY = "org.jpox.identifier.tablePrefix";
0280:
0281:            /** Property defining the table suffix for use in identifiers (if supported by the factory). */
0282:            public static final String IDENTIFIER_TABLE_SUFFIX_PROPERTY = "org.jpox.identifier.tableSuffix";
0283:
0284:            /** Property defining a file that contains properties that will be loaded by JPOX. */
0285:            public static final String PROPERTIES_FILE = "org.jpox.propertiesFile";
0286:
0287:            /** Property defining how to pool connections. */
0288:            public static final String CONNECTION_POOLING_TYPE_PROPERTY = "org.jpox.connectionPoolingType";
0289:
0290:            /** Property defining the configuration file for connection pooling. */
0291:            public static final String CONNECTION_POOLING_CONFIGURATION_FILE_PROPERTY = "org.jpox.connectionPoolingConfigurationFile";
0292:
0293:            /** Property defining the type of Level 1 Cache to use. */
0294:            public static final String CACHE_LEVEL_1_TYPE_PROPERTY = "org.jpox.cache.level1.type";
0295:
0296:            /** Property defining whether to use a Level 2 Cache. */
0297:            public static final String CACHE_LEVEL_2_PROPERTY = "org.jpox.cache.level2";
0298:
0299:            /** Property defining the type of Level 2 Cache to use. */
0300:            public static final String CACHE_LEVEL_2_TYPE_PROPERTY = "org.jpox.cache.level2.type";
0301:
0302:            /** Property defining the symbolic name of the cache to use for Level 2. */
0303:            public static final String CACHE_LEVEL_2_CACHE_NAME_PROPERTY = "org.jpox.cache.level2.cacheName";
0304:
0305:            /** Property defining the configuration file of the cache to use for Level 2. */
0306:            public static final String CACHE_LEVEL_2_CONFIGURATION_FILE_PROPERTY = "org.jpox.cache.level2.configurationFile";
0307:
0308:            /** Property defining whether to cache collections. */
0309:            public static final String CACHE_COLLECTIONS_PROPERTY = "org.jpox.cache.collections";
0310:
0311:            /** Property defining whether to lazy load collections (when cached). */
0312:            public static final String CACHE_COLLECTIONS_LAZY_PROPERTY = "org.jpox.cache.collections.lazy";
0313:
0314:            /** Property defining whether to validate the metadata files.*/
0315:            public static final String METADATA_VALIDATE_PROPERTY = "org.jpox.metadata.validate";
0316:
0317:            /** Property defining the file extension for the JDO metadata files. */
0318:            public static final String METADATA_JDO_FILE_EXTENSION_PROPERTY = "org.jpox.metadata.jdoFileExtension";
0319:
0320:            /** Property defining the file extension for the ORM metadata files. */
0321:            public static final String METADATA_ORM_FILE_EXTENSION_PROPERTY = "org.jpox.metadata.ormFileExtension";
0322:
0323:            /** Property defining the file extension for the JDO Query metadata files.*/
0324:            public static final String METADATA_JDOQUERY_FILE_EXTENSION_PROPERTY = "org.jpox.metadata.jdoqueryFileExtension";
0325:
0326:            /** Property defining the name of the class that will manage annoations. */
0327:            public static final String METADATA_ANNOTATIONS_MANAGER_PROPERTY = "org.jpox.metadata.annotationManager";
0328:
0329:            /** Plugin registry class name */
0330:            public static final String PLUGIN_REGISTRY_CLASS_NAME = "org.jpox.plugin.pluginRegistryClassName";
0331:
0332:            /** Plugin registry bundle check */
0333:            public static final String PLUGIN_REGISTRY_BUNDLE_CHECK = "org.jpox.plugin.pluginRegistryBundleCheck";
0334:
0335:            /** Property defining whether to flush all changes before executing the query. */
0336:            public static final String QUERY_FLUSH_BEFORE_EXECUTION_PROPERTY = "org.jpox.query.flushBeforeExecution";
0337:
0338:            /** Property defining whether to use the FetchPlan when executing the query. */
0339:            public static final String QUERY_USE_FETCH_PLAN_PROPERTY = "org.jpox.query.useFetchPlan";
0340:
0341:            /** Property defining the timeout (seconds) for any queries. */
0342:            public static final String QUERY_TIMEOUT_PROPERTY = "org.jpox.query.timeout";
0343:
0344:            /** Property defining the direction in which a result set will be navigated. */
0345:            public static final String QUERY_FETCH_DIRECTION_PROPERTY = "org.jpox.rdbms.query.fetchDirection";
0346:
0347:            /** Property for allow/disallow all SQL statements. */
0348:            public static final String QUERY_ALLOW_ALL_SQL_STATEMENTS = "org.jpox.rdbms.sql.allowAllSQLStatements";
0349:
0350:            /** Property for how many times to retry the addition of a class to the store management. */
0351:            public static final String DATASTORE_CLASS_ADDITION_MAX_RETRIES_PROPERTY = "org.jpox.rdbms.classAdditionMaxRetries";
0352:
0353:            /** Property for name of the registered connection provider. */
0354:            public static final String CONNECTION_PROVIDER_NAME_PROPERTY = "org.jpox.store.connectionProvider.Name";
0355:
0356:            /** Property for failOnError setting. */
0357:            public static final String CONNECTION_PROVIDER_FAILONERROR_PROPERTY = "org.jpox.store.connectionProvider.FailOnError";
0358:
0359:            /** Property for a primary ClassLoader setting. */
0360:            public static final String PRIMARY_CLASS_LOADER_PROPERTY = "org.jpox.primaryClassLoader";
0361:
0362:            /** Property defining the resource type for the connection. */
0363:            public static final String CONNECTION_RESOURCE_TYPE = "org.jpox.connection.resourceType";
0364:
0365:            /** Property defining the resource type for the connection 2. */
0366:            public static final String CONNECTION2_RESOURCE_TYPE = "org.jpox.connection2.resourceType";
0367:
0368:            // ----------------------------------- RDBMS-specific properties --------------------------------------------
0369:
0370:            /** Property defining the type of joins to use on a query/queries. */
0371:            public static final String QUERY_JOIN_TYPE_PROPERTY = "org.jpox.rdbms.jdoql.joinType";
0372:
0373:            /** Property defining the whether to apply constraints to the exists clause. */
0374:            public static final String QUERY_EXISTS_INCLUDES_PROPERTY = "org.jpox.rdbms.jdoql.existsIncludesConstraints";
0375:
0376:            /** Property defining the whether to use EXISTS with contains clause. */
0377:            public static final String QUERY_CONTAINS_EXISTS_ALWAYS_PROPERTY = "org.jpox.rdbms.query.containsUsesExistsAlways";
0378:
0379:            /** Property defining the type of result set to create (RDBMS datastores). */
0380:            public static final String QUERY_RESULT_SET_TYPE_PROPERTY = "org.jpox.rdbms.query.resultSetType";
0381:
0382:            /** Property defining the concurrency of the result set (RDBMS datastores). */
0383:            public static final String QUERY_RESULT_SET_CONCURRENCY_PROPERTY = "org.jpox.rdbms.query.resultSetConcurrency";
0384:
0385:            /** Property for the maximum number of statements that can be batched (0 = no batching) RDBMS datastores. */
0386:            public static final String STATEMENT_BATCH_LIMIT_PROPERTY = "org.jpox.rdbms.statementBatchLimit";
0387:
0388:            /** Property defining whether to use "SELECT ... FOR UPDATE" to fetch objects when using READ COMMITTED or lower (RDBMS datastores). */
0389:            public static final String USE_UPDATE_LOCK_PROPERTY = "org.jpox.rdbms.useUpdateLock";
0390:
0391:            /** The system property that defines the mode of creation of RDBMS constraints. */
0392:            public static final String RDBMS_CONSTRAINT_CREATE_MODE_PROPERTY = "org.jpox.rdbms.constraintCreateMode";
0393:
0394:            /** Property defining whether to add unique constraints to the element table for a map inverse field (RDBMS datastores). */
0395:            public static final String ADD_UNIQUE_CONSTRAINT_MAP_INVERSE_PROPERTY = "org.jpox.rdbms.uniqueConstraints.mapInverse";
0396:
0397:            /** Property defining to what level to initialise column info when validating. */
0398:            public static final String INITIALIZE_COLUMN_INFO_PROPERTY = "org.jpox.rdbms.initializeColumnInfo";
0399:
0400:            /** Property for whether to check if the table/view exists. */
0401:            public static final String CHECK_EXIST_TABLES_VIEWS_PROPERTY = "org.jpox.rdbms.CheckExistTablesOrViews";
0402:
0403:            /** Property defining the default string length when storing a String type in the datastore and no length given (RDBMS datastores). */
0404:            public static final String STRING_DEFAULT_LENGTH_PROPERTY = "org.jpox.rdbms.stringDefaultLength";
0405:
0406:            /** Property defining the action when persisting a String too long for the datastore column (RDBMS datastores). */
0407:            public static final String STRING_LENGTH_ACTION_PROPERTY = "org.jpox.rdbms.stringLengthExceededAction";
0408:
0409:            /** Property defining if we should persist an empty string as null in the datastore. */
0410:            public static final String PERSIST_EMPTY_STRING_AS_NULL_PROPERTY = "org.jpox.rdbms.persistEmptyStringAsNull";
0411:
0412:            /** Property defining if we should have a discriminator col per subclass (backwards compatibility only). */
0413:            public static final String DISCRIMINATOR_PER_SUBCLASSTABLE_PROPERTY = "org.jpox.rdbms.discriminatorPerSubclassTable";
0414:
0415:            /** Property defining the sort order for Oracle datastores. */
0416:            public static final String ORACLE_SORT_ORDER_PROPERTY = "org.jpox.rdbms.oracleNlsSortOrder";
0417:
0418:            // ----------------------------------- DB4O-specific properties --------------------------------------------
0419:
0420:            /** Property defining the DB4O output file. */
0421:            public static final String DB4O_OUTPUT_FILE_PROPERTY = "org.jpox.db4o.outputFile";
0422:
0423:            /** Property defining whether to flush DB4O file buffers on commit. */
0424:            public static final String DB4O_FLUSH_BUFFERS_PROPERTY = "org.jpox.db4o.flushFileBuffers";
0425:
0426:            /** Property defining whether to generate UUIDs for all classes. */
0427:            public static final String DB4O_GENERATE_UUIDS_PROPERTY = "org.jpox.db4o.generateUUIDs";
0428:
0429:            /** Interface allowing setting properties on a persistence factory with String property values. */
0430:            protected interface StringPropertySetter {
0431:                /**
0432:                 * Set this property on the given PersistenceManagerFactoryImpl to the String value.
0433:                 * @param configuration The PersistenceConfiguration to set the value on.
0434:                 * @param value The String value to set.
0435:                 */
0436:                void set(PersistenceConfiguration configuration, String value);
0437:            }
0438:
0439:            /** Interface allowing setting properties on a persistence factory with Object property values. */
0440:            protected interface ObjectPropertySetter {
0441:                /**
0442:                 * Set this property on the given PersistenceManagerFactoryImpl to the Object value.
0443:                 * @param configuration The PersistenceConfiguration to set the value on.
0444:                 * @param value The Object value to set.
0445:                 */
0446:                void set(PersistenceConfiguration configuration, Object value);
0447:            }
0448:
0449:            /** A Map mapping property name to the corresponding PropertySetter. */
0450:            private final Map PROPERTY_SETTERS = initPropertySetters();
0451:
0452:            /** options given when this configuration was constructed */
0453:            private Map options;
0454:
0455:            private Calendar dateTimezoneCalendar = null;
0456:
0457:            // JDO standard properties
0458:            private String driverName = null;
0459:            private String url = null;
0460:            private String userName = null;
0461:            private String password = null;
0462:            private Object connectionFactory = null;
0463:            private String connectionFactoryName = null;
0464:            private Object connectionFactory2 = null;
0465:            private String connectionFactory2Name = null;
0466:            private boolean multithreaded = false;
0467:            private boolean optimistic = false;
0468:            private boolean retainValues = false;
0469:            private boolean restoreValues = false;
0470:            private boolean nontransactionalRead = false;
0471:            private boolean nontransactionalWrite = false;
0472:            private boolean ignoreCache = false;
0473:            private boolean detachAllOnCommit = false;
0474:            private boolean copyOnAttach = true;
0475:            private String catalogName = null;
0476:            private String schemaName = null;
0477:            private String mapping = null;
0478:            private String transactionType = null;
0479:            private Boolean jca = null; //whether running using JCA connector
0480:
0481:            private String serverTimeZoneID = null;
0482:
0483:            // JPA properties
0484:            private boolean jpaOneToManyUniFkRelations = false;
0485:
0486:            /** Name of the persistence factory (if any). */
0487:            private String name = null;
0488:
0489:            /** Name of the persistence unit being managed here. */
0490:            private String persistenceUnitName = null;
0491:
0492:            /** Persistence API */
0493:            private String persistenceApiName = "JDO";
0494:
0495:            /** Whether to provide a managed runtime. */
0496:            private Boolean managedRuntime = Boolean.FALSE;
0497:
0498:            /** StoreManager type (jdbc, db4o etc) */
0499:            private String storeManagerType = null;
0500:
0501:            // Query
0502:            private boolean queryFlushBeforeExecution = false;
0503:            private boolean queryUseFetchPlan = true;
0504:            private int queryTimeout = 0;
0505:            private String queryFetchDirection = "forward";
0506:            private String queryResultSetType = "forward-only";
0507:            private String queryResultSetConcurrency = "read-only";
0508:            private boolean queryAllowAllSQLStatements = false;
0509:            private String queryJoinType = null;
0510:            private boolean queryExistsIncludesConstraints = true;
0511:            private boolean queryContainsUsesExistsAlways = false;
0512:
0513:            private String oracleNlsSortOrder = "LATIN";
0514:
0515:            // Types
0516:            private final static int JDO2_STRING_DEFAULT_LENGTH = 256;
0517:            private int stringDefaultLength = JDO2_STRING_DEFAULT_LENGTH;
0518:            private String stringLengthExceededAction = "EXCEPTION";
0519:            private boolean persistEmptyStringAsNull = false;
0520:
0521:            private boolean discriminatorPerSubclassTable = false;
0522:
0523:            // Persistence control
0524:            private boolean manageRelationships = true;
0525:            private boolean manageRelationshipsChecks = true;
0526:            private boolean detachOnClose = false;
0527:            private boolean findObjectCheckInheritance = true;
0528:            private boolean attachSameDatastore = false;
0529:            private boolean persistenceByReachabilityAtCommit = true;
0530:            private int maxFetchDepth = 1; // JDO2 default is 1
0531:            private String classLoaderResolverName = "jdo";
0532:            private ClassLoader primaryClassLoader = null;
0533:            private String implementationCreatorName = "asm";
0534:            private String datastoreIdentityClassName = "jpox";
0535:
0536:            // Schema
0537:            private String datastoreAdapterClassName = null;
0538:            private boolean useUpdateLock = false;
0539:            private int datastoreClassAdditionMaxRetries = 3;
0540:            private boolean uniqueConstraintsMapInverse = true;
0541:            private String defaultInheritanceStrategy = "JDO2";
0542:            private String identifierFactory = "jpox";
0543:            private String identifierCase = "UpperCase";
0544:            private String identifierWordSeparator = null;
0545:            private String identifierTablePrefix = null;
0546:            private String identifierTableSuffix = null;
0547:            private boolean readOnlyDatastore = false;
0548:            private String readOnlyDatastoreAction = "EXCEPTION";
0549:            private boolean fixedDatastore = false;
0550:            private String rdbmsConstraintCreateMode = "JPOX";
0551:            private String deletionPolicy = "JDO2";
0552:            private boolean checkExistTablesOrViews = true;
0553:            private boolean validateTables = true;
0554:            private boolean validateColumns = true;
0555:            private boolean validateConstraints = true;
0556:            private boolean autoCreateTables = false;
0557:            private boolean autoCreateColumns = false;
0558:            private boolean autoCreateConstraints = false;
0559:            private boolean autoCreateWarnOnError = false;
0560:            private String initializeColumnInfo = "ALL";
0561:            private int statementBatchLimit = 50;
0562:
0563:            // Autostart
0564:            private String autoStartMechanism = null; // Let StoreManager decide the default if not specified by user
0565:            private String autoStartMechanismXmlFile = "jpoxAutoStart.xml";
0566:            private String autoStartMechanismMode = AutoStartMechanism.MODE_QUIET;
0567:            private String autoStartClassNames = null;
0568:
0569:            // Transactions/Connections
0570:            private int isolationLevel = UserTransaction.TRANSACTION_READ_COMMITTED;
0571:            private String jtaLocator = null;
0572:            private String jtaJndiLocation = null;
0573:            private int poidIsolationLevel = UserTransaction.TRANSACTION_READ_COMMITTED;
0574:            private String poidTransactionAttribute = "New";
0575:
0576:            private int datastoreTransactionFlushLimit = 1;
0577:            private boolean datastoreTransactionDelayOperations = false;
0578:
0579:            private String connectionPoolingType = "None";
0580:            private String connectionPoolingConfigurationFile = null;
0581:
0582:            // Cache
0583:            private boolean cacheCollections = true;
0584:            private Boolean cacheCollectionsLazy;
0585:            private String cacheLevel1Type = "weak";
0586:            private boolean cacheLevel2 = false; // L2 cache defaults to OFF
0587:            private String cacheLevel2Type = "default";
0588:            private String cacheLevel2CacheName = null;
0589:            private String cacheLevel2ConfigurationFile = null;
0590:
0591:            // MetaData
0592:            private String jdoMetaDataFileExtension = "jdo";
0593:            private String ormMetaDataFileExtension = "orm";
0594:            private String jdoqueryMetaDataFileExtension = "jdoquery";
0595:            private boolean metadataValidate = true;
0596:            private String metadataAnnotationsManager = "org.jpox.metadata.annotations.AnnotationManagerImpl";
0597:
0598:            // Properties
0599:            private String propertiesFileName = null;
0600:
0601:            // Plug-in
0602:            private String pluginRegistryClassName = null;
0603:            private String pluginRegistryBundleCheck = "EXCEPTION";
0604:
0605:            protected transient boolean configurable = true;
0606:
0607:            // ConnectionProvider
0608:            private String connectionProviderName = "PriorityList";
0609:            private boolean connectionProviderFailOnError = false;
0610:
0611:            // Connection
0612:            private String connectionResourceType = null;
0613:            private String connection2ResourceType = null;
0614:
0615:            // DB4O
0616:            private String db4oOutputFile = null;
0617:            private boolean db4oFlushFileBuffers = true;
0618:            private boolean db4oGenerateUUIDs = false;
0619:
0620:            /** Whether to include codes in messages. */
0621:            private boolean messagesIncludeCodes = true;
0622:
0623:            /**
0624:             * Constructor.
0625:             * Initialises all properties using the System property values. This behaviour
0626:             * is not specified by the JDO spec(s) but is a nice to have capability allowing
0627:             * users to define command line args to set up their (single) persistence factory.
0628:             */
0629:            public PersistenceConfiguration() {
0630:                try {
0631:                    // Schema Management
0632:                    datastoreAdapterClassName = System
0633:                            .getProperty(DATASTORE_ADAPTER_CLASSNAME_PROPERTY);
0634:
0635:                    validateTables = new Boolean(System.getProperty(
0636:                            VALIDATE_TABLES_PROPERTY, "true")).booleanValue();
0637:                    validateColumns = new Boolean(System.getProperty(
0638:                            VALIDATE_COLUMNS_PROPERTY, "true")).booleanValue();
0639:                    validateConstraints = new Boolean(System.getProperty(
0640:                            VALIDATE_CONSTRAINTS_PROPERTY, "true"))
0641:                            .booleanValue();
0642:                    initializeColumnInfo = System.getProperty(
0643:                            INITIALIZE_COLUMN_INFO_PROPERTY, "ALL");
0644:                    if (!validateTables) {
0645:                        // Can't validate columns if not validating the table!
0646:                        validateColumns = false;
0647:                    }
0648:
0649:                    autoCreateTables = new Boolean(System.getProperty(
0650:                            AUTO_CREATE_TABLES_PROPERTY, "false"))
0651:                            .booleanValue();
0652:                    autoCreateColumns = new Boolean(System.getProperty(
0653:                            AUTO_CREATE_COLUMNS_PROPERTY, "false"))
0654:                            .booleanValue();
0655:                    autoCreateConstraints = new Boolean(System.getProperty(
0656:                            AUTO_CREATE_CONSTRAINTS_PROPERTY, "false"))
0657:                            .booleanValue();
0658:                    setAutoCreateSchema(new Boolean(System.getProperty(
0659:                            AUTO_CREATE_SCHEMA_PROPERTY, "false"))
0660:                            .booleanValue());
0661:
0662:                    autoCreateWarnOnError = new Boolean(System.getProperty(
0663:                            AUTO_CREATE_WARN_ON_ERROR_PROPERTY, "false"))
0664:                            .booleanValue();
0665:
0666:                    setReadOnlyDatastore(readOnlyDatastore = new Boolean(System
0667:                            .getProperty(READ_ONLY_DATASTORE_PROPERTY, "false"))
0668:                            .booleanValue());
0669:                    if (System.getProperty(READ_ONLY_DATASTORE_ACTION_PROPERTY) != null) {
0670:                        setReadOnlyDatastoreAction(System
0671:                                .getProperty(READ_ONLY_DATASTORE_ACTION_PROPERTY));
0672:                    }
0673:                    setFixedDatastore(new Boolean(System.getProperty(
0674:                            FIXED_DATASTORE_PROPERTY, "false")).booleanValue());
0675:
0676:                    String datastoreClassAdditionMaxRetriesString = System
0677:                            .getProperty(DATASTORE_CLASS_ADDITION_MAX_RETRIES_PROPERTY);
0678:                    if (datastoreClassAdditionMaxRetriesString != null) {
0679:                        try {
0680:                            datastoreClassAdditionMaxRetries = (new Integer(
0681:                                    datastoreClassAdditionMaxRetriesString))
0682:                                    .intValue();
0683:                        } catch (NumberFormatException nfe) {
0684:                            // Do nothing and use default.
0685:                        }
0686:                    }
0687:
0688:                    mapping = System.getProperty(JDO_MAPPING_PROPERTY);
0689:                    catalogName = System
0690:                            .getProperty(JDO_MAPPING_CATALOG_PROPERTY);
0691:                    schemaName = System
0692:                            .getProperty(JDO_MAPPING_SCHEMA_PROPERTY);
0693:                    setTransactionType(System.getProperty(
0694:                            JDO_TRANSACTION_TYPE_PROPERTY, transactionType));
0695:                    name = System.getProperty(JDO_NAME_PROPERTY);
0696:                    persistenceUnitName = System
0697:                            .getProperty(JDO_PERSISTENCE_UNIT_NAME_PROPERTY);
0698:
0699:                    persistenceApiName = System.getProperty(
0700:                            PERSISTENCE_API_NAME, "JDO");
0701:                    storeManagerType = System.getProperty(STORE_MANAGER_TYPE);
0702:                    String propValue = System
0703:                            .getProperty(MANAGED_RUNTIME_PROPERTY);
0704:                    if (propValue != null) {
0705:                        if (propValue.equalsIgnoreCase("true")) {
0706:                            managedRuntime = Boolean.TRUE;
0707:                        }
0708:                    }
0709:
0710:                    if (readOnlyDatastore || fixedDatastore) {
0711:                        if (autoCreateTables) {
0712:                            JPOXLogger.PERSISTENCE.warn(LOCALISER.msg("008011",
0713:                                    "autoCreateTables"));
0714:                            autoCreateTables = false;
0715:                        }
0716:                        if (autoCreateColumns) {
0717:                            JPOXLogger.PERSISTENCE.warn(LOCALISER.msg("008011",
0718:                                    "autoCreateColumns"));
0719:                            autoCreateColumns = false;
0720:                        }
0721:                        if (autoCreateConstraints) {
0722:                            JPOXLogger.PERSISTENCE.warn(LOCALISER.msg("008011",
0723:                                    "autoCreateConstraints"));
0724:                            autoCreateConstraints = false;
0725:                        }
0726:                    }
0727:                    if (System
0728:                            .getProperty(RDBMS_CONSTRAINT_CREATE_MODE_PROPERTY) != null) {
0729:                        setRDBMSConstraintCreateMode(System
0730:                                .getProperty(RDBMS_CONSTRAINT_CREATE_MODE_PROPERTY));
0731:                    }
0732:
0733:                    deletionPolicy = System.getProperty(
0734:                            DELETION_POLICY_PROPERTY, "JDO2");
0735:
0736:                    identifierFactory = System.getProperty(
0737:                            IDENTIFIER_FACTORY_PROPERTY, "jpox");
0738:                    identifierCase = System.getProperty(
0739:                            IDENTIFIER_CASE_PROPERTY, "UpperCase");
0740:                    if (System.getProperty(IDENTIFIER_WORD_SEPARATOR_PROPERTY) != null) {
0741:                        setIdentifierWordSeparator(System
0742:                                .getProperty(IDENTIFIER_WORD_SEPARATOR_PROPERTY));
0743:                    }
0744:                    if (System.getProperty(IDENTIFIER_TABLE_PREFIX_PROPERTY) != null) {
0745:                        setIdentifierTablePrefix(System
0746:                                .getProperty(IDENTIFIER_TABLE_PREFIX_PROPERTY));
0747:                    }
0748:                    if (System.getProperty(IDENTIFIER_TABLE_SUFFIX_PROPERTY) != null) {
0749:                        setIdentifierTableSuffix(System
0750:                                .getProperty(IDENTIFIER_TABLE_SUFFIX_PROPERTY));
0751:                    }
0752:
0753:                    // JDO operation
0754:                    classLoaderResolverName = System.getProperty(
0755:                            CLASS_LOADER_RESOLVER_NAME_PROPERTY, "jdo");
0756:                    datastoreIdentityClassName = System.getProperty(
0757:                            DATASTORE_IDENTITY_CLASS_NAME_PROPERTY, "jpox");
0758:
0759:                    connectionPoolingType = System.getProperty(
0760:                            CONNECTION_POOLING_TYPE_PROPERTY, "None");
0761:                    connectionPoolingConfigurationFile = System
0762:                            .getProperty(CONNECTION_POOLING_CONFIGURATION_FILE_PROPERTY);
0763:
0764:                    defaultInheritanceStrategy = System.getProperty(
0765:                            DEFAULT_INHERITANCE_STRATEGY_PROPERTY, "JDO2");
0766:                    autoStartMechanism = System
0767:                            .getProperty(AUTO_START_MECHANISM_PROPERTY);
0768:                    autoStartMechanismXmlFile = System.getProperty(
0769:                            AUTO_START_MECHANISM_XML_FILE_PROPERTY,
0770:                            "jpoxAutoStart.xml");
0771:                    autoStartMechanismMode = System.getProperty(
0772:                            AUTO_START_MECHANISM_MODE_PROPERTY,
0773:                            AutoStartMechanism.MODE_QUIET);
0774:                    autoStartClassNames = System
0775:                            .getProperty(AUTO_START_CLASS_NAMES_PROPERTY);
0776:                    poidTransactionAttribute = System.getProperty(
0777:                            POID_TRANSACTION_ATTRIBUTE_PROPERTY, "New");
0778:
0779:                    // Schema identifiers
0780:                    if (System.getProperty(IDENTIFIER_CASE_PROPERTY) != null) {
0781:                        setIdentifierCase(System
0782:                                .getProperty(IDENTIFIER_CASE_PROPERTY));
0783:                    }
0784:
0785:                    // MetaData files
0786:                    String extension = System
0787:                            .getProperty(METADATA_JDO_FILE_EXTENSION_PROPERTY);
0788:                    if (!StringUtils.isWhitespace(extension)) {
0789:                        jdoMetaDataFileExtension = extension;
0790:                    }
0791:                    extension = System
0792:                            .getProperty(METADATA_ORM_FILE_EXTENSION_PROPERTY);
0793:                    if (!StringUtils.isWhitespace(extension)) {
0794:                        ormMetaDataFileExtension = extension;
0795:                    }
0796:                    extension = System
0797:                            .getProperty(METADATA_JDOQUERY_FILE_EXTENSION_PROPERTY);
0798:                    if (!StringUtils.isWhitespace(extension)) {
0799:                        jdoqueryMetaDataFileExtension = extension;
0800:                    }
0801:                    metadataValidate = new Boolean(System.getProperty(
0802:                            METADATA_VALIDATE_PROPERTY, "true")).booleanValue();
0803:                    extension = System
0804:                            .getProperty(METADATA_ANNOTATIONS_MANAGER_PROPERTY);
0805:                    if (!StringUtils.isWhitespace(extension)) {
0806:                        metadataAnnotationsManager = extension;
0807:                    }
0808:
0809:                    // Caching
0810:                    cacheCollections = new Boolean(System.getProperty(
0811:                            CACHE_COLLECTIONS_PROPERTY, "true")).booleanValue();
0812:                    if (System.getProperty(CACHE_COLLECTIONS_LAZY_PROPERTY) != null) {
0813:                        cacheCollectionsLazy = new Boolean(System
0814:                                .getProperty(CACHE_COLLECTIONS_LAZY_PROPERTY));
0815:                    }
0816:                    cacheLevel1Type = System.getProperty(
0817:                            CACHE_LEVEL_1_TYPE_PROPERTY, "weak");
0818:                    cacheLevel2 = new Boolean(System.getProperty(
0819:                            CACHE_LEVEL_2_PROPERTY, "false")).booleanValue();
0820:                    cacheLevel2Type = System.getProperty(
0821:                            CACHE_LEVEL_2_TYPE_PROPERTY, "default");
0822:                    cacheLevel2CacheName = System
0823:                            .getProperty(CACHE_LEVEL_2_CACHE_NAME_PROPERTY);
0824:                    cacheLevel2ConfigurationFile = System
0825:                            .getProperty(CACHE_LEVEL_2_CONFIGURATION_FILE_PROPERTY);
0826:
0827:                    // Queries
0828:                    queryFlushBeforeExecution = new Boolean(System.getProperty(
0829:                            QUERY_FLUSH_BEFORE_EXECUTION_PROPERTY, "false"))
0830:                            .booleanValue();
0831:                    queryUseFetchPlan = new Boolean(System.getProperty(
0832:                            QUERY_USE_FETCH_PLAN_PROPERTY, "true"))
0833:                            .booleanValue();
0834:                    String queryTimeoutString = System
0835:                            .getProperty(QUERY_TIMEOUT_PROPERTY);
0836:                    if (queryTimeoutString != null) {
0837:                        try {
0838:                            queryTimeout = (new Integer(queryTimeoutString))
0839:                                    .intValue();
0840:                        } catch (NumberFormatException nfe) {
0841:                            // Do nothing and use default.
0842:                        }
0843:                    }
0844:                    queryFetchDirection = System.getProperty(
0845:                            QUERY_FETCH_DIRECTION_PROPERTY, "forward");
0846:                    queryResultSetType = System.getProperty(
0847:                            QUERY_RESULT_SET_TYPE_PROPERTY, "forward-only");
0848:                    queryResultSetConcurrency = System.getProperty(
0849:                            QUERY_RESULT_SET_CONCURRENCY_PROPERTY, "read-only");
0850:                    queryAllowAllSQLStatements = new Boolean(System
0851:                            .getProperty(QUERY_ALLOW_ALL_SQL_STATEMENTS,
0852:                                    "false")).booleanValue();
0853:                    queryJoinType = System
0854:                            .getProperty(QUERY_JOIN_TYPE_PROPERTY);
0855:                    queryExistsIncludesConstraints = new Boolean(
0856:                            System.getProperty(QUERY_EXISTS_INCLUDES_PROPERTY,
0857:                                    "true")).booleanValue();
0858:                    queryContainsUsesExistsAlways = new Boolean(System
0859:                            .getProperty(QUERY_CONTAINS_EXISTS_ALWAYS_PROPERTY,
0860:                                    "false")).booleanValue();
0861:
0862:                    // Types
0863:                    String stringLengthTemp = System
0864:                            .getProperty(STRING_DEFAULT_LENGTH_PROPERTY);
0865:                    if (stringLengthTemp != null) {
0866:                        try {
0867:                            stringDefaultLength = (new Integer(stringLengthTemp))
0868:                                    .intValue();
0869:                        } catch (NumberFormatException nfe) {
0870:                            stringDefaultLength = JDO2_STRING_DEFAULT_LENGTH;
0871:                        }
0872:                    }
0873:                    stringLengthExceededAction = System.getProperty(
0874:                            STRING_LENGTH_ACTION_PROPERTY, "EXCEPTION");
0875:                    persistEmptyStringAsNull = new Boolean(System.getProperty(
0876:                            PERSIST_EMPTY_STRING_AS_NULL_PROPERTY, "false"))
0877:                            .booleanValue();
0878:                    discriminatorPerSubclassTable = new Boolean(System
0879:                            .getProperty(
0880:                                    DISCRIMINATOR_PER_SUBCLASSTABLE_PROPERTY,
0881:                                    "false")).booleanValue();
0882:                    oracleNlsSortOrder = System.getProperty(
0883:                            ORACLE_SORT_ORDER_PROPERTY, "LATIN");
0884:
0885:                    //ConnectionProvider
0886:                    connectionProviderName = System.getProperty(
0887:                            CONNECTION_PROVIDER_NAME_PROPERTY, "PriorityList");
0888:                    connectionProviderFailOnError = new Boolean(System
0889:                            .getProperty(
0890:                                    CONNECTION_PROVIDER_FAILONERROR_PROPERTY,
0891:                                    "false")).booleanValue();
0892:
0893:                    setPropertiesFile(System.getProperty(PROPERTIES_FILE));
0894:
0895:                    // Connection properties
0896:                    connectionResourceType = System
0897:                            .getProperty(CONNECTION_RESOURCE_TYPE);
0898:                    connection2ResourceType = System
0899:                            .getProperty(CONNECTION2_RESOURCE_TYPE);
0900:
0901:                    // DB4O properties
0902:                    db4oOutputFile = System
0903:                            .getProperty(DB4O_OUTPUT_FILE_PROPERTY);
0904:                    db4oFlushFileBuffers = new Boolean(System.getProperty(
0905:                            DB4O_FLUSH_BUFFERS_PROPERTY, "true"))
0906:                            .booleanValue();
0907:                    db4oGenerateUUIDs = new Boolean(System.getProperty(
0908:                            DB4O_GENERATE_UUIDS_PROPERTY, "false"))
0909:                            .booleanValue();
0910:
0911:                    // Plugin resources
0912:                    pluginRegistryClassName = System
0913:                            .getProperty(PLUGIN_REGISTRY_CLASS_NAME);
0914:                    pluginRegistryBundleCheck = System.getProperty(
0915:                            PLUGIN_REGISTRY_BUNDLE_CHECK, "EXCEPTION");
0916:                } catch (Exception e) {
0917:                    // May arrive here if the server throws a SecurityException
0918:                    JPOXLogger.PERSISTENCE.error(e);
0919:                }
0920:            }
0921:
0922:            /**
0923:             * Equality operator.
0924:             * @param obj Object to compare against.
0925:             * @return Whether the objects are equal.
0926:             **/
0927:            public synchronized boolean equals(Object obj) {
0928:                if (obj == this ) {
0929:                    return true;
0930:                }
0931:                if (!(obj instanceof  PersistenceConfiguration)) {
0932:                    return false;
0933:                }
0934:
0935:                PersistenceConfiguration config = (PersistenceConfiguration) obj;
0936:
0937:                boolean isEquals = true;
0938:                isEquals = isEquals
0939:                        & equalsVariable(driverName, config.driverName);
0940:                isEquals = isEquals & equalsVariable(url, config.url);
0941:                isEquals = isEquals & equalsVariable(userName, config.userName);
0942:                isEquals = isEquals & equalsVariable(password, config.password);
0943:                isEquals = isEquals
0944:                        & equalsVariable(connectionFactory,
0945:                                config.connectionFactory);
0946:                isEquals = isEquals
0947:                        & equalsVariable(connectionFactoryName,
0948:                                config.connectionFactoryName);
0949:                isEquals = isEquals
0950:                        & equalsVariable(connectionFactory2,
0951:                                config.connectionFactory2);
0952:                isEquals = isEquals
0953:                        & equalsVariable(connectionFactory2Name,
0954:                                config.connectionFactory2Name);
0955:                isEquals = isEquals & equalsVariable(mapping, config.mapping);
0956:                isEquals = isEquals
0957:                        & equalsVariable(catalogName, config.catalogName);
0958:                isEquals = isEquals
0959:                        & equalsVariable(schemaName, config.schemaName);
0960:                isEquals = isEquals
0961:                        & equalsVariable(transactionType,
0962:                                config.transactionType);
0963:                isEquals = isEquals
0964:                        & equalsVariable(serverTimeZoneID,
0965:                                config.serverTimeZoneID);
0966:
0967:                isEquals = isEquals & equalsVariable(name, config.name);
0968:                isEquals = isEquals
0969:                        & equalsVariable(persistenceUnitName,
0970:                                config.persistenceUnitName);
0971:
0972:                isEquals = isEquals
0973:                        & equalsVariable(storeManagerType,
0974:                                config.storeManagerType);
0975:                isEquals = isEquals
0976:                        & equalsVariable(managedRuntime, config.managedRuntime);
0977:                isEquals = isEquals
0978:                        & equalsVariable(persistenceApiName,
0979:                                config.persistenceApiName);
0980:
0981:                isEquals = isEquals
0982:                        & equalsVariable(cacheLevel1Type,
0983:                                config.cacheLevel1Type);
0984:                isEquals = isEquals
0985:                        & equalsVariable(cacheLevel2Type,
0986:                                config.cacheLevel2Type);
0987:                isEquals = isEquals
0988:                        & equalsVariable(cacheLevel2CacheName,
0989:                                config.cacheLevel2CacheName);
0990:                isEquals = isEquals
0991:                        & equalsVariable(cacheLevel2ConfigurationFile,
0992:                                config.cacheLevel2ConfigurationFile);
0993:                isEquals = isEquals & (cacheLevel2 == config.cacheLevel2);
0994:                isEquals = isEquals
0995:                        & (cacheCollections == config.cacheCollections);
0996:                isEquals = isEquals
0997:                        & (cacheCollectionsLazy == config.cacheCollectionsLazy);
0998:
0999:                isEquals = isEquals
1000:                        & equalsVariable(datastoreAdapterClassName,
1001:                                config.datastoreAdapterClassName);
1002:                isEquals = isEquals
1003:                        & equalsVariable(autoStartMechanism,
1004:                                config.autoStartMechanism);
1005:                isEquals = isEquals
1006:                        & equalsVariable(autoStartMechanismXmlFile,
1007:                                config.autoStartMechanismXmlFile);
1008:                isEquals = isEquals
1009:                        & equalsVariable(autoStartMechanismMode,
1010:                                config.autoStartMechanismMode);
1011:                isEquals = isEquals
1012:                        & equalsVariable(autoStartClassNames,
1013:                                config.autoStartClassNames);
1014:
1015:                isEquals = isEquals
1016:                        & equalsVariable(poidTransactionAttribute,
1017:                                config.poidTransactionAttribute);
1018:                isEquals = isEquals
1019:                        & (checkExistTablesOrViews == config.checkExistTablesOrViews);
1020:                isEquals = isEquals
1021:                        & equalsVariable(defaultInheritanceStrategy,
1022:                                config.defaultInheritanceStrategy);
1023:                isEquals = isEquals
1024:                        & (stringDefaultLength == config.stringDefaultLength);
1025:                isEquals = isEquals
1026:                        & equalsVariable(stringLengthExceededAction,
1027:                                config.stringLengthExceededAction);
1028:                isEquals = isEquals
1029:                        & (persistEmptyStringAsNull == config.persistEmptyStringAsNull);
1030:                isEquals = isEquals
1031:                        & (discriminatorPerSubclassTable == config.discriminatorPerSubclassTable);
1032:                isEquals = isEquals
1033:                        & (statementBatchLimit == config.statementBatchLimit);
1034:                isEquals = isEquals
1035:                        & equalsVariable(oracleNlsSortOrder,
1036:                                config.oracleNlsSortOrder);
1037:
1038:                // MetaData
1039:                isEquals = isEquals
1040:                        & equalsVariable(jdoMetaDataFileExtension,
1041:                                config.jdoMetaDataFileExtension);
1042:                isEquals = isEquals
1043:                        & equalsVariable(ormMetaDataFileExtension,
1044:                                config.ormMetaDataFileExtension);
1045:                isEquals = isEquals
1046:                        & equalsVariable(jdoqueryMetaDataFileExtension,
1047:                                config.jdoqueryMetaDataFileExtension);
1048:                isEquals = isEquals
1049:                        & (metadataValidate == config.metadataValidate);
1050:                isEquals = isEquals
1051:                        & equalsVariable(metadataAnnotationsManager,
1052:                                config.metadataAnnotationsManager);
1053:
1054:                // query
1055:                isEquals = isEquals
1056:                        & (queryFlushBeforeExecution == config.queryFlushBeforeExecution);
1057:                isEquals = isEquals
1058:                        & (queryUseFetchPlan == config.queryUseFetchPlan);
1059:                isEquals = isEquals
1060:                        & (queryAllowAllSQLStatements == config.queryAllowAllSQLStatements);
1061:                isEquals = isEquals & (queryTimeout == config.queryTimeout);
1062:                isEquals = isEquals
1063:                        & equalsVariable(queryFetchDirection,
1064:                                config.queryFetchDirection);
1065:                isEquals = isEquals
1066:                        & equalsVariable(queryResultSetConcurrency,
1067:                                config.queryResultSetConcurrency);
1068:                isEquals = isEquals
1069:                        & equalsVariable(queryResultSetType,
1070:                                config.queryResultSetType);
1071:                isEquals = isEquals & (queryJoinType == config.queryJoinType);
1072:                isEquals = isEquals
1073:                        & (queryExistsIncludesConstraints == config.queryExistsIncludesConstraints);
1074:                isEquals = isEquals
1075:                        & (queryContainsUsesExistsAlways == config.queryContainsUsesExistsAlways);
1076:
1077:                isEquals = isEquals
1078:                        & (persistenceByReachabilityAtCommit == config.persistenceByReachabilityAtCommit);
1079:                isEquals = isEquals & (maxFetchDepth == config.maxFetchDepth);
1080:                isEquals = isEquals
1081:                        & (primaryClassLoader == config.primaryClassLoader);
1082:                isEquals = isEquals
1083:                        & equalsVariable(classLoaderResolverName,
1084:                                config.classLoaderResolverName);
1085:                isEquals = isEquals
1086:                        & equalsVariable(implementationCreatorName,
1087:                                config.implementationCreatorName);
1088:                isEquals = isEquals
1089:                        & equalsVariable(datastoreIdentityClassName,
1090:                                config.datastoreIdentityClassName);
1091:
1092:                isEquals = isEquals
1093:                        & equalsVariable(connectionPoolingType,
1094:                                config.connectionPoolingType);
1095:                isEquals = isEquals
1096:                        & equalsVariable(connectionPoolingConfigurationFile,
1097:                                config.connectionPoolingConfigurationFile);
1098:
1099:                isEquals = isEquals
1100:                        & (datastoreClassAdditionMaxRetries == config.datastoreClassAdditionMaxRetries);
1101:                isEquals = isEquals & (isolationLevel == config.isolationLevel);
1102:                isEquals = isEquals
1103:                        & equalsVariable(jtaLocator, config.jtaLocator);
1104:                isEquals = isEquals
1105:                        & equalsVariable(jtaJndiLocation,
1106:                                config.jtaJndiLocation);
1107:                isEquals = isEquals
1108:                        & (datastoreTransactionDelayOperations == config.datastoreTransactionDelayOperations);
1109:                isEquals = isEquals
1110:                        & (datastoreTransactionFlushLimit == config.datastoreTransactionFlushLimit);
1111:                isEquals = isEquals
1112:                        & (poidIsolationLevel == config.poidIsolationLevel);
1113:                isEquals = isEquals & (multithreaded == config.multithreaded);
1114:                isEquals = isEquals & (optimistic == config.optimistic);
1115:                isEquals = isEquals & (retainValues == config.retainValues);
1116:                isEquals = isEquals & (restoreValues == config.restoreValues);
1117:                isEquals = isEquals
1118:                        & (nontransactionalRead == config.nontransactionalRead);
1119:                isEquals = isEquals
1120:                        & (nontransactionalWrite == config.nontransactionalWrite);
1121:                isEquals = isEquals & (ignoreCache == config.ignoreCache);
1122:                isEquals = isEquals
1123:                        & (detachAllOnCommit == config.detachAllOnCommit);
1124:                isEquals = isEquals & (copyOnAttach == config.copyOnAttach);
1125:                isEquals = isEquals
1126:                        & (manageRelationships == config.manageRelationships);
1127:                isEquals = isEquals
1128:                        & (manageRelationshipsChecks == config.manageRelationshipsChecks);
1129:                isEquals = isEquals & (detachOnClose == config.detachOnClose);
1130:                isEquals = isEquals
1131:                        & (findObjectCheckInheritance == config.findObjectCheckInheritance);
1132:                isEquals = isEquals
1133:                        & (attachSameDatastore == config.attachSameDatastore);
1134:
1135:                isEquals = isEquals
1136:                        & (jpaOneToManyUniFkRelations == config.jpaOneToManyUniFkRelations);
1137:
1138:                //schema
1139:                isEquals = isEquals & (validateTables == config.validateTables);
1140:                isEquals = isEquals
1141:                        & (validateColumns == config.validateColumns);
1142:                isEquals = isEquals
1143:                        & (validateConstraints == config.validateConstraints);
1144:                isEquals = isEquals
1145:                        & (autoCreateTables == config.autoCreateTables);
1146:                isEquals = isEquals
1147:                        & (autoCreateColumns == config.autoCreateColumns);
1148:                isEquals = isEquals
1149:                        & (autoCreateConstraints == config.autoCreateConstraints);
1150:                isEquals = isEquals
1151:                        & (autoCreateWarnOnError == config.autoCreateWarnOnError);
1152:                isEquals = isEquals
1153:                        & equalsVariable(initializeColumnInfo,
1154:                                config.initializeColumnInfo);
1155:                isEquals = isEquals
1156:                        & (readOnlyDatastore == config.readOnlyDatastore);
1157:                isEquals = isEquals & (fixedDatastore == config.fixedDatastore);
1158:                isEquals = isEquals
1159:                        & equalsVariable(rdbmsConstraintCreateMode,
1160:                                config.rdbmsConstraintCreateMode);
1161:                isEquals = isEquals
1162:                        & equalsVariable(deletionPolicy, config.deletionPolicy);
1163:                isEquals = isEquals
1164:                        & (uniqueConstraintsMapInverse == config.uniqueConstraintsMapInverse);
1165:                isEquals = isEquals
1166:                        & equalsVariable(propertiesFileName,
1167:                                config.propertiesFileName);
1168:
1169:                //ConnectionProvider
1170:                isEquals = isEquals
1171:                        & equalsVariable(connectionProviderName,
1172:                                config.connectionProviderName);
1173:                isEquals = isEquals
1174:                        & (connectionProviderFailOnError == config.connectionProviderFailOnError);
1175:
1176:                // Connection
1177:                isEquals = isEquals
1178:                        & equalsVariable(connectionResourceType,
1179:                                config.connectionResourceType);
1180:                isEquals = isEquals
1181:                        & equalsVariable(connection2ResourceType,
1182:                                config.connection2ResourceType);
1183:
1184:                // DB4O
1185:                isEquals = isEquals
1186:                        & equalsVariable(db4oOutputFile, config.db4oOutputFile);
1187:                isEquals = isEquals
1188:                        & (db4oFlushFileBuffers == config.db4oFlushFileBuffers);
1189:                isEquals = isEquals
1190:                        & (db4oGenerateUUIDs == config.db4oGenerateUUIDs);
1191:
1192:                return isEquals;
1193:            }
1194:
1195:            /**
1196:             * Equals two variables testing for nulls
1197:             * @param var1 the first variable
1198:             * @param var2 the second variable
1199:             * @return true if equals
1200:             */
1201:            private boolean equalsVariable(Object var1, Object var2) {
1202:                if (var1 == null) {
1203:                    if (var2 != null) {
1204:                        return false;
1205:                    }
1206:                } else if (!var1.equals(var2)) {
1207:                    return false;
1208:                }
1209:                return true;
1210:            }
1211:
1212:            // ------------------------------ JDO Standard Getters/Setters --------------------------------
1213:
1214:            /**
1215:             * Set the user name for the data store connection.
1216:             * @param userName the user name for the data store connection.
1217:             */
1218:            public synchronized void setConnectionUserName(String userName) {
1219:                assertConfigurable();
1220:                this .userName = userName;
1221:            }
1222:
1223:            /**
1224:             * Get the user name for the data store connection.
1225:             * @return the user name for the data store connection.
1226:             */
1227:            public String getConnectionUserName() {
1228:                return userName;
1229:            }
1230:
1231:            /**
1232:             * Set the password for the data store connection.
1233:             * @param password the password for the data store connection.
1234:             */
1235:            public synchronized void setConnectionPassword(String password) {
1236:                assertConfigurable();
1237:                this .password = password;
1238:            }
1239:
1240:            /**
1241:             * Set the URL for the data store connection.
1242:             * @param url the URL for the data store connection.
1243:             */
1244:            public synchronized void setConnectionURL(String url) {
1245:                assertConfigurable();
1246:                this .url = url;
1247:            }
1248:
1249:            /**
1250:             * Get the URL for the data store connection.
1251:             * @return the URL for the data store connection.
1252:             */
1253:            public String getConnectionURL() {
1254:                return url;
1255:            }
1256:
1257:            /**
1258:             * Set the driver name for the data store connection.
1259:             * @param driverName the driver name for the data store connection.
1260:             */
1261:            public synchronized void setConnectionDriverName(String driverName) {
1262:                assertConfigurable();
1263:                this .driverName = driverName;
1264:            }
1265:
1266:            /**
1267:             * Get the driver name for the data store connection.
1268:             * @return the driver name for the data store connection.
1269:             */
1270:            public String getConnectionDriverName() {
1271:                return driverName;
1272:            }
1273:
1274:            /**
1275:             * Get the password for the data store connection.
1276:             * @return the password for the data store connection.
1277:             */
1278:            public String getConnectionPassword() {
1279:                return password;
1280:            }
1281:
1282:            /**
1283:             * Set the name for the data store connection factory.
1284:             * @param connectionFactoryName name of the data store connection factory.
1285:             */
1286:            public synchronized void setConnectionFactoryName(
1287:                    String connectionFactoryName) {
1288:                assertConfigurable();
1289:                this .connectionFactoryName = connectionFactoryName;
1290:            }
1291:
1292:            /**
1293:             * Get the name for the data store connection factory.
1294:             * @return the name of the data store connection factory.
1295:             */
1296:            public String getConnectionFactoryName() {
1297:                return connectionFactoryName;
1298:            }
1299:
1300:            /**
1301:             * Set the data store connection factory.  JDO implementations
1302:             * will support specific connection factories.  The connection
1303:             * factory interfaces are not part of the JDO specification.
1304:             * @param connectionFactory the data store connection factory.
1305:             */
1306:            public synchronized void setConnectionFactory(
1307:                    Object connectionFactory) {
1308:                assertConfigurable();
1309:                this .connectionFactory = connectionFactory;
1310:            }
1311:
1312:            /**
1313:             * Get the data store connection factory.
1314:             * @return the data store connection factory.
1315:             */
1316:            public Object getConnectionFactory() {
1317:                return connectionFactory;
1318:            }
1319:
1320:            /**
1321:             * Set the name for the second data store connection factory.  This is
1322:             * needed for managed environments to get nontransactional connections for
1323:             * optimistic transactions.
1324:             * @param connectionFactoryName name of the data store connection factory.
1325:             */
1326:            public synchronized void setConnectionFactory2Name(
1327:                    String connectionFactoryName) {
1328:                assertConfigurable();
1329:                this .connectionFactory2Name = connectionFactoryName;
1330:            }
1331:
1332:            /**
1333:             * Get the name for the second data store connection factory.  This is
1334:             * needed for managed environments to get nontransactional connections for
1335:             * optimistic transactions.
1336:             * @return the name of the data store connection factory.
1337:             */
1338:            public String getConnectionFactory2Name() {
1339:                return connectionFactory2Name;
1340:            }
1341:
1342:            /**
1343:             * Set the second data store connection factory.  This is
1344:             * needed for managed environments to get nontransactional connections for
1345:             * optimistic transactions.  JDO implementations
1346:             * will support specific connection factories.  The connection
1347:             * factory interfaces are not part of the JDO specification.
1348:             * @param connectionFactory the data store connection factory.
1349:             */
1350:            public synchronized void setConnectionFactory2(
1351:                    Object connectionFactory) {
1352:                assertConfigurable();
1353:                this .connectionFactory2 = connectionFactory;
1354:            }
1355:
1356:            /**
1357:             * Get the second data store connection factory.  This is
1358:             * needed for managed environments to get nontransactional connections for
1359:             * optimistic transactions.
1360:             * @return the data store connection factory.
1361:             */
1362:            public Object getConnectionFactory2() {
1363:                return connectionFactory2;
1364:            }
1365:
1366:            /**
1367:             * Set the default Multithreaded setting for all <tt>PersistenceManager</tt>
1368:             * instances obtained from this factory.
1369:             * @param flag the default Multithreaded setting.
1370:             */
1371:            public synchronized void setMultithreaded(boolean flag) {
1372:                assertConfigurable();
1373:                multithreaded = flag;
1374:            }
1375:
1376:            /**
1377:             * Get the default Multithreaded setting for all <tt>PersistenceManager</tt>
1378:             * instances obtained from this factory.
1379:             * @return the default Multithreaded setting.
1380:             */
1381:            public boolean getMultithreaded() {
1382:                return multithreaded;
1383:            }
1384:
1385:            /**
1386:             * Set the default Optimistic setting for all <tt>PersistenceManager</tt>
1387:             * instances obtained from this factory.
1388:             * @param flag the default Optimistic setting.
1389:             */
1390:            public synchronized void setOptimistic(boolean flag) {
1391:                assertConfigurable();
1392:                optimistic = flag;
1393:            }
1394:
1395:            /**
1396:             * Get the default Optimistic setting for all <tt>PersistenceManager</tt>
1397:             * instances obtained from this factory.
1398:             * @return the default Optimistic setting.
1399:             */
1400:            public boolean getOptimistic() {
1401:                return optimistic;
1402:            }
1403:
1404:            /**
1405:             * Set the default RetainValues setting for all <tt>PersistenceManager</tt>
1406:             * instances obtained from this factory.
1407:             * @param flag the default RetainValues setting.
1408:             */
1409:            public synchronized void setRetainValues(boolean flag) {
1410:                assertConfigurable();
1411:                retainValues = flag;
1412:            }
1413:
1414:            /**
1415:             * Get the default RetainValues setting for all <tt>PersistenceManager</tt>
1416:             * instances obtained from this factory.
1417:             * @return the default RetainValues setting.
1418:             */
1419:            public boolean getRetainValues() {
1420:                return retainValues;
1421:            }
1422:
1423:            /**
1424:             * Set the default RestoreValues setting for all <tt>PersistenceManager</tt>
1425:             * instances obtained from this factory.
1426:             * @param flag the default RestoreValues setting.
1427:             */
1428:            public synchronized void setRestoreValues(boolean flag) {
1429:                assertConfigurable();
1430:                restoreValues = flag;
1431:            }
1432:
1433:            /**
1434:             * Get the default RestoreValues setting for all <tt>PersistenceManager</tt>
1435:             * instances obtained from this factory.
1436:             * @return the default RestoreValues setting.
1437:             */
1438:            public boolean getRestoreValues() {
1439:                return restoreValues;
1440:            }
1441:
1442:            /**
1443:             * Set the default NontransactionalRead setting for all
1444:             * <tt>PersistenceManager</tt> instances obtained from this factory.
1445:             * @param flag the default NontransactionalRead setting.
1446:             */
1447:            public synchronized void setNontransactionalRead(boolean flag) {
1448:                assertConfigurable();
1449:                nontransactionalRead = flag;
1450:            }
1451:
1452:            /**
1453:             * Get the default NontransactionalRead setting for all
1454:             * <tt>PersistenceManager</tt> instances obtained from this factory.
1455:             * @return the default NontransactionalRead setting.
1456:             */
1457:            public boolean getNontransactionalRead() {
1458:                return nontransactionalRead;
1459:            }
1460:
1461:            /**
1462:             * Set the default NontransactionalWrite setting for all
1463:             * <tt>PersistenceManager</tt> instances obtained from this factory.
1464:             * @param flag the default NontransactionalWrite setting.
1465:             */
1466:            public synchronized void setNontransactionalWrite(boolean flag) {
1467:                assertConfigurable();
1468:                nontransactionalWrite = flag;
1469:            }
1470:
1471:            /**
1472:             * Get the default NontransactionalWrite setting for all
1473:             * <tt>PersistenceManager</tt> instances obtained from this factory.
1474:             * @return the default NontransactionalWrite setting.
1475:             */
1476:            public boolean getNontransactionalWrite() {
1477:                return nontransactionalWrite;
1478:            }
1479:
1480:            /**
1481:             * Set the default IgnoreCache setting for all <tt>PersistenceManager</tt>
1482:             * instances obtained from this factory.
1483:             * @param flag the default IgnoreCache setting.
1484:             */
1485:            public synchronized void setIgnoreCache(boolean flag) {
1486:                assertConfigurable();
1487:                ignoreCache = flag;
1488:            }
1489:
1490:            /**
1491:             * Get the default IgnoreCache setting for all <tt>PersistenceManager</tt>
1492:             * instances obtained from this factory.
1493:             * @return the IgnoreCache setting.
1494:             */
1495:            public boolean getIgnoreCache() {
1496:                return ignoreCache;
1497:            }
1498:
1499:            /**
1500:             * Mutator for the DetachAllOnCommit setting.
1501:             * @param flag the default DetachAllOnCommit setting.
1502:             * @since 1.1
1503:             */
1504:            public synchronized void setDetachAllOnCommit(boolean flag) {
1505:                assertConfigurable();
1506:                detachAllOnCommit = flag;
1507:            }
1508:
1509:            /**
1510:             * Accessor for the DetachAllOnCommit setting.
1511:             * @return the DetachAllOnCommit setting.
1512:             * @since 1.1
1513:             */
1514:            public boolean getDetachAllOnCommit() {
1515:                return detachAllOnCommit;
1516:            }
1517:
1518:            /**
1519:             * Mutator for the CopyOnAttach setting.
1520:             * @param flag the default CopyOnAttach setting.
1521:             * @since 1.2
1522:             */
1523:            public synchronized void setCopyOnAttach(boolean flag) {
1524:                assertConfigurable();
1525:                copyOnAttach = flag;
1526:            }
1527:
1528:            /**
1529:             * Accessor for the CopyOnAttach setting.
1530:             * @return the CopyOnAttach setting.
1531:             * @since 1.2
1532:             */
1533:            public boolean getCopyOnAttach() {
1534:                return copyOnAttach;
1535:            }
1536:
1537:            /**
1538:             * Set the name for any mapping, used in searching for ORM/Query metadata
1539:             * files.
1540:             * @param mapping the mapping name
1541:             */
1542:            public synchronized void setMapping(String mapping) {
1543:                assertConfigurable();
1544:                this .mapping = mapping;
1545:            }
1546:
1547:            /**
1548:             * Get the name for any mapping, used in retrieving metadata files for
1549:             * ORM/Query data.
1550:             * @return the name for the mapping.
1551:             */
1552:            public String getMapping() {
1553:                return mapping;
1554:            }
1555:
1556:            /**
1557:             * Mutator for the catalog to use for this persistence factory.
1558:             * @param catalog Name of the catalog
1559:             * @since 1.1
1560:             */
1561:            public synchronized void setCatalog(String catalog) {
1562:                assertConfigurable();
1563:                this .catalogName = catalog;
1564:            }
1565:
1566:            /**
1567:             * Accessor for the catalog to use for this persistence factory.
1568:             * @return the name of the catalog
1569:             * @since 1.1
1570:             */
1571:            public String getCatalog() {
1572:                return catalogName;
1573:            }
1574:
1575:            /**
1576:             * Mutator for the schema to use for this persistence factory.
1577:             * @param schema Name of the schema
1578:             * @since 1.1
1579:             */
1580:            public synchronized void setSchema(String schema) {
1581:                assertConfigurable();
1582:                this .schemaName = schema;
1583:            }
1584:
1585:            /**
1586:             * Accessor for the schema to use for this persistence factory.
1587:             * @return the name of the schema
1588:             * @since 1.1
1589:             */
1590:            public String getSchema() {
1591:                return schemaName;
1592:            }
1593:
1594:            /**
1595:             * Mutator for the transaction type to use for this persistence factory.
1596:             * @param type Transaction type
1597:             */
1598:            public synchronized void setTransactionType(String type) {
1599:                assertConfigurable();
1600:                if (type == null) {
1601:                    return;
1602:                }
1603:                if (type.equalsIgnoreCase(TransactionType.JTA.toString())
1604:                        || type.equalsIgnoreCase(TransactionType.RESOURCE_LOCAL
1605:                                .toString())) {
1606:                    this .transactionType = type;
1607:                } else {
1608:                    throw new IllegalArgumentException(LOCALISER.msg("008012",
1609:                            JDO_TRANSACTION_TYPE_PROPERTY, type));
1610:                }
1611:            }
1612:
1613:            /**
1614:             * Accessor for the transaction type to use with this persistence factory.
1615:             * @return transaction type
1616:             */
1617:            public String getTransactionType() {
1618:                return transactionType;
1619:            }
1620:
1621:            /**
1622:             * Mutator for the timezone id of the datastore server.
1623:             * If not set assumes that it is running in the same timezone as this JVM.
1624:             * @param id Timezone Id to use
1625:             */
1626:            public void setServerTimeZoneID(String id) {
1627:                String[] availableIDs = TimeZone.getAvailableIDs();
1628:                boolean validZone = false;
1629:                for (int i = 0; i < availableIDs.length; i++) {
1630:                    if (availableIDs[i].equals(id)) {
1631:                        validZone = true;
1632:                        break;
1633:                    }
1634:                }
1635:                if (!validZone) {
1636:                    // TODO Really should be a JPOXException but only called by JDO anyway currently
1637:                    throw new JDOUserException("Invalid TimeZone ID specified");
1638:                }
1639:
1640:                serverTimeZoneID = id;
1641:            }
1642:
1643:            /**
1644:             * Accessor for the timezone "id" of the datastore server (if any).
1645:             * If not set assumes the same as the JVM JPOX is running in.
1646:             * @return Server timezone id
1647:             */
1648:            public String getServerTimeZoneID() {
1649:                return serverTimeZoneID;
1650:            }
1651:
1652:            /**
1653:             * Accessor for the Calendar to be used in handling all timezone issues with the datastore.
1654:             * Utilises the "serverTimeZoneID" in providing this Calendar used in time/date conversions.
1655:             * @return The calendar to use for dateTimezone issues.
1656:             */
1657:            public Calendar getCalendarForDateTimezone() {
1658:                if (dateTimezoneCalendar == null) {
1659:                    TimeZone tz;
1660:                    if (serverTimeZoneID != null) {
1661:                        tz = TimeZone.getTimeZone(serverTimeZoneID);
1662:                    } else {
1663:                        tz = TimeZone.getDefault();
1664:                    }
1665:                    dateTimezoneCalendar = new GregorianCalendar(tz);
1666:                }
1667:                return dateTimezoneCalendar;
1668:            }
1669:
1670:            /**
1671:             * Mutator for the name of the persistence factory.
1672:             * @param name Name of the persistence factory (if any)
1673:             */
1674:            public synchronized void setName(String name) {
1675:                assertConfigurable();
1676:                this .name = name;
1677:            }
1678:
1679:            /**
1680:             * Accessor for the name of the persistence factory (if any).
1681:             * @return the name of the persistence factory
1682:             */
1683:            public String getName() {
1684:                return name;
1685:            }
1686:
1687:            /**
1688:             * Mutator for the name of the persistence unit.
1689:             * @param name Name of the persistence unit
1690:             */
1691:            public synchronized void setPersistenceUnitName(String name) {
1692:                assertConfigurable();
1693:                this .persistenceUnitName = name;
1694:            }
1695:
1696:            /**
1697:             * Accessor for the name of the persistence unit
1698:             * @return the name of the persistence unit
1699:             */
1700:            public String getPersistenceUnitName() {
1701:                return persistenceUnitName;
1702:            }
1703:
1704:            // ------------------------------ JPA Standard Getters/Setters --------------------------------
1705:
1706:            /**
1707:             * Mutator for whether to allow 1-N unidir FK relations when using JPA.
1708:             * @param flag Whether to support 1-N uni FK relations
1709:             */
1710:            public synchronized void setJpaOneToManyUniFkRelations(boolean flag) {
1711:                assertConfigurable();
1712:                jpaOneToManyUniFkRelations = flag;
1713:            }
1714:
1715:            /**
1716:             * Accessor for whether to allow 1-N uni FK relations
1717:             * @return Whether to allow 1-N uni FK relations
1718:             */
1719:            public boolean getJpaOneToManyUniFkRelations() {
1720:                return jpaOneToManyUniFkRelations;
1721:            }
1722:
1723:            // --------------------------- JPOX Extension Getters/Setters ---------------------
1724:
1725:            /**
1726:             * Mutator for the JCA mode.
1727:             * @param jca true if using JCA connector
1728:             */
1729:            public synchronized void setJCAMode(Boolean jca) {
1730:                assertConfigurable();
1731:                this .jca = jca;
1732:            }
1733:
1734:            /**
1735:             * Accessor for the JCA mode.
1736:             * @return true if using JCA connector.
1737:             */
1738:            public boolean isJcaMode() {
1739:                return jca != null && jca.booleanValue();
1740:            }
1741:
1742:            /**
1743:             * Set the Connection ResourceType
1744:             * @param resourceType The Connection ResourceType
1745:             */
1746:            public synchronized void setConnectionResourceType(
1747:                    String resourceType) {
1748:                assertConfigurable();
1749:                connectionResourceType = ResourceType.getValue(resourceType)
1750:                        .toString();
1751:            }
1752:
1753:            /**
1754:             * Get the Connection ResourceType
1755:             * @return The Connection ResourceType
1756:             */
1757:            public String getConnectionResourceType() {
1758:                return connectionResourceType;
1759:            }
1760:
1761:            /**
1762:             * Set the Connection2 ResourceType
1763:             * @param resourceType The Connection2 ResourceType
1764:             */
1765:            public synchronized void setConnection2ResourceType(
1766:                    String resourceType) {
1767:                assertConfigurable();
1768:                connection2ResourceType = ResourceType.getValue(resourceType)
1769:                        .toString();
1770:            }
1771:
1772:            /**
1773:             * Get the Connection2 ResourceType
1774:             * @return The Connection2 ResourceType
1775:             */
1776:            public String getConnection2ResourceType() {
1777:                return connection2ResourceType;
1778:            }
1779:
1780:            /**
1781:             * Mutator for whether to manage (bidirectional) relationships at flush/commit.
1782:             * @param flag Whether to manage relationships
1783:             */
1784:            public synchronized void setManageRelationships(boolean flag) {
1785:                assertConfigurable();
1786:                manageRelationships = flag;
1787:            }
1788:
1789:            /**
1790:             * Accessor for whether to manage (bidirectional) relationships at flush/commit.
1791:             * @return Whether to manage bidir relationships
1792:             */
1793:            public boolean getManageRelationships() {
1794:                return manageRelationships;
1795:            }
1796:
1797:            /**
1798:             * Mutator for whether to check manage (bidirectional) relationships at flush/commit.
1799:             * @param flag Whether to check manage relationships
1800:             */
1801:            public synchronized void setManageRelationshipsChecks(boolean flag) {
1802:                assertConfigurable();
1803:                manageRelationshipsChecks = flag;
1804:            }
1805:
1806:            /**
1807:             * Accessor for whether to check manage (bidirectional) relationships at flush/commit.
1808:             * @return Whether to check manage bidir relationships
1809:             */
1810:            public boolean getManageRelationshipsChecks() {
1811:                return manageRelationshipsChecks;
1812:            }
1813:
1814:            /**
1815:             * Mutator for whether we should check inheritance when finding an object by its id.
1816:             * @param flag Whether to check the inheritance
1817:             */
1818:            public synchronized void setFindObjectCheckInheritance(boolean flag) {
1819:                assertConfigurable();
1820:                findObjectCheckInheritance = flag;
1821:            }
1822:
1823:            /**
1824:             * Accessor for whether we should check the inheritance on find object by id.
1825:             * @return Whether we check the inheritance
1826:             */
1827:            public boolean getFindObjectCheckInheritance() {
1828:                return findObjectCheckInheritance;
1829:            }
1830:
1831:            /**
1832:             * Mutator for whether when attaching we can assume that any detached objects are from this same datastore.
1833:             * @param flag Whether to assume the same datastore
1834:             */
1835:            public synchronized void setAttachSameDatastore(boolean flag) {
1836:                assertConfigurable();
1837:                attachSameDatastore = flag;
1838:            }
1839:
1840:            /**
1841:             * Accessor for whether we can assume that when attaching any detached objects are detached from the same datastore.
1842:             * @return Whether we assume same datastore
1843:             */
1844:            public boolean getAttachSameDatastore() {
1845:                return attachSameDatastore;
1846:            }
1847:
1848:            /**
1849:             * Set the default DetachOnClose setting for all <tt>PersistenceManager</tt>
1850:             * instances obtained from this factory.
1851:             * @param flag the default DetachOnClose setting.
1852:             * @since 1.1
1853:             */
1854:            public synchronized void setDetachOnClose(boolean flag) {
1855:                assertConfigurable();
1856:                if (flag) {
1857:                    JPOXLogger.PERSISTENCE
1858:                            .warn("Use of org.jpox.detachOnClose is deprecated and likely to be removed in a later release. "
1859:                                    + "Please use javax.jdo.option.DetachAllOnCommit");
1860:                }
1861:                detachOnClose = flag;
1862:            }
1863:
1864:            /**
1865:             * Get the default DetachOnClose setting for all <tt>PersistenceManager</tt>
1866:             * instances obtained from this factory.
1867:             * @return the DetachOnClose setting.
1868:             * @since 1.1
1869:             */
1870:            public boolean getDetachOnClose() {
1871:                return detachOnClose;
1872:            }
1873:
1874:            /**
1875:             * Set the connection provider name.
1876:             * @param name the connection provider name.
1877:             */
1878:            public synchronized void setConnectionProviderName(String name) {
1879:                assertConfigurable();
1880:                this .connectionProviderName = name;
1881:            }
1882:
1883:            /**
1884:             * Get the connection provider name.
1885:             * @return the connection provider name.
1886:             */
1887:            public String getConnectionProviderName() {
1888:                return connectionProviderName;
1889:            }
1890:
1891:            /**
1892:             * Set the connection provider failOnError.
1893:             * @param flag the connection provider failOnError.
1894:             */
1895:            public synchronized void setConnectionProviderFailOnError(
1896:                    boolean flag) {
1897:                assertConfigurable();
1898:                this .connectionProviderFailOnError = flag;
1899:            }
1900:
1901:            /**
1902:             * Get the connection provider failOnError.
1903:             * @return the connection provider failOnError.
1904:             */
1905:            public boolean getConnectionProviderFailOnError() {
1906:                return connectionProviderFailOnError;
1907:            }
1908:
1909:            /**
1910:             * Mutator for the store manager type.
1911:             * @param type StoreManager type
1912:             */
1913:            public synchronized void setStoreManagerType(String type) {
1914:                assertConfigurable();
1915:                this .storeManagerType = type;
1916:            }
1917:
1918:            /**
1919:             * Accessor for the StoreManager type to use.
1920:             * @return the StoreManager type
1921:             */
1922:            public String getStoreManagerType() {
1923:                return storeManagerType;
1924:            }
1925:
1926:            /**
1927:             * Mutator for whether to provide a managed runtime.
1928:             * @param managed Whether to provide a managed runtime
1929:             */
1930:            public synchronized void setManagedRuntime(Boolean managed) {
1931:                assertConfigurable();
1932:                this .managedRuntime = managed;
1933:            }
1934:
1935:            /**
1936:             * Accessor for whether to provide a managed runtime (MBeans).
1937:             * @return whether to provide a managed runtime
1938:             */
1939:            public Boolean getManagedRuntime() {
1940:                return managedRuntime;
1941:            }
1942:
1943:            /**
1944:             * Mutator for the persistence API
1945:             * @param name Persistence API
1946:             */
1947:            public synchronized void setPersistenceApiName(String name) {
1948:                assertConfigurable();
1949:                this .persistenceApiName = name;
1950:            }
1951:
1952:            /**
1953:             * Accessor for the persistence API being used
1954:             * @return the persistence API being used
1955:             */
1956:            public String getPersistenceApiName() {
1957:                return persistenceApiName;
1958:            }
1959:
1960:            /**
1961:             * Set the name of the datastore adapter to use.
1962:             * @param adapterClassName Name of the class of the datastore adapter to use.
1963:             * @since 1.1
1964:             */
1965:            public synchronized void setDatastoreAdapterClassName(
1966:                    String adapterClassName) {
1967:                assertConfigurable();
1968:                datastoreAdapterClassName = adapterClassName;
1969:            }
1970:
1971:            /**
1972:             * Accessor for the datastore adapter class name (null implies autodetect)
1973:             * @return the datastore adapter class name to use.
1974:             * @since 1.1
1975:             */
1976:            public String getDatastoreAdapterClassName() {
1977:                return datastoreAdapterClassName;
1978:            }
1979:
1980:            /**
1981:             * Set the connection pooling type.
1982:             * @param type The connection pooling type
1983:             * @since 1.1
1984:             */
1985:            public synchronized void setConnectionPoolingType(String type) {
1986:                assertConfigurable();
1987:                if (type == null) {
1988:                    type = "None";
1989:                }
1990:                this .connectionPoolingType = type;
1991:            }
1992:
1993:            /**
1994:             * Get the connection pooling type.
1995:             * @return the connection pooling type to be used.
1996:             * @since 1.1
1997:             */
1998:            public String getConnectionPoolingType() {
1999:                return connectionPoolingType;
2000:            }
2001:
2002:            /**
2003:             * Set the connection pooling configuration file to use.
2004:             * @param file The connection pooling configuration file
2005:             * @since 1.1
2006:             */
2007:            public synchronized void setConnectionPoolingConfigurationFile(
2008:                    String file) {
2009:                assertConfigurable();
2010:
2011:                this .connectionPoolingConfigurationFile = file;
2012:            }
2013:
2014:            /**
2015:             * Get the connection pooling configuration file.
2016:             * @return the connection pooling configuration file to be used.
2017:             * @since 1.1
2018:             */
2019:            public String getConnectionPoolingConfigurationFile() {
2020:                return connectionPoolingConfigurationFile;
2021:            }
2022:
2023:            /**
2024:             * Set the limit on number of SQL statements that can be batched in one go.
2025:             * This supports values of 0 for no batching and -1 for unlimited batching.
2026:             * @param limit Max number of statements to batch
2027:             */
2028:            public synchronized void setStatementBatchLimit(int limit) {
2029:                assertConfigurable();
2030:                statementBatchLimit = limit;
2031:            }
2032:
2033:            /**
2034:             * Accessor for the limit on number of SQL statements that can be batched in one go.
2035:             * @return Max number of statements to batch
2036:             */
2037:            public int getStatementBatchLimit() {
2038:                return statementBatchLimit;
2039:            }
2040:
2041:            /**
2042:             * Set the default CheckExistTablesOrViews setting for all
2043:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2044:             * @param flag the default CheckExistTablesOrViews setting.
2045:             */
2046:            public synchronized void setCheckExistTablesOrViews(boolean flag) {
2047:                assertConfigurable();
2048:                checkExistTablesOrViews = flag;
2049:            }
2050:
2051:            /**
2052:             * Get the default CheckExistTablesOrViews setting for all
2053:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2054:             * @return the default CheckExistTablesOrViews setting.
2055:             */
2056:            public boolean getCheckExistTablesOrViews() {
2057:                return checkExistTablesOrViews;
2058:            }
2059:
2060:            /**
2061:             * Set the default ValidateTables setting for all
2062:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2063:             * @param flag the default ValidateTables setting.
2064:             */
2065:            public synchronized void setValidateTables(boolean flag) {
2066:                assertConfigurable();
2067:                validateTables = flag;
2068:                if (!validateTables) {
2069:                    // Can't validate the columns if we aren't validating the table
2070:                    setValidateColumns(false);
2071:                }
2072:            }
2073:
2074:            /**
2075:             * Get the default ValidateTables setting for all
2076:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2077:             * @return the default ValidateTables setting.
2078:             */
2079:            public boolean getValidateTables() {
2080:                return validateTables;
2081:            }
2082:
2083:            /**
2084:             * Set the default InitializeColumnInfo setting for all
2085:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2086:             * Takes values of "ALL", "NONE" or "PK" for which columns to initialise.
2087:             * @param flag the default InitializePrimaryKeyColumnInfo setting.
2088:             */
2089:            public synchronized void setInitializeColumnInfo(String flag) {
2090:                assertConfigurable();
2091:                if (flag != null
2092:                        && (flag.equalsIgnoreCase("ALL")
2093:                                || flag.equalsIgnoreCase("NONE") || flag
2094:                                .equalsIgnoreCase("PK"))) {
2095:                    initializeColumnInfo = flag;
2096:                }
2097:            }
2098:
2099:            /**
2100:             * Get the default InitializeColumnInfo setting for all
2101:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2102:             * @return the default InitializeColumnInfo setting.
2103:             */
2104:            public String getInitializeColumnInfo() {
2105:                return initializeColumnInfo;
2106:            }
2107:
2108:            /**
2109:             * Set the default ValidateColumns setting for all
2110:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2111:             * @param flag the default ValidateColumns setting.
2112:             * @since 1.1
2113:             */
2114:            public synchronized void setValidateColumns(boolean flag) {
2115:                assertConfigurable();
2116:                validateColumns = flag;
2117:            }
2118:
2119:            /**
2120:             * Get the default ValidateColumns setting for all
2121:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2122:             * @return the default ValidateColumns setting.
2123:             * @since 1.1
2124:             */
2125:            public boolean getValidateColumns() {
2126:                return validateColumns;
2127:            }
2128:
2129:            /**
2130:             * Set the default ValidateConstraints setting for all
2131:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2132:             * @param flag the default ValidateConstraints setting.
2133:             */
2134:            public synchronized void setValidateConstraints(boolean flag) {
2135:                assertConfigurable();
2136:                validateConstraints = flag;
2137:            }
2138:
2139:            /**
2140:             * Get the default ValidateConstraints setting for all
2141:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2142:             * @return the default ValidateConstraints setting.
2143:             */
2144:            public boolean getValidateConstraints() {
2145:                return validateConstraints;
2146:            }
2147:
2148:            /**
2149:             * Set whether this datastore is readOnly
2150:             * @param flag the readOnly setting.
2151:             */
2152:            public synchronized void setReadOnlyDatastore(boolean flag) {
2153:                assertConfigurable();
2154:                readOnlyDatastore = flag;
2155:                if (flag) {
2156:                    setAutoCreateTables(false);
2157:                    setAutoCreateColumns(false);
2158:                    setAutoCreateConstraints(false);
2159:                }
2160:            }
2161:
2162:            /**
2163:             * Accessor for whether the datastore is read-only (no structural or content changes allowed).
2164:             * @return the readOnly setting.
2165:             */
2166:            public boolean getReadOnlyDatastore() {
2167:                return readOnlyDatastore;
2168:            }
2169:
2170:            /**
2171:             * Set the action when we have a read-only datastore and an update is attempted.
2172:             * @param action the readOnly action setting.
2173:             */
2174:            public synchronized void setReadOnlyDatastoreAction(String action) {
2175:                assertConfigurable();
2176:                readOnlyDatastoreAction = action;
2177:            }
2178:
2179:            /**
2180:             * Accessor for the action when we have a read-only datastore and an update is attempted.
2181:             * @return the readOnly action setting.
2182:             */
2183:            public String getReadOnlyDatastoreAction() {
2184:                return readOnlyDatastoreAction;
2185:            }
2186:
2187:            /**
2188:             * Set whether this datastore schema is fixed
2189:             * @param flag the fixed setting.
2190:             */
2191:            public synchronized void setFixedDatastore(boolean flag) {
2192:                assertConfigurable();
2193:                fixedDatastore = flag;
2194:                if (flag) {
2195:                    setAutoCreateTables(false);
2196:                    setAutoCreateColumns(false);
2197:                    setAutoCreateConstraints(false);
2198:                }
2199:            }
2200:
2201:            /**
2202:             * Accessor for whether the datastore is read-only (no structural changes allowed).
2203:             * @return the fixed setting.
2204:             */
2205:            public boolean getFixedDatastore() {
2206:                return fixedDatastore;
2207:            }
2208:
2209:            /**
2210:             * Mutator for the RDBMS constraint creation mode
2211:             * @param mode the RDBMS constraint create mode
2212:             * @since 1.2
2213:             */
2214:            public synchronized void setRDBMSConstraintCreateMode(String mode) {
2215:                assertConfigurable();
2216:                if (mode.equalsIgnoreCase("JPOX")
2217:                        || mode.equalsIgnoreCase("JDO2")) {
2218:                    rdbmsConstraintCreateMode = mode;
2219:                }
2220:            }
2221:
2222:            /**
2223:             * Accessor for the RDBMS constraint creation mode.
2224:             * @return the RDBMS constraint creation mode
2225:             * @since 1.2
2226:             */
2227:            public String getRDBMSConstraintCreateMode() {
2228:                return rdbmsConstraintCreateMode;
2229:            }
2230:
2231:            /**
2232:             * Mutator for the deletion policy
2233:             * @param policy the FK create mode
2234:             * @since 1.1
2235:             */
2236:            public synchronized void setDeletionPolicy(String policy) {
2237:                assertConfigurable();
2238:                if (policy.equalsIgnoreCase("JPOX")
2239:                        || policy.equalsIgnoreCase("JDO2")) {
2240:                    deletionPolicy = policy;
2241:                }
2242:            }
2243:
2244:            /**
2245:             * Accessor for the deletion policy.
2246:             * @return the deletion policy
2247:             * @since 1.1
2248:             */
2249:            public String getDeletionPolicy() {
2250:                return deletionPolicy;
2251:            }
2252:
2253:            /**
2254:             * Mutator for the identifier factory
2255:             * @param factory the identifier factory
2256:             */
2257:            public synchronized void setIdentifierFactory(String factory) {
2258:                assertConfigurable();
2259:                identifierFactory = factory;
2260:            }
2261:
2262:            /**
2263:             * Accessor for the identifier factory
2264:             * @return the identifier factory
2265:             */
2266:            public String getIdentifierFactory() {
2267:                return identifierFactory;
2268:            }
2269:
2270:            /**
2271:             * Mutator for the identifier case
2272:             * @param idCase the identifier case
2273:             */
2274:            public synchronized void setIdentifierCase(String idCase) {
2275:                assertConfigurable();
2276:                if (idCase.equalsIgnoreCase("UpperCase")
2277:                        || idCase.equalsIgnoreCase("LowerCase")
2278:                        || idCase.equalsIgnoreCase("PreserveCase")) {
2279:                    identifierCase = idCase;
2280:                }
2281:            }
2282:
2283:            /**
2284:             * Accessor for the identifier case
2285:             * @return the identifier case
2286:             */
2287:            public String getIdentifierCase() {
2288:                return identifierCase;
2289:            }
2290:
2291:            /**
2292:             * Mutator for the identifier word separator
2293:             * @param word the identifier word separator
2294:             */
2295:            public synchronized void setIdentifierWordSeparator(String word) {
2296:                assertConfigurable();
2297:                identifierWordSeparator = word;
2298:            }
2299:
2300:            /**
2301:             * Accessor for the identifier word separator
2302:             * @return the identifier word separator
2303:             */
2304:            public String getIdentifierWordSeparator() {
2305:                return identifierWordSeparator;
2306:            }
2307:
2308:            /**
2309:             * Mutator for the identifier table prefix
2310:             * @param prefix the identifier table prefix
2311:             */
2312:            public synchronized void setIdentifierTablePrefix(String prefix) {
2313:                assertConfigurable();
2314:                identifierTablePrefix = prefix;
2315:            }
2316:
2317:            /**
2318:             * Accessor for the identifier table prefix
2319:             * @return the identifier table prefix
2320:             */
2321:            public String getIdentifierTablePrefix() {
2322:                return identifierTablePrefix;
2323:            }
2324:
2325:            /**
2326:             * Mutator for the identifier table suffix
2327:             * @param suffix the identifier table suffix
2328:             */
2329:            public synchronized void setIdentifierTableSuffix(String suffix) {
2330:                assertConfigurable();
2331:                identifierTableSuffix = suffix;
2332:            }
2333:
2334:            /**
2335:             * Accessor for the identifier table suffix
2336:             * @return the identifier table suffix
2337:             */
2338:            public String getIdentifierTableSuffix() {
2339:                return identifierTableSuffix;
2340:            }
2341:
2342:            /**
2343:             * Set the default UniqueConstraintsMapInverse setting for all
2344:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2345:             * @param flag the default UniqueConstraintsMapInverse setting.
2346:             */
2347:            public synchronized void setUniqueConstraintsMapInverse(boolean flag) {
2348:                assertConfigurable();
2349:                uniqueConstraintsMapInverse = flag;
2350:            }
2351:
2352:            /**
2353:             * Get the default UniqueConstraintsMapInverse setting for all
2354:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2355:             * @return the default UniqueConstraintsMapInverse setting.
2356:             */
2357:            public boolean getUniqueConstraintsMapInverse() {
2358:                return uniqueConstraintsMapInverse;
2359:            }
2360:
2361:            /**
2362:             * Get the use update lock flag for fetches.
2363:             * @return the default useUpdateLock setting.
2364:             */
2365:            public boolean getUseUpdateLock() {
2366:                return useUpdateLock;
2367:            }
2368:
2369:            /**
2370:             * Set whether to use the update lock for fetches.
2371:             * @param flag the useUpdateLock setting.
2372:             */
2373:            public synchronized void setUseUpdateLock(boolean flag) {
2374:                assertConfigurable();
2375:                useUpdateLock = flag;
2376:            }
2377:
2378:            /**
2379:             * Accessor for the maximum number of retries for adding a class to the store manager.
2380:             * @return The max number of retries
2381:             * @since 1.1
2382:             */
2383:            public int getDatastoreClassAdditionMaxRetries() {
2384:                return datastoreClassAdditionMaxRetries;
2385:            }
2386:
2387:            /**
2388:             * Set the max number of times to retry adding a class to the store manager.
2389:             * @param max The max number of retries
2390:             * @since 1.1
2391:             */
2392:            public void setDatastoreClassAdditionMaxRetries(int max) {
2393:                this .datastoreClassAdditionMaxRetries = max;
2394:            }
2395:
2396:            /**
2397:             * Accessor for whether "persistence-by-reachability" is run at commit time.
2398:             * @return Whether to run PBR at commit time
2399:             */
2400:            public boolean getPersistenceByReachabilityAtCommit() {
2401:                return persistenceByReachabilityAtCommit;
2402:            }
2403:
2404:            /**
2405:             * Mutator for whether to run "persistence-by-reachability" at commit time.
2406:             * @param flag Whether to run PBR at commit time
2407:             */
2408:            public synchronized void setPersistenceByReachabilityAtCommit(
2409:                    boolean flag) {
2410:                assertConfigurable();
2411:                persistenceByReachabilityAtCommit = flag;
2412:            }
2413:
2414:            /**
2415:             * Accessor for the maximum fetch depth to use by default.
2416:             * @return Max fetch depth to use
2417:             */
2418:            public int getMaxFetchDepth() {
2419:                return maxFetchDepth;
2420:            }
2421:
2422:            /**
2423:             * Mutator for the default max fetch depth
2424:             * @param value Max fetch depth to use
2425:             */
2426:            public synchronized void setMaxFetchDepth(int value) {
2427:                assertConfigurable();
2428:                maxFetchDepth = value;
2429:            }
2430:
2431:            /**
2432:             * Accessor for the name of the class loader resolver.
2433:             * @return Name of the class loader resolver to use.
2434:             */
2435:            public String getClassLoaderResolverName() {
2436:                return classLoaderResolverName;
2437:            }
2438:
2439:            /**
2440:             * Mutator for the class loader resolver name to use.
2441:             * @param clrName Class Loader resolver name to use
2442:             */
2443:            public synchronized void setClassLoaderResolverName(String clrName) {
2444:                assertConfigurable();
2445:                classLoaderResolverName = clrName;
2446:            }
2447:
2448:            /**
2449:             * Accessor for the primary class loader.
2450:             * @return the primary class loader resolver.
2451:             */
2452:            public ClassLoader getPrimaryClassLoader() {
2453:                return primaryClassLoader;
2454:            }
2455:
2456:            /**
2457:             * Mutator for the primary class loader.
2458:             * @param clr primary Class Loader
2459:             */
2460:            public synchronized void setPrimaryClassLoaderResolver(
2461:                    ClassLoader clr) {
2462:                assertConfigurable();
2463:                primaryClassLoader = clr;
2464:            }
2465:
2466:            /**
2467:             * Accessor for the name of datastore identity class
2468:             * @return Name of the datastore identity class
2469:             */
2470:            public String getDatastoreIdentityClassName() {
2471:                return datastoreIdentityClassName;
2472:            }
2473:
2474:            /**
2475:             * Mutator for the name to use for datastore-identity
2476:             * @param name Datastore-identity class name
2477:             */
2478:            public synchronized void setDatastoreIdentityClassName(String name) {
2479:                assertConfigurable();
2480:                datastoreIdentityClassName = name;
2481:            }
2482:
2483:            /**
2484:             * Accessor for the name of the implementation creator.
2485:             * @return Name of the implementation creator to use.
2486:             */
2487:            public String getImplementationCreatorName() {
2488:                return implementationCreatorName;
2489:            }
2490:
2491:            /**
2492:             * Mutator for the implementation creator name to use.
2493:             * @param implCreatorName Name of implementation creator to use
2494:             */
2495:            public synchronized void setImplementationCreatorName(
2496:                    String implCreatorName) {
2497:                assertConfigurable();
2498:                implementationCreatorName = implCreatorName;
2499:            }
2500:
2501:            /**
2502:             * Accessor for the default inheritance strategy to use.
2503:             * @return the default inheritance strategy
2504:             * @since 1.1
2505:             */
2506:            public String getDefaultInheritanceStrategy() {
2507:                return defaultInheritanceStrategy;
2508:            }
2509:
2510:            /**
2511:             * Mutator for the default inheritance strategy.
2512:             * @param strategy the default inheritance strategy
2513:             * @since 1.1
2514:             */
2515:            public synchronized void setDefaultInheritanceStrategy(
2516:                    String strategy) {
2517:                assertConfigurable();
2518:                if (strategy == null) {
2519:                    return;
2520:                } else if (!strategy.equalsIgnoreCase("JDO2")
2521:                        && !strategy.equalsIgnoreCase("JPOX")) {
2522:                    // Illegal value
2523:                    return;
2524:                }
2525:                defaultInheritanceStrategy = strategy;
2526:            }
2527:
2528:            /**
2529:             * Set the default AutoCreateSchema setting for all
2530:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2531:             * @param flag the default AutoCreateSchema setting.
2532:             */
2533:            public synchronized void setAutoCreateSchema(boolean flag) {
2534:                assertConfigurable();
2535:                if (flag) {
2536:                    // This flag is a shortcut to set the tables and constraints
2537:                    setAutoCreateTables(true);
2538:                    setAutoCreateConstraints(true);
2539:                }
2540:
2541:                if ((readOnlyDatastore || fixedDatastore) && flag) {
2542:                    JPOXLogger.PERSISTENCE.warn(LOCALISER.msg("008011",
2543:                            "autoCreateSchema"));
2544:                }
2545:            }
2546:
2547:            /**
2548:             * Get the default AutoCreateSchema setting for all
2549:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2550:             * @return the default AutoCreateSchema setting.
2551:             */
2552:            public boolean getAutoCreateSchema() {
2553:                return (autoCreateTables && autoCreateConstraints);
2554:            }
2555:
2556:            /**
2557:             * Set the default AutoCreateTables setting for all
2558:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2559:             * @param flag the default AutoCreateTables setting.
2560:             */
2561:            public synchronized void setAutoCreateTables(boolean flag) {
2562:                assertConfigurable();
2563:                autoCreateTables = flag;
2564:                if ((readOnlyDatastore || fixedDatastore) && flag) {
2565:                    autoCreateTables = false;
2566:                    JPOXLogger.PERSISTENCE.warn(LOCALISER.msg("008011",
2567:                            "autoCreateTables"));
2568:                }
2569:            }
2570:
2571:            /**
2572:             * Get the default AutoCreateTables setting for all
2573:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2574:             * @return the default AutoCreateTables setting.
2575:             */
2576:            public boolean getAutoCreateTables() {
2577:                return autoCreateTables;
2578:            }
2579:
2580:            /**
2581:             * Set the default AutoCreateColumns setting for all
2582:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2583:             * @param flag the default AutoCreateColumns setting.
2584:             * @since 1.1
2585:             */
2586:            public synchronized void setAutoCreateColumns(boolean flag) {
2587:                assertConfigurable();
2588:                autoCreateColumns = flag;
2589:                if ((readOnlyDatastore || fixedDatastore) && flag) {
2590:                    autoCreateTables = false;
2591:                    JPOXLogger.PERSISTENCE.warn(LOCALISER.msg("008011",
2592:                            "autoCreateColumns"));
2593:                }
2594:            }
2595:
2596:            /**
2597:             * Get the default AutoCreateColumns setting for all
2598:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2599:             * @return the default AutoCreateColumns setting.
2600:             * @since 1.1
2601:             */
2602:            public boolean getAutoCreateColumns() {
2603:                return autoCreateColumns;
2604:            }
2605:
2606:            /**
2607:             * Set the default AutoCreateConstraints setting for all
2608:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2609:             * @param flag the default AutoCreateConstraints setting.
2610:             */
2611:            public synchronized void setAutoCreateConstraints(boolean flag) {
2612:                assertConfigurable();
2613:                autoCreateConstraints = flag;
2614:                if ((readOnlyDatastore || fixedDatastore) && flag) {
2615:                    autoCreateConstraints = false;
2616:                    JPOXLogger.PERSISTENCE.warn(LOCALISER.msg("008011",
2617:                            "autoCreateConstraints"));
2618:                }
2619:            }
2620:
2621:            /**
2622:             * Get the default AutoCreateConstraints setting for all
2623:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2624:             * @return the default AutoCreateConstraints setting.
2625:             */
2626:            public boolean getAutoCreateConstraints() {
2627:                return autoCreateConstraints;
2628:            }
2629:
2630:            /**
2631:             * Set the default AutoCreateWarnOnError setting for all
2632:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2633:             * @param flag the default AutoCreateWarnOnError setting.
2634:             */
2635:            public synchronized void setAutoCreateWarnOnError(boolean flag) {
2636:                assertConfigurable();
2637:                autoCreateWarnOnError = flag;
2638:            }
2639:
2640:            /**
2641:             * Get the default AutoCreateWarnOnError setting for all
2642:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2643:             * @return the default AutoCreateWarnOnError setting.
2644:             */
2645:            public boolean getAutoCreateWarnOnError() {
2646:                return autoCreateWarnOnError;
2647:            }
2648:
2649:            /**
2650:             * Accessor for the Auto-Start Mechanism for management of which classes
2651:             * are supported in this data store.
2652:             * @return the Auto-Start Mechanism setting.
2653:             */
2654:            public String getAutoStartMechanism() {
2655:                return autoStartMechanism;
2656:            }
2657:
2658:            /**
2659:             * Set the AutoStartMechanism setting to this persistence factory.
2660:             * @param mechanism The autostart mechanism plugin name
2661:             */
2662:            public synchronized void setAutoStartMechanism(String mechanism) {
2663:                assertConfigurable();
2664:                autoStartMechanism = mechanism;
2665:            }
2666:
2667:            /**
2668:             * Accessor for the name of the XML file to use when using the XML AutoStarter
2669:             * @return The XML file name
2670:             */
2671:            public String getAutoStartMechanismXmlFile() {
2672:                return autoStartMechanismXmlFile;
2673:            }
2674:
2675:            /**
2676:             * Mutator for the XML filename when using the XML AutoStarter.
2677:             * @param xmlFile Name of the XML file
2678:             */
2679:            public synchronized void setAutoStartMechanismXmlFile(String xmlFile) {
2680:                autoStartMechanismXmlFile = xmlFile;
2681:            }
2682:
2683:            /**
2684:             * Accessor for the Auto-Start Mechanism Mode for how the auto start
2685:             * mechanism operates. Currently supports 3 possible values for this
2686:             * parameter "Checked", "Ignored", and "Quiet" (default).
2687:             * @return the Auto-Start Mechanism Mode setting.
2688:             */
2689:            public String getAutoStartMechanismMode() {
2690:                if (autoStartMechanismMode != null
2691:                        && autoStartMechanismMode
2692:                                .equalsIgnoreCase(AutoStartMechanism.MODE_CHECKED)) {
2693:                    return AutoStartMechanism.MODE_CHECKED;
2694:                } else if (autoStartMechanismMode != null
2695:                        && autoStartMechanismMode
2696:                                .equalsIgnoreCase(AutoStartMechanism.MODE_IGNORED)) {
2697:                    return AutoStartMechanism.MODE_IGNORED;
2698:                } else // Default
2699:                {
2700:                    return AutoStartMechanism.MODE_QUIET;
2701:                }
2702:            }
2703:
2704:            /**
2705:             * Set the default AutoStartMechanismMode setting for all
2706:             * <tt>PersistenceManager</tt> instances obtained from this factory.
2707:             * @param mode Checked = raise exceptions on errors
2708:             *             Ignored = proceed without corrections
2709:             *             Quiet   = correct errors and proceed (default)
2710:             */
2711:            public synchronized void setAutoStartMechanismMode(String mode) {
2712:                assertConfigurable();
2713:                if (!mode.equals(AutoStartMechanism.MODE_CHECKED)
2714:                        && !mode.equals(AutoStartMechanism.MODE_IGNORED)
2715:                        && !mode.equals(AutoStartMechanism.MODE_QUIET)) {
2716:                    throw new IllegalArgumentException(LOCALISER.msg("008012",
2717:                            AUTO_START_MECHANISM_MODE_PROPERTY, mode));
2718:                }
2719:                autoStartMechanismMode = mode;
2720:            }
2721:
2722:            /**
2723:             * Accessor for the names of the classes to be loaded at startup.
2724:             * @return Names of classes to load
2725:             * @since 1.1
2726:             */
2727:            public String getAutoStartClassNames() {
2728:                return autoStartClassNames;
2729:            }
2730:
2731:            /**
2732:             * Mutator for the names of classes to load at startup.
2733:             * @param classNames Name of the classes to load.
2734:             * @since 1.1
2735:             */
2736:            public synchronized void setAutoStartClassNames(String classNames) {
2737:                autoStartClassNames = classNames;
2738:            }
2739:
2740:            /**
2741:             * Get the default transaction isolation level for all
2742:             * <tt>PoidGenerator</tt> instances.
2743:             *
2744:             * @return the default transaction isolation level for
2745:             *         <tt>PoidGenerator</tt> instances.
2746:             */
2747:            public int getPoidTransactionIsolationLevel() {
2748:                return poidIsolationLevel;
2749:            }
2750:
2751:            /**
2752:             * Set the default transaction isolation level for all
2753:             * <tt>PoidGenerator</tt> instances.
2754:             * @param isolationLevelName
2755:             *      One of the values "read uncommitted", "read committed", "repeatable
2756:             *      read", or "serializable".  The name is case-insensitive, and spaces
2757:             *      and underscores are equivalent.
2758:             */
2759:            protected synchronized void setPoidTransactionIsolation(
2760:                    String isolationLevelName) {
2761:                String iln = isolationLevelName.trim().replace(' ', '_')
2762:                        .toUpperCase();
2763:                poidIsolationLevel = TransactionUtils
2764:                        .getTransactionIsolationLevelForName(iln);
2765:                if (poidIsolationLevel < 0) {
2766:                    throw new IllegalArgumentException(LOCALISER.msg("008012",
2767:                            POID_TRANSACTION_ISOLATION_PROPERTY,
2768:                            isolationLevelName));
2769:                }
2770:            }
2771:
2772:            /**
2773:             * Set the default transaction isolation level for all
2774:             * <tt>PoidGenerator</tt> instances.
2775:             * @param isolationLevel the default transaction isolation level.
2776:             */
2777:            public synchronized void setPoidTransactionIsolation(
2778:                    int isolationLevel) {
2779:                switch (isolationLevel) {
2780:                case UserTransaction.TRANSACTION_READ_UNCOMMITTED:
2781:                case UserTransaction.TRANSACTION_READ_COMMITTED:
2782:                case UserTransaction.TRANSACTION_REPEATABLE_READ:
2783:                case UserTransaction.TRANSACTION_SERIALIZABLE:
2784:                    break;
2785:
2786:                default:
2787:                    throw new IllegalArgumentException(LOCALISER.msg("008012",
2788:                            POID_TRANSACTION_ISOLATION_PROPERTY, ""
2789:                                    + isolationLevel));
2790:                }
2791:
2792:                this .poidIsolationLevel = isolationLevel;
2793:            }
2794:
2795:            /**
2796:             * Whether to use the PM connection or open a new connection
2797:             * @return Returns the poidTransactionAttribute.
2798:             */
2799:            public String getPoidTransactionAttribute() {
2800:                return poidTransactionAttribute;
2801:            }
2802:
2803:            /**
2804:             * Set whether to use the PM connection or open a new connection
2805:             * @param poidTransactionAttribute The poidTransactionAttribute to set.
2806:             */
2807:            public void setPoidTransactionAttribute(
2808:                    String poidTransactionAttribute) {
2809:                if (poidTransactionAttribute == null) {
2810:                    throw new IllegalArgumentException(LOCALISER.msg("008012",
2811:                            "org.jpox.poid.transactionAttribute",
2812:                            poidTransactionAttribute));
2813:                }
2814:                if (!poidTransactionAttribute.equals("New")
2815:                        && !poidTransactionAttribute.equals("UsePM")) {
2816:                    throw new IllegalArgumentException(LOCALISER.msg("008012",
2817:                            "org.jpox.poid.transactionAttribute",
2818:                            poidTransactionAttribute));
2819:                }
2820:                this .poidTransactionAttribute = poidTransactionAttribute;
2821:            }
2822:
2823:            /**
2824:             * Accessor for whether to flush before executing queries.
2825:             * @return Whether to flush before execution
2826:             * @since 1.2
2827:             */
2828:            public boolean getQueryFlushBeforeExecution() {
2829:                return queryFlushBeforeExecution;
2830:            }
2831:
2832:            /**
2833:             * Set whether to flush before executing queries
2834:             * @param flush Whether to flush before executing queries
2835:             * @since 1.2
2836:             */
2837:            public void setQueryFlushBeforeExecution(boolean flush) {
2838:                queryFlushBeforeExecution = flush;
2839:            }
2840:
2841:            /**
2842:             * Accessor for whether to use the FetchPlan in queries.
2843:             * @return Whether to use the FetchPlan in queries
2844:             * @since 1.1
2845:             */
2846:            public boolean getQueryUseFetchPlan() {
2847:                return queryUseFetchPlan;
2848:            }
2849:
2850:            /**
2851:             * Set whether to use the FetchPlan in queries
2852:             * @param useFetchPlan Whether to use the FetchPlan in queries
2853:             * @since 1.1
2854:             */
2855:            public void setQueryUseFetchPlan(boolean useFetchPlan) {
2856:                queryUseFetchPlan = useFetchPlan;
2857:            }
2858:
2859:            /**
2860:             * Whether to allow running any SQL statement in SQL queries.
2861:             * @return true if allowed to execute any SQL stament in SQL queries
2862:             * @since 1.1
2863:             */
2864:            public boolean isQueryAllowAllSQLStatements() {
2865:                return queryAllowAllSQLStatements;
2866:            }
2867:
2868:            /**
2869:             * Whether to allow running any SQL statement in SQL queries.
2870:             * @param allow true if allowed to execute any SQL stament in SQL queries
2871:             * @since 1.1
2872:             */
2873:            public void setQueryAllowAllSQLStatements(boolean allow) {
2874:                this .queryAllowAllSQLStatements = allow;
2875:            }
2876:
2877:            /**
2878:             * Accessor for the timeout for queries.
2879:             * @return The timeout
2880:             * @since 1.1
2881:             */
2882:            public int getQueryTimeout() {
2883:                return queryTimeout;
2884:            }
2885:
2886:            /**
2887:             * Set the timeout for queries
2888:             * @param timeout The timeout to use
2889:             * @since 1.1
2890:             */
2891:            public void setQueryTimeout(int timeout) {
2892:                this .queryTimeout = timeout;
2893:            }
2894:
2895:            /**
2896:             * Accessor for the fetch direction to use for ResultSet's.
2897:             * @return The fetch direction.
2898:             * @since 1.1
2899:             */
2900:            public String getQueryFetchDirection() {
2901:                return queryFetchDirection;
2902:            }
2903:
2904:            /**
2905:             * Set the fetch direction to use for ResultSet's.
2906:             * @param dir The fetch direction to use
2907:             * @since 1.1
2908:             */
2909:            public void setQueryFetchDirection(String dir) {
2910:                if (dir == null || !dir.equals("forward")
2911:                        || !dir.equals("reverse") || !dir.equals("unknown")) {
2912:                    return;
2913:                }
2914:                queryFetchDirection = dir;
2915:            }
2916:
2917:            /**
2918:             * Accessor for the type of ResultSet
2919:             * @return The ResultSet type.
2920:             * @since 1.1
2921:             */
2922:            public String getQueryResultSetType() {
2923:                return queryResultSetType;
2924:            }
2925:
2926:            /**
2927:             * Set the type of the ResultSet
2928:             * @param type The ResultSet type
2929:             * @since 1.1
2930:             */
2931:            public void setQueryResultSetType(String type) {
2932:                if (type == null
2933:                        || (!type.equals("forward-only")
2934:                                && !type.equals("scroll-sensitive") && !type
2935:                                .equals("scroll-insensitive"))) {
2936:                    return;
2937:                }
2938:                queryResultSetType = type;
2939:            }
2940:
2941:            /**
2942:             * Accessor for the concurrency of ResultSet
2943:             * @return The ResultSet concurrency.
2944:             * @since 1.1
2945:             */
2946:            public String getQueryResultSetConcurrency() {
2947:                return queryResultSetConcurrency;
2948:            }
2949:
2950:            /**
2951:             * Set the concurrency of the ResultSet
2952:             * @param concur The ResultSet concurrency
2953:             * @since 1.1
2954:             */
2955:            public void setQueryResultSetConcurrency(String concur) {
2956:                if (concur == null
2957:                        || (!concur.equals("read-only") && !concur
2958:                                .equals("updateable"))) {
2959:                    return;
2960:                }
2961:                queryResultSetConcurrency = concur;
2962:            }
2963:
2964:            /**
2965:             * Accessor for join type to use with queries.
2966:             * @return Join type for queries
2967:             * @since 1.2
2968:             */
2969:            public String getQueryJoinType() {
2970:                return queryJoinType;
2971:            }
2972:
2973:            /**
2974:             * Set the join type to use on queries.
2975:             * @param type Join type to use on queries
2976:             * @since 1.2
2977:             */
2978:            public void setQueryJoinType(String type) {
2979:                if (type.toUpperCase().equals("INNER")
2980:                        || type.toUpperCase().equals("LEFT OUTER")) {
2981:                    queryJoinType = type.toUpperCase();
2982:                }
2983:            }
2984:
2985:            /**
2986:             * Accessor for whether to apply constraints to exists inner expression.
2987:             * @return Whether to apply constraints to exists inner expression
2988:             * @since 1.2
2989:             */
2990:            public boolean getQueryExistsIncludesConstraints() {
2991:                return queryExistsIncludesConstraints;
2992:            }
2993:
2994:            /**
2995:             * Set whether to apply constraints to exists inner expression.
2996:             * @param includes Whether to apply constraints to exists inner expression.
2997:             * @since 1.2
2998:             */
2999:            public void setQueryExistsIncludesConstraints(boolean includes) {
3000:                queryExistsIncludesConstraints = includes;
3001:            }
3002:
3003:            /**
3004:             * Accessor for whether to always use EXISTS with contains().
3005:             * @return Whether to always use EXISTS with contains()
3006:             * @since 1.2
3007:             */
3008:            public boolean getQueryContainsUsesExistsAlways() {
3009:                return queryContainsUsesExistsAlways;
3010:            }
3011:
3012:            /**
3013:             * Set whether to always use EXISTS with any contains().
3014:             * @param always Whether to always use EXISTS with contains()
3015:             * @since 1.2
3016:             */
3017:            public void setQueryContainsUsesExistsAlways(boolean always) {
3018:                queryContainsUsesExistsAlways = always;
3019:            }
3020:
3021:            /**
3022:             * Accessor for the default max length for strings.
3023:             * @return The default length for strings
3024:             */
3025:            public int getStringDefaultLength() {
3026:                return stringDefaultLength;
3027:            }
3028:
3029:            /**
3030:             * Set the default length for strings.
3031:             * @param len Default length for strings
3032:             */
3033:            public void setStringDefaultLength(int len) {
3034:                this .stringDefaultLength = len;
3035:            }
3036:
3037:            /**
3038:             * Accessor for the action when persisting a string that exceeds the datastore column length.
3039:             * @return Action when persisting String longer than the datastore can handle
3040:             */
3041:            public String getStringLengthExceededAction() {
3042:                return stringLengthExceededAction;
3043:            }
3044:
3045:            /**
3046:             * Set the action when persisting a string too long for the datastore.
3047:             * Valid values are EXCEPTION and TRUNCATE.
3048:             * @param action action when persisting a string too long for the datastore.
3049:             */
3050:            public void setStringLengthExceededAction(String action) {
3051:                if (action == null) {
3052:                    return;
3053:                }
3054:                if (action.equalsIgnoreCase("EXCEPTION")
3055:                        || action.equalsIgnoreCase("TRUNCATE")) {
3056:                    this .stringLengthExceededAction = action.toUpperCase();
3057:                }
3058:            }
3059:
3060:            /**
3061:             * Accessor for whether to persist an empty string as null in the datastore (RDBMS).
3062:             * @return Whether to persist an empty string as null
3063:             */
3064:            public boolean getPersistEmptyStringAsNull() {
3065:                return persistEmptyStringAsNull;
3066:            }
3067:
3068:            /**
3069:             * Mutator for whether to persist an empty string as null in the datastore (RDBMS).
3070:             * @param flag whether an empty string should be treated as null
3071:             */
3072:            public void setPersistEmptyStringAsNull(boolean flag) {
3073:                persistEmptyStringAsNull = flag;
3074:            }
3075:
3076:            /**
3077:             * Accessor for whether to have a discriminator column on all subclass tables.
3078:             * This is for backwards compatibility only and will be removed later.
3079:             * TODO Remove this when people have changed over
3080:             * @return Whether to persist an empty string as null
3081:             */
3082:            public boolean getDiscriminatorPerSubclassTable() {
3083:                return discriminatorPerSubclassTable;
3084:            }
3085:
3086:            /**
3087:             * Mutator for whether to have a discriminator column added to all subclass tables.
3088:             * This is for backwards compatibility only and will be removed later.
3089:             * TODO Remove this when people have changed over
3090:             * @param flag whether to have discrim per subclass table
3091:             */
3092:            public void setDiscriminatorPerSubclassTable(boolean flag) {
3093:                discriminatorPerSubclassTable = flag;
3094:            }
3095:
3096:            /**
3097:             * Accessor for the NLS sort order for Oracle.
3098:             * @return The NLS sort order for Oracle.
3099:             */
3100:            public String getOracleNlsSortOrder() {
3101:                return oracleNlsSortOrder;
3102:            }
3103:
3104:            /**
3105:             * Set the NLS sort order for oracle.
3106:             * @param order NLS sort order for oracle.
3107:             */
3108:            public void setOracleNlsSortOrder(String order) {
3109:                this .oracleNlsSortOrder = order;
3110:            }
3111:
3112:            /**
3113:             * Accessor for whether to cache collections.
3114:             * @return whether to cache collections.
3115:             */
3116:            public boolean getCacheCollections() {
3117:                return cacheCollections;
3118:            }
3119:
3120:            /**
3121:             * Set whether to cache collections for this persistence factory.
3122:             * @param cache Whether to cache collections.
3123:             */
3124:            public synchronized void setCacheCollections(boolean cache) {
3125:                assertConfigurable();
3126:                cacheCollections = cache;
3127:            }
3128:
3129:            /**
3130:             * Accessor for whether to lazy load any cached collections.
3131:             * @return whether to lazy load any cache collections.
3132:             */
3133:            public Boolean getCacheCollectionsLazy() {
3134:                return cacheCollectionsLazy;
3135:            }
3136:
3137:            /**
3138:             * Set whether to lazy load any cached collections for this persistence factory.
3139:             * @param lazy Whether to lazy load any cache collections.
3140:             */
3141:            public synchronized void setCacheCollectionsLazy(Boolean lazy) {
3142:                assertConfigurable();
3143:                if (lazy != null) {
3144:                    cacheCollectionsLazy = lazy;
3145:                }
3146:            }
3147:
3148:            /**
3149:             * Accessor for the Level 1 Cache Type
3150:             * @return the Level 1 Cache Type
3151:             * @since 1.1
3152:             */
3153:            public String getCacheLevel1Type() {
3154:                return cacheLevel1Type;
3155:            }
3156:
3157:            /**
3158:             * Set the default Level 1 Cache Type for all
3159:             * <tt>PersistenceManager</tt> instances obtained from this factory.
3160:             * @param type the Level 1 Cache Type
3161:             * @since 1.1
3162:             */
3163:            public synchronized void setCacheLevel1Type(String type) {
3164:                assertConfigurable();
3165:                cacheLevel1Type = type;
3166:            }
3167:
3168:            /**
3169:             * Accessor for whether to use a level 2 Cache.
3170:             * @return whether to use a level 2 Cache.
3171:             * @since 1.1
3172:             */
3173:            public boolean getCacheLevel2() {
3174:                return cacheLevel2;
3175:            }
3176:
3177:            /**
3178:             * Set whether to use a Level 2 Cache for this persistence factory.
3179:             * @param cache Whether to use a level 2 Cache
3180:             * @since 1.1
3181:             */
3182:            public synchronized void setCacheLevel2(boolean cache) {
3183:                assertConfigurable();
3184:                cacheLevel2 = cache;
3185:            }
3186:
3187:            /**
3188:             * Accessor for the Level 2 Cache Type
3189:             * @return the Level 2 Cache Type
3190:             * @since 1.1
3191:             */
3192:            public String getCacheLevel2Type() {
3193:                return cacheLevel2Type;
3194:            }
3195:
3196:            /**
3197:             * Set the default Level 2 Cache Type for all
3198:             * <tt>PersistenceManager</tt> instances obtained from this factory.
3199:             * @param type the Level 2 Cache Type
3200:             * @since 1.1
3201:             */
3202:            public synchronized void setCacheLevel2Type(String type) {
3203:                assertConfigurable();
3204:                cacheLevel2Type = type;
3205:            }
3206:
3207:            /**
3208:             * Accessor for the Level 2 Cache Name
3209:             * @return the Level 2 Cache Name
3210:             * @since 1.1
3211:             */
3212:            public String getCacheLevel2CacheName() {
3213:                return cacheLevel2CacheName;
3214:            }
3215:
3216:            /**
3217:             * Set the default Level 2 Cache Name for all
3218:             * <tt>PersistenceManager</tt> instances obtained from this factory.
3219:             * @param name Name of the cache
3220:             * @since 1.1
3221:             */
3222:            public synchronized void setCacheLevel2CacheName(String name) {
3223:                assertConfigurable();
3224:                cacheLevel2CacheName = name;
3225:            }
3226:
3227:            /**
3228:             * Accessor for the JDO Level 2 Configuration File
3229:             * @return the JDO Level 2 Configuration File
3230:             * @since 1.1
3231:             */
3232:            public String getCacheLevel2ConfigurationFile() {
3233:                return cacheLevel2ConfigurationFile;
3234:            }
3235:
3236:            /**
3237:             * Set the default Level 2 Configuration File for all
3238:             * <tt>PersistenceManager</tt> instances obtained from this factory.
3239:             * @param confFile The File Name of the configuration file
3240:             * @since 1.1
3241:             */
3242:            public synchronized void setCacheLevel2ConfigurationFile(
3243:                    String confFile) {
3244:                assertConfigurable();
3245:                cacheLevel2ConfigurationFile = confFile;
3246:            }
3247:
3248:            /**
3249:             * Set the default transaction isolation level for all
3250:             * <tt>PersistenceManager</tt> instances obtained from this factory.
3251:             * @param isolationLevelName
3252:             *      One of the values "none", "read uncommitted", "read committed", "repeatable
3253:             *      read", or "serializable".  The name is case-insensitive, and spaces
3254:             *      and underscores are equivalent.
3255:             */
3256:            protected synchronized void setTransactionIsolation(
3257:                    String isolationLevelName) {
3258:                assertConfigurable();
3259:
3260:                String iln = isolationLevelName.trim().replace(' ', '_')
3261:                        .toUpperCase();
3262:                isolationLevel = TransactionUtils
3263:                        .getTransactionIsolationLevelForName(iln);
3264:                if (isolationLevel < 0) {
3265:                    throw new IllegalArgumentException(LOCALISER.msg("008012",
3266:                            TRANSACTION_ISOLATION_PROPERTY, isolationLevelName));
3267:                }
3268:            }
3269:
3270:            /**
3271:             * Set the default transaction isolation level for all
3272:             * <tt>PersistenceManager</tt> instances obtained from this factory.
3273:             * @param isolationLevel the default transaction isolation level.
3274:             */
3275:            public synchronized void setTransactionIsolation(int isolationLevel) {
3276:                assertConfigurable();
3277:
3278:                switch (isolationLevel) {
3279:                case UserTransaction.TRANSACTION_NONE:
3280:                case UserTransaction.TRANSACTION_READ_UNCOMMITTED:
3281:                case UserTransaction.TRANSACTION_READ_COMMITTED:
3282:                case UserTransaction.TRANSACTION_REPEATABLE_READ:
3283:                case UserTransaction.TRANSACTION_SERIALIZABLE:
3284:                    break;
3285:
3286:                default:
3287:                    throw new IllegalArgumentException(LOCALISER
3288:                            .msg("008012", TRANSACTION_ISOLATION_PROPERTY, ""
3289:                                    + isolationLevel));
3290:                }
3291:
3292:                this .isolationLevel = isolationLevel;
3293:            }
3294:
3295:            /**
3296:             * Get the default transaction isolation level for all
3297:             * <tt>PersistenceManager</tt> instances obtained from this factory.
3298:             * @return the default transaction isolation level.
3299:             */
3300:            public int getTransactionIsolation() {
3301:                return isolationLevel;
3302:            }
3303:
3304:            /**
3305:             * Mutator for the JTA Locator to use when using JTA transactions.
3306:             * @param locator Name of the locator. Should correspond to a locator plugin alias
3307:             */
3308:            protected synchronized void setJtaLocator(String locator) {
3309:                assertConfigurable();
3310:
3311:                jtaLocator = locator;
3312:            }
3313:
3314:            /**
3315:             * Accessor for the JTA locator to use (if any).
3316:             * @return the alias for the JTA locator
3317:             */
3318:            public String getJtaLocator() {
3319:                return jtaLocator;
3320:            }
3321:
3322:            /**
3323:             * Mutator for the JNDI location to use (if any) to get the JTA txn manager.
3324:             * @param jndi JNDI location to find the JTA txn manager
3325:             */
3326:            protected synchronized void setJtaJndiLocation(String jndi) {
3327:                assertConfigurable();
3328:
3329:                jtaJndiLocation = jndi;
3330:            }
3331:
3332:            /**
3333:             * Accessor for the JNDI location to use (if any) to get the JTA txn manager.
3334:             * @return the JNDI location to find the JTA transaction manager.
3335:             */
3336:            public String getJtaJndiLocation() {
3337:                return jtaJndiLocation;
3338:            }
3339:
3340:            /**
3341:             * Whether with datastore transactions we delay operations until commit.
3342:             * @param flag Whether we should delay all datastore ops til commit with datastore txns
3343:             */
3344:            public synchronized void setDatastoreTransactionsDelayOperations(
3345:                    boolean flag) {
3346:                assertConfigurable();
3347:                datastoreTransactionDelayOperations = flag;
3348:            }
3349:
3350:            /**
3351:             * Whether with datastore transactions we delay operations until commit.
3352:             * @return Whether we should delay all datastore ops til commit with datastore txns
3353:             */
3354:            public boolean getDatastoreTransactionsDelayOperations() {
3355:                return datastoreTransactionDelayOperations;
3356:            }
3357:
3358:            /**
3359:             * Mutator for the limit of number of dirty objects before a flush happens with 
3360:             * datastore transactions.
3361:             * @param limit Limit on number of dirty objects before a flush happens with datastore txns
3362:             */
3363:            protected synchronized void setDatastoreTransactionFlushLimit(
3364:                    int limit) {
3365:                assertConfigurable();
3366:
3367:                datastoreTransactionFlushLimit = limit;
3368:            }
3369:
3370:            /**
3371:             * Accessor for the limit on number of dirty objects before a flush happens with 
3372:             * datastore transactions.
3373:             * @return Number of dirty objects before a flush happens with datastore transactions
3374:             */
3375:            public int getDatastoreTransactionFlushLimit() {
3376:                return datastoreTransactionFlushLimit;
3377:            }
3378:
3379:            /**
3380:             * Set the DB4O Output File name.
3381:             * @param file name of the DB4O Output file
3382:             */
3383:            public synchronized void setDb4oOutputFile(String file) {
3384:                assertConfigurable();
3385:                db4oOutputFile = file;
3386:            }
3387:
3388:            /**
3389:             * Get the name of the DB4O Output File
3390:             * @return DB4O Output File
3391:             */
3392:            public String getDb4oOutputFile() {
3393:                return db4oOutputFile;
3394:            }
3395:
3396:            /**
3397:             * Set whether to flush DB4O file buffers at commit
3398:             * @param flush Whether to flush file buffers at commit with DB4O
3399:             */
3400:            public synchronized void setDb4oFlushFileBuffers(boolean flush) {
3401:                assertConfigurable();
3402:                db4oFlushFileBuffers = flush;
3403:            }
3404:
3405:            /**
3406:             * Accessor for whether to flush DB4O file buffers on commit.
3407:             * @return Whether to flush file buffers
3408:             */
3409:            public boolean getDb4oFlushFileBuffers() {
3410:                return db4oFlushFileBuffers;
3411:            }
3412:
3413:            /**
3414:             * Set whether to generate UUIDs.
3415:             * @param gen Whether to generate UUIDs
3416:             */
3417:            public synchronized void setDb4oGenerateUUIDs(boolean gen) {
3418:                assertConfigurable();
3419:                db4oGenerateUUIDs = gen;
3420:            }
3421:
3422:            /**
3423:             * Accessor for whether to generate UUIDs.
3424:             * @return Whether to generate UUIDs
3425:             */
3426:            public boolean getDb4oGenerateUUIDs() {
3427:                return db4oGenerateUUIDs;
3428:            }
3429:
3430:            /**
3431:             * Accessor for the suffix for table identifiers
3432:             * @param value the suffix for table identifiers
3433:             */
3434:            public synchronized void setPropertiesFile(String value) {
3435:                assertConfigurable();
3436:                if (value == null) {
3437:                    return;
3438:                }
3439:                if (this .propertiesFileName != null) {
3440:                    // Already have a properties file read in
3441:                    JPOXLogger.PERSISTENCE.warn(LOCALISER.msg("008013",
3442:                            this .propertiesFileName, value));
3443:                    return;
3444:                }
3445:
3446:                Properties props = new Properties();
3447:
3448:                //try to load the persistence factory properties file
3449:                File file = new File(value);
3450:                if (file.exists()) {
3451:                    this .propertiesFileName = value;
3452:                    try {
3453:                        InputStream is = new FileInputStream(file);
3454:                        props.load(is);
3455:                        is.close();
3456:                    } catch (FileNotFoundException e) {
3457:                        this .propertiesFileName = null;
3458:                        throw new JPOXUserException(LOCALISER.msg("008014",
3459:                                value), e).setFatal();
3460:                    } catch (IOException e) {
3461:                        this .propertiesFileName = null;
3462:                        throw new JPOXUserException(LOCALISER.msg("008014",
3463:                                value), e).setFatal();
3464:                    }
3465:                } else {
3466:                    // Try to load it as a resource in the CLASSPATH
3467:                    try {
3468:                        InputStream is = PersistenceConfiguration.class
3469:                                .getClassLoader().getResourceAsStream(value);
3470:                        props.load(is);
3471:                        is.close();
3472:                        this .propertiesFileName = value;
3473:                    } catch (Exception e) {
3474:                        // Still not loadable so throw exception
3475:                        throw new JPOXUserException(LOCALISER.msg("008014",
3476:                                value), e).setFatal();
3477:                    }
3478:                }
3479:
3480:                setOptions(props);
3481:            }
3482:
3483:            /**
3484:             * Accessor for the JDO MetaData file extension.
3485:             * @return Returns the JDO metadata File Extension.
3486:             */
3487:            public String getJdoMetaDataFileExtension() {
3488:                return jdoMetaDataFileExtension;
3489:            }
3490:
3491:            /**
3492:             * Mutator for the JDO MetaData file extension.
3493:             * @param metadataFileExtension The JDO metadata File Extension to set.
3494:             */
3495:            public void setJdoMetaDataFileExtension(String metadataFileExtension) {
3496:                this .jdoMetaDataFileExtension = metadataFileExtension;
3497:            }
3498:
3499:            /**
3500:             * Accessor for the ORM MetaData file extension.
3501:             * @return Returns the ORM metadata File Extension.
3502:             */
3503:            public String getOrmMetaDataFileExtension() {
3504:                return ormMetaDataFileExtension;
3505:            }
3506:
3507:            /**
3508:             * Mutator for the ORM MetaData file extension.
3509:             * @param metadataFileExtension The ORM metadata File Extension to set.
3510:             */
3511:            public void setOrmMetaDataFileExtension(String metadataFileExtension) {
3512:                this .ormMetaDataFileExtension = metadataFileExtension;
3513:            }
3514:
3515:            /**
3516:             * Accessor for the JDO Query MetaData file extension.
3517:             * @return Returns the JDO Query metadata File Extension.
3518:             */
3519:            public String getJdoqueryMetaDataFileExtension() {
3520:                return jdoqueryMetaDataFileExtension;
3521:            }
3522:
3523:            /**
3524:             * Mutator for the JDO Query MetaData file extension.
3525:             * @param metadataFileExtension The JDO Query metadata File Extension to set.
3526:             */
3527:            public void setJdoqueryMetaDataFileExtension(
3528:                    String metadataFileExtension) {
3529:                this .jdoqueryMetaDataFileExtension = metadataFileExtension;
3530:            }
3531:
3532:            /**
3533:             * Accessor for whether to validate the metadata.
3534:             * @return Returns whether to validate the metadata
3535:             */
3536:            public boolean getMetaDataValidate() {
3537:                return metadataValidate;
3538:            }
3539:
3540:            /**
3541:             * Mutator for whether to validate the metadata
3542:             * @param validate Whether to validate the metadata
3543:             */
3544:            public void setMetaDataValidate(boolean validate) {
3545:                this .metadataValidate = validate;
3546:            }
3547:
3548:            /**
3549:             * Accessor for the class name of the annotations manager.
3550:             * @return Class name for the annotations manager
3551:             */
3552:            public String getMetaDataAnnotationsManager() {
3553:                return metadataAnnotationsManager;
3554:            }
3555:
3556:            /**
3557:             * Mutator for the metadata annotations manager
3558:             * @param mgr Name of the annotations manager
3559:             */
3560:            public void setMetaDataAnnotationsManager(String mgr) {
3561:                this .metadataAnnotationsManager = mgr;
3562:            }
3563:
3564:            /**
3565:             * Method to return whether we include codes in any output messages.
3566:             * @return Whether to includes codes in messages
3567:             */
3568:            public Boolean getMessagesIncludeCodes() {
3569:                return (messagesIncludeCodes ? Boolean.TRUE : Boolean.FALSE);
3570:            }
3571:
3572:            /**
3573:             * Mutator for whether to includes codes in messages.
3574:             * @param include Whether to include codes in messages
3575:             */
3576:            public void setMessagesIncludeCodes(Boolean include) {
3577:                if (include != null) {
3578:                    this .messagesIncludeCodes = include.booleanValue();
3579:                    // This sets it globally, even if only for this PMF. Localiser needs changes to do it per PMF
3580:                    Localiser
3581:                            .setDisplayCodesInMessages(this .messagesIncludeCodes);
3582:                }
3583:            }
3584:
3585:            /**
3586:             * Mutator for the {@link PluginRegistry} class name. If one is provided, it will be used as registry for plug-ins
3587:             * @return the fully qualified class {@link PluginRegistry}
3588:             */
3589:            public String getPluginRegistryClassName() {
3590:                return pluginRegistryClassName;
3591:            }
3592:
3593:            /**
3594:             * Mutator for the {@link PluginRegistry} class name. If one is provided, it will be used as registry for plug-ins
3595:             * @param pluginRegistryClassName the fully qualified class {@link PluginRegistry}
3596:             */
3597:            public void setPluginRegistryClassName(
3598:                    String pluginRegistryClassName) {
3599:                this .pluginRegistryClassName = pluginRegistryClassName;
3600:            }
3601:
3602:            /**
3603:             * Mutator for what check the plugin registry should make on duplicate bundles.
3604:             * Typically only applies to the non-managed registry.
3605:             * @return What check the registry should perform on duplicate bundles
3606:             */
3607:            public String getPluginRegistryBundleCheck() {
3608:                return pluginRegistryBundleCheck;
3609:            }
3610:
3611:            /**
3612:             * Mutator for what check the plugin registry should perform on dup bundles.
3613:             * Can be "EXCEPTION", "LOG", or "NONE".
3614:             * @param check the check to perform
3615:             */
3616:            public void setPluginRegistryBundleCheck(String check) {
3617:                if (StringUtils.isWhitespace(check)
3618:                        || (!check.equalsIgnoreCase("EXCEPTION")
3619:                                && !check.equalsIgnoreCase("LOG") && !check
3620:                                .equalsIgnoreCase("NONE"))) {
3621:                    return;
3622:                }
3623:                this .pluginRegistryBundleCheck = check.toUpperCase();
3624:            }
3625:
3626:            /**
3627:             * Asserts that a change to a configuration property is allowed.
3628:             */
3629:            protected void assertConfigurable() {
3630:                if (!configurable) {
3631:                    throw new JDOUserException(LOCALISER.msg("008016"));
3632:                }
3633:            }
3634:
3635:            /**
3636:             * Initialize the PROPERTY_SETTERS Map.
3637:             * @return  The PROPERTY_SETTERS Map.
3638:             */
3639:            protected Map initPropertySetters() {
3640:                final Map map = new HashMap();
3641:
3642:                // JDO Standard properties
3643:                map.put(PersistenceConfiguration.JDO_OPTIMISTIC_PROPERTY,
3644:                        new StringPropertySetter() {
3645:                            public void set(
3646:                                    PersistenceConfiguration configuration,
3647:                                    String s) {
3648:                                configuration.setOptimistic(Boolean.valueOf(s)
3649:                                        .booleanValue());
3650:                            }
3651:                        });
3652:                map.put(PersistenceConfiguration.JDO_RETAINVALUES_PROPERTY,
3653:                        new StringPropertySetter() {
3654:                            public void set(
3655:                                    PersistenceConfiguration configuration,
3656:                                    String s) {
3657:                                configuration.setRetainValues(Boolean
3658:                                        .valueOf(s).booleanValue());
3659:                            }
3660:                        });
3661:                map.put(PersistenceConfiguration.JDO_RESTOREVALUES_PROPERTY,
3662:                        new StringPropertySetter() {
3663:                            public void set(
3664:                                    PersistenceConfiguration configuration,
3665:                                    String s) {
3666:                                configuration.setRestoreValues(Boolean.valueOf(
3667:                                        s).booleanValue());
3668:                            }
3669:                        });
3670:                map.put(PersistenceConfiguration.JDO_IGNORECACHE_PROPERTY,
3671:                        new StringPropertySetter() {
3672:                            public void set(
3673:                                    PersistenceConfiguration configuration,
3674:                                    String s) {
3675:                                configuration.setIgnoreCache(Boolean.valueOf(s)
3676:                                        .booleanValue());
3677:                            }
3678:                        });
3679:                map
3680:                        .put(
3681:                                PersistenceConfiguration.JDO_DETACHALLONCOMMIT_PROPERTY,
3682:                                new StringPropertySetter() {
3683:                                    public void set(
3684:                                            PersistenceConfiguration configuration,
3685:                                            String s) {
3686:                                        configuration
3687:                                                .setDetachAllOnCommit(Boolean
3688:                                                        .valueOf(s)
3689:                                                        .booleanValue());
3690:                                    }
3691:                                });
3692:                map.put(PersistenceConfiguration.JDO_COPYONATTACH_PROPERTY,
3693:                        new StringPropertySetter() {
3694:                            public void set(
3695:                                    PersistenceConfiguration configuration,
3696:                                    String s) {
3697:                                configuration.setCopyOnAttach(Boolean
3698:                                        .valueOf(s).booleanValue());
3699:                            }
3700:                        });
3701:                map
3702:                        .put(
3703:                                PersistenceConfiguration.JDO_NONTRANSACTIONAL_READ_PROPERTY,
3704:                                new StringPropertySetter() {
3705:                                    public void set(
3706:                                            PersistenceConfiguration configuration,
3707:                                            String s) {
3708:                                        configuration
3709:                                                .setNontransactionalRead(Boolean
3710:                                                        .valueOf(s)
3711:                                                        .booleanValue());
3712:                                    }
3713:                                });
3714:                map
3715:                        .put(
3716:                                PersistenceConfiguration.JDO_NONTRANSACTIONAL_WRITE_PROPERTY,
3717:                                new StringPropertySetter() {
3718:                                    public void set(
3719:                                            PersistenceConfiguration configuration,
3720:                                            String s) {
3721:                                        configuration
3722:                                                .setNontransactionalWrite(Boolean
3723:                                                        .valueOf(s)
3724:                                                        .booleanValue());
3725:                                    }
3726:                                });
3727:                map.put(PersistenceConfiguration.JDO_MULTITHREADED_PROPERTY,
3728:                        new StringPropertySetter() {
3729:                            public void set(
3730:                                    PersistenceConfiguration configuration,
3731:                                    String s) {
3732:                                configuration.setMultithreaded(Boolean.valueOf(
3733:                                        s).booleanValue());
3734:                            }
3735:                        });
3736:                map
3737:                        .put(
3738:                                PersistenceConfiguration.JDO_DATASTORE_USERNAME_PROPERTY,
3739:                                new StringPropertySetter() {
3740:                                    public void set(
3741:                                            PersistenceConfiguration configuration,
3742:                                            String s) {
3743:                                        configuration.setConnectionUserName(s);
3744:                                    }
3745:                                });
3746:                map
3747:                        .put(
3748:                                PersistenceConfiguration.JDO_DATASTORE_PASSWORD_PROPERTY,
3749:                                new StringPropertySetter() {
3750:                                    public void set(
3751:                                            PersistenceConfiguration configuration,
3752:                                            String s) {
3753:                                        configuration.setConnectionPassword(s);
3754:                                    }
3755:                                });
3756:                map
3757:                        .put(
3758:                                PersistenceConfiguration.JDO_DATASTORE_DRIVERNAME_PROPERTY,
3759:                                new StringPropertySetter() {
3760:                                    public void set(
3761:                                            PersistenceConfiguration configuration,
3762:                                            String s) {
3763:                                        configuration
3764:                                                .setConnectionDriverName(s);
3765:                                    }
3766:                                });
3767:                map.put(PersistenceConfiguration.JDO_DATASTORE_URL_PROPERTY,
3768:                        new StringPropertySetter() {
3769:                            public void set(
3770:                                    PersistenceConfiguration configuration,
3771:                                    String s) {
3772:                                configuration.setConnectionURL(s);
3773:                            }
3774:                        });
3775:                map
3776:                        .put(
3777:                                PersistenceConfiguration.JDO_CONNECTION_FACTORY_NAME_PROPERTY,
3778:                                new StringPropertySetter() {
3779:                                    public void set(
3780:                                            PersistenceConfiguration configuration,
3781:                                            String s) {
3782:                                        configuration
3783:                                                .setConnectionFactoryName(s);
3784:                                    }
3785:                                });
3786:                map
3787:                        .put(
3788:                                PersistenceConfiguration.JDO_CONNECTION_FACTORY2_NAME_PROPERTY,
3789:                                new StringPropertySetter() {
3790:                                    public void set(
3791:                                            PersistenceConfiguration configuration,
3792:                                            String s) {
3793:                                        configuration
3794:                                                .setConnectionFactory2Name(s);
3795:                                    }
3796:                                });
3797:                map
3798:                        .put(
3799:                                PersistenceConfiguration.JDO_CONNECTION_FACTORY_PROPERTY,
3800:                                new ObjectPropertySetter() {
3801:                                    public void set(
3802:                                            PersistenceConfiguration configuration,
3803:                                            Object obj) {
3804:                                        configuration.setConnectionFactory(obj);
3805:                                    }
3806:                                });
3807:                map
3808:                        .put(
3809:                                PersistenceConfiguration.JDO_CONNECTION_FACTORY2_PROPERTY,
3810:                                new ObjectPropertySetter() {
3811:                                    public void set(
3812:                                            PersistenceConfiguration configuration,
3813:                                            Object obj) {
3814:                                        configuration
3815:                                                .setConnectionFactory2(obj);
3816:                                    }
3817:                                });
3818:                map.put(PersistenceConfiguration.JDO_MAPPING_PROPERTY,
3819:                        new StringPropertySetter() {
3820:                            public void set(
3821:                                    PersistenceConfiguration configuration,
3822:                                    String s) {
3823:                                configuration.setMapping(s);
3824:                            }
3825:                        });
3826:                map.put(PersistenceConfiguration.JDO_MAPPING_CATALOG_PROPERTY,
3827:                        new StringPropertySetter() {
3828:                            public void set(
3829:                                    PersistenceConfiguration configuration,
3830:                                    String s) {
3831:                                configuration.setCatalog(s);
3832:                            }
3833:                        });
3834:                map.put(PersistenceConfiguration.JDO_MAPPING_SCHEMA_PROPERTY,
3835:                        new StringPropertySetter() {
3836:                            public void set(
3837:                                    PersistenceConfiguration configuration,
3838:                                    String s) {
3839:                                configuration.setSchema(s);
3840:                            }
3841:                        });
3842:                map.put(PersistenceConfiguration.JDO_TRANSACTION_TYPE_PROPERTY,
3843:                        new StringPropertySetter() {
3844:                            public void set(
3845:                                    PersistenceConfiguration configuration,
3846:                                    String s) {
3847:                                configuration.setTransactionType(s);
3848:                            }
3849:                        });
3850:                map.put(PersistenceConfiguration.JDO_NAME_PROPERTY,
3851:                        new StringPropertySetter() {
3852:                            public void set(
3853:                                    PersistenceConfiguration configuration,
3854:                                    String s) {
3855:                                configuration.setName(s);
3856:                            }
3857:                        });
3858:                map
3859:                        .put(
3860:                                PersistenceConfiguration.JDO_PERSISTENCE_UNIT_NAME_PROPERTY,
3861:                                new StringPropertySetter() {
3862:                                    public void set(
3863:                                            PersistenceConfiguration configuration,
3864:                                            String s) {
3865:                                        configuration.setPersistenceUnitName(s);
3866:                                    }
3867:                                });
3868:                map
3869:                        .put(
3870:                                PersistenceConfiguration.JDO_SERVER_TIMEZONE_ID_PROPERTY,
3871:                                new StringPropertySetter() {
3872:                                    public void set(
3873:                                            PersistenceConfiguration configuration,
3874:                                            String s) {
3875:                                        configuration.setServerTimeZoneID(s);
3876:                                    }
3877:                                });
3878:
3879:                map.put(PersistenceConfiguration.JPA_TRANSACTION_TYPE_PROPERTY,
3880:                        new StringPropertySetter() {
3881:                            public void set(
3882:                                    PersistenceConfiguration configuration,
3883:                                    String s) {
3884:                                configuration.setTransactionType(s);
3885:                            }
3886:                        });
3887:                map
3888:                        .put(
3889:                                PersistenceConfiguration.JPA_ONE_TO_MANY_UNI_FK_PROPERTY,
3890:                                new StringPropertySetter() {
3891:                                    public void set(
3892:                                            PersistenceConfiguration configuration,
3893:                                            String s) {
3894:                                        configuration
3895:                                                .setJpaOneToManyUniFkRelations(Boolean
3896:                                                        .valueOf(s)
3897:                                                        .booleanValue());
3898:                                    }
3899:                                });
3900:
3901:                // JPOX Extension properties
3902:                map.put(PersistenceConfiguration.STORE_MANAGER_TYPE,
3903:                        new StringPropertySetter() {
3904:                            public void set(
3905:                                    PersistenceConfiguration configuration,
3906:                                    String s) {
3907:                                configuration.setStoreManagerType(s);
3908:                            }
3909:                        });
3910:                map.put(PersistenceConfiguration.MANAGED_RUNTIME_PROPERTY,
3911:                        new StringPropertySetter() {
3912:                            public void set(
3913:                                    PersistenceConfiguration configuration,
3914:                                    String s) {
3915:                                configuration.setManagedRuntime(Boolean
3916:                                        .valueOf(s));
3917:                            }
3918:                        });
3919:                map.put(PersistenceConfiguration.PERSISTENCE_API_NAME,
3920:                        new StringPropertySetter() {
3921:                            public void set(
3922:                                    PersistenceConfiguration configuration,
3923:                                    String s) {
3924:                                configuration.setPersistenceApiName(s);
3925:                            }
3926:                        });
3927:                map.put(PersistenceConfiguration.MANAGE_RELATIONSHIPS_PROPERTY,
3928:                        new StringPropertySetter() {
3929:                            public void set(
3930:                                    PersistenceConfiguration configuration,
3931:                                    String s) {
3932:                                configuration.setManageRelationships(Boolean
3933:                                        .valueOf(s).booleanValue());
3934:                            }
3935:                        });
3936:                map
3937:                        .put(
3938:                                PersistenceConfiguration.MANAGE_RELATIONSHIPS_CHECKS_PROPERTY,
3939:                                new StringPropertySetter() {
3940:                                    public void set(
3941:                                            PersistenceConfiguration configuration,
3942:                                            String s) {
3943:                                        configuration
3944:                                                .setManageRelationshipsChecks(Boolean
3945:                                                        .valueOf(s)
3946:                                                        .booleanValue());
3947:                                    }
3948:                                });
3949:                map
3950:                        .put(
3951:                                PersistenceConfiguration.FIND_OBJECT_CHECK_INHERITANCE_PROPERTY,
3952:                                new StringPropertySetter() {
3953:                                    public void set(
3954:                                            PersistenceConfiguration configuration,
3955:                                            String s) {
3956:                                        configuration
3957:                                                .setFindObjectCheckInheritance(Boolean
3958:                                                        .valueOf(s)
3959:                                                        .booleanValue());
3960:                                    }
3961:                                });
3962:                map
3963:                        .put(
3964:                                PersistenceConfiguration.ATTACH_SAME_DATASTORE_PROPERTY,
3965:                                new StringPropertySetter() {
3966:                                    public void set(
3967:                                            PersistenceConfiguration configuration,
3968:                                            String s) {
3969:                                        configuration
3970:                                                .setAttachSameDatastore(Boolean
3971:                                                        .valueOf(s)
3972:                                                        .booleanValue());
3973:                                    }
3974:                                });
3975:                map.put(PersistenceConfiguration.DETACH_ON_CLOSE_PROPERTY,
3976:                        new StringPropertySetter() {
3977:                            public void set(
3978:                                    PersistenceConfiguration configuration,
3979:                                    String s) {
3980:                                configuration.setDetachOnClose(Boolean.valueOf(
3981:                                        s).booleanValue());
3982:                            }
3983:                        });
3984:                map
3985:                        .put(
3986:                                PersistenceConfiguration.DATASTORE_ADAPTER_CLASSNAME_PROPERTY,
3987:                                new StringPropertySetter() {
3988:                                    public void set(
3989:                                            PersistenceConfiguration configuration,
3990:                                            String s) {
3991:                                        configuration
3992:                                                .setDatastoreAdapterClassName(s);
3993:                                    }
3994:                                });
3995:                map
3996:                        .put(
3997:                                PersistenceConfiguration.STATEMENT_BATCH_LIMIT_PROPERTY,
3998:                                new StringPropertySetter() {
3999:                                    public void set(
4000:                                            PersistenceConfiguration configuration,
4001:                                            String s) {
4002:                                        try {
4003:                                            int len = (new Integer(s))
4004:                                                    .intValue();
4005:                                            configuration
4006:                                                    .setStatementBatchLimit(len);
4007:                                        } catch (NumberFormatException nfe) {
4008:                                            // Do nothing
4009:                                        }
4010:                                    }
4011:                                });
4012:                map
4013:                        .put(
4014:                                PersistenceConfiguration.CHECK_EXIST_TABLES_VIEWS_PROPERTY,
4015:                                new StringPropertySetter() {
4016:                                    public void set(
4017:                                            PersistenceConfiguration configuration,
4018:                                            String s) {
4019:                                        configuration
4020:                                                .setCheckExistTablesOrViews(Boolean
4021:                                                        .valueOf(s)
4022:                                                        .booleanValue());
4023:                                    }
4024:                                });
4025:                map.put(PersistenceConfiguration.VALIDATE_TABLES_PROPERTY,
4026:                        new StringPropertySetter() {
4027:                            public void set(
4028:                                    PersistenceConfiguration configuration,
4029:                                    String s) {
4030:                                configuration.setValidateTables(Boolean
4031:                                        .valueOf(s).booleanValue());
4032:                            }
4033:                        });
4034:                map.put(PersistenceConfiguration.VALIDATE_COLUMNS_PROPERTY,
4035:                        new StringPropertySetter() {
4036:                            public void set(
4037:                                    PersistenceConfiguration configuration,
4038:                                    String s) {
4039:                                configuration.setValidateColumns(Boolean
4040:                                        .valueOf(s).booleanValue());
4041:                            }
4042:                        });
4043:                map
4044:                        .put(
4045:                                PersistenceConfiguration.ADD_UNIQUE_CONSTRAINT_MAP_INVERSE_PROPERTY,
4046:                                new StringPropertySetter() {
4047:                                    public void set(
4048:                                            PersistenceConfiguration configuration,
4049:                                            String s) {
4050:                                        configuration
4051:                                                .setUniqueConstraintsMapInverse(Boolean
4052:                                                        .valueOf(s)
4053:                                                        .booleanValue());
4054:                                    }
4055:                                });
4056:                map.put(PersistenceConfiguration.VALIDATE_CONSTRAINTS_PROPERTY,
4057:                        new StringPropertySetter() {
4058:                            public void set(
4059:                                    PersistenceConfiguration configuration,
4060:                                    String s) {
4061:                                configuration.setValidateConstraints(Boolean
4062:                                        .valueOf(s).booleanValue());
4063:                            }
4064:                        });
4065:                map.put(PersistenceConfiguration.AUTO_CREATE_SCHEMA_PROPERTY,
4066:                        new StringPropertySetter() {
4067:                            public void set(
4068:                                    PersistenceConfiguration configuration,
4069:                                    String s) {
4070:                                configuration.setAutoCreateSchema(Boolean
4071:                                        .valueOf(s).booleanValue());
4072:                            }
4073:                        });
4074:                map.put(PersistenceConfiguration.AUTO_CREATE_TABLES_PROPERTY,
4075:                        new StringPropertySetter() {
4076:                            public void set(
4077:                                    PersistenceConfiguration configuration,
4078:                                    String s) {
4079:                                configuration.setAutoCreateTables(Boolean
4080:                                        .valueOf(s).booleanValue());
4081:                            }
4082:                        });
4083:                map.put(PersistenceConfiguration.AUTO_CREATE_COLUMNS_PROPERTY,
4084:                        new StringPropertySetter() {
4085:                            public void set(
4086:                                    PersistenceConfiguration configuration,
4087:                                    String s) {
4088:                                configuration.setAutoCreateColumns(Boolean
4089:                                        .valueOf(s).booleanValue());
4090:                            }
4091:                        });
4092:                map
4093:                        .put(
4094:                                PersistenceConfiguration.AUTO_CREATE_CONSTRAINTS_PROPERTY,
4095:                                new StringPropertySetter() {
4096:                                    public void set(
4097:                                            PersistenceConfiguration configuration,
4098:                                            String s) {
4099:                                        configuration
4100:                                                .setAutoCreateConstraints(Boolean
4101:                                                        .valueOf(s)
4102:                                                        .booleanValue());
4103:                                    }
4104:                                });
4105:                map
4106:                        .put(
4107:                                PersistenceConfiguration.AUTO_CREATE_WARN_ON_ERROR_PROPERTY,
4108:                                new StringPropertySetter() {
4109:                                    public void set(
4110:                                            PersistenceConfiguration configuration,
4111:                                            String s) {
4112:                                        configuration
4113:                                                .setAutoCreateWarnOnError(Boolean
4114:                                                        .valueOf(s)
4115:                                                        .booleanValue());
4116:                                    }
4117:                                });
4118:                map
4119:                        .put(
4120:                                PersistenceConfiguration.INITIALIZE_COLUMN_INFO_PROPERTY,
4121:                                new StringPropertySetter() {
4122:                                    public void set(
4123:                                            PersistenceConfiguration configuration,
4124:                                            String s) {
4125:                                        configuration
4126:                                                .setInitializeColumnInfo(s);
4127:                                    }
4128:                                });
4129:
4130:                map.put(PersistenceConfiguration.AUTO_START_MECHANISM_PROPERTY,
4131:                        new StringPropertySetter() {
4132:                            public void set(
4133:                                    PersistenceConfiguration configuration,
4134:                                    String s) {
4135:                                configuration.setAutoStartMechanism(s);
4136:                            }
4137:                        });
4138:                map
4139:                        .put(
4140:                                PersistenceConfiguration.AUTO_START_MECHANISM_XML_FILE_PROPERTY,
4141:                                new StringPropertySetter() {
4142:                                    public void set(
4143:                                            PersistenceConfiguration configuration,
4144:                                            String s) {
4145:                                        configuration
4146:                                                .setAutoStartMechanismXmlFile(s);
4147:                                    }
4148:                                });
4149:                map
4150:                        .put(
4151:                                PersistenceConfiguration.AUTO_START_MECHANISM_MODE_PROPERTY,
4152:                                new StringPropertySetter() {
4153:                                    public void set(
4154:                                            PersistenceConfiguration configuration,
4155:                                            String s) {
4156:                                        configuration
4157:                                                .setAutoStartMechanismMode(s);
4158:                                    }
4159:                                });
4160:                map
4161:                        .put(
4162:                                PersistenceConfiguration.AUTO_START_CLASS_NAMES_PROPERTY,
4163:                                new StringPropertySetter() {
4164:                                    public void set(
4165:                                            PersistenceConfiguration configuration,
4166:                                            String s) {
4167:                                        configuration.setAutoStartClassNames(s);
4168:                                    }
4169:                                });
4170:
4171:                map.put(PersistenceConfiguration.READ_ONLY_DATASTORE_PROPERTY,
4172:                        new StringPropertySetter() {
4173:                            public void set(
4174:                                    PersistenceConfiguration configuration,
4175:                                    String s) {
4176:                                configuration.setReadOnlyDatastore(Boolean
4177:                                        .valueOf(s).booleanValue());
4178:                            }
4179:                        });
4180:                map
4181:                        .put(
4182:                                PersistenceConfiguration.READ_ONLY_DATASTORE_ACTION_PROPERTY,
4183:                                new StringPropertySetter() {
4184:                                    public void set(
4185:                                            PersistenceConfiguration configuration,
4186:                                            String s) {
4187:                                        configuration
4188:                                                .setReadOnlyDatastoreAction(s);
4189:                                    }
4190:                                });
4191:                map.put(PersistenceConfiguration.FIXED_DATASTORE_PROPERTY,
4192:                        new StringPropertySetter() {
4193:                            public void set(
4194:                                    PersistenceConfiguration configuration,
4195:                                    String s) {
4196:                                configuration.setFixedDatastore(Boolean
4197:                                        .valueOf(s).booleanValue());
4198:                            }
4199:                        });
4200:                map
4201:                        .put(
4202:                                PersistenceConfiguration.RDBMS_CONSTRAINT_CREATE_MODE_PROPERTY,
4203:                                new StringPropertySetter() {
4204:                                    public void set(
4205:                                            PersistenceConfiguration configuration,
4206:                                            String s) {
4207:                                        configuration
4208:                                                .setRDBMSConstraintCreateMode(s);
4209:                                    }
4210:                                });
4211:                map.put(PersistenceConfiguration.DELETION_POLICY_PROPERTY,
4212:                        new StringPropertySetter() {
4213:                            public void set(
4214:                                    PersistenceConfiguration configuration,
4215:                                    String s) {
4216:                                configuration.setDeletionPolicy(s);
4217:                            }
4218:                        });
4219:                map.put(PersistenceConfiguration.IDENTIFIER_FACTORY_PROPERTY,
4220:                        new StringPropertySetter() {
4221:                            public void set(
4222:                                    PersistenceConfiguration configuration,
4223:                                    String s) {
4224:                                configuration.setIdentifierFactory(s);
4225:                            }
4226:                        });
4227:                map.put(PersistenceConfiguration.IDENTIFIER_CASE_PROPERTY,
4228:                        new StringPropertySetter() {
4229:                            public void set(
4230:                                    PersistenceConfiguration configuration,
4231:                                    String s) {
4232:                                configuration.setIdentifierCase(s);
4233:                            }
4234:                        });
4235:                map
4236:                        .put(
4237:                                PersistenceConfiguration.IDENTIFIER_WORD_SEPARATOR_PROPERTY,
4238:                                new StringPropertySetter() {
4239:                                    public void set(
4240:                                            PersistenceConfiguration configuration,
4241:                                            String s) {
4242:                                        configuration
4243:                                                .setIdentifierWordSeparator(s);
4244:                                    }
4245:                                });
4246:                map
4247:                        .put(
4248:                                PersistenceConfiguration.IDENTIFIER_TABLE_PREFIX_PROPERTY,
4249:                                new StringPropertySetter() {
4250:                                    public void set(
4251:                                            PersistenceConfiguration configuration,
4252:                                            String s) {
4253:                                        configuration
4254:                                                .setIdentifierTablePrefix(s);
4255:                                    }
4256:                                });
4257:                map
4258:                        .put(
4259:                                PersistenceConfiguration.IDENTIFIER_TABLE_SUFFIX_PROPERTY,
4260:                                new StringPropertySetter() {
4261:                                    public void set(
4262:                                            PersistenceConfiguration configuration,
4263:                                            String s) {
4264:                                        configuration
4265:                                                .setIdentifierTableSuffix(s);
4266:                                    }
4267:                                });
4268:
4269:                map
4270:                        .put(
4271:                                PersistenceConfiguration.CONNECTION_POOLING_TYPE_PROPERTY,
4272:                                new StringPropertySetter() {
4273:                                    public void set(
4274:                                            PersistenceConfiguration configuration,
4275:                                            String s) {
4276:                                        configuration
4277:                                                .setConnectionPoolingType(s);
4278:                                    }
4279:                                });
4280:                map
4281:                        .put(
4282:                                PersistenceConfiguration.CONNECTION_POOLING_CONFIGURATION_FILE_PROPERTY,
4283:                                new StringPropertySetter() {
4284:                                    public void set(
4285:                                            PersistenceConfiguration configuration,
4286:                                            String s) {
4287:                                        configuration
4288:                                                .setConnectionPoolingConfigurationFile(s);
4289:                                    }
4290:                                });
4291:
4292:                map
4293:                        .put(
4294:                                PersistenceConfiguration.DEFAULT_INHERITANCE_STRATEGY_PROPERTY,
4295:                                new StringPropertySetter() {
4296:                                    public void set(
4297:                                            PersistenceConfiguration configuration,
4298:                                            String s) {
4299:                                        configuration
4300:                                                .setDefaultInheritanceStrategy(s);
4301:                                    }
4302:                                });
4303:                map.put(PersistenceConfiguration.USE_UPDATE_LOCK_PROPERTY,
4304:                        new StringPropertySetter() {
4305:                            public void set(
4306:                                    PersistenceConfiguration configuration,
4307:                                    String s) {
4308:                                configuration.setUseUpdateLock(Boolean.valueOf(
4309:                                        s).booleanValue());
4310:                            }
4311:                        });
4312:
4313:                map
4314:                        .put(
4315:                                PersistenceConfiguration.DATASTORE_CLASS_ADDITION_MAX_RETRIES_PROPERTY,
4316:                                new StringPropertySetter() {
4317:                                    public void set(
4318:                                            PersistenceConfiguration configuration,
4319:                                            String s) {
4320:                                        try {
4321:                                            int len = (new Integer(s))
4322:                                                    .intValue();
4323:                                            configuration
4324:                                                    .setDatastoreClassAdditionMaxRetries(len);
4325:                                        } catch (NumberFormatException nfe) {
4326:                                            // Do nothing
4327:                                        }
4328:                                    }
4329:                                });
4330:                map
4331:                        .put(
4332:                                PersistenceConfiguration.TRANSACTION_ISOLATION_PROPERTY,
4333:                                new StringPropertySetter() {
4334:                                    public void set(
4335:                                            PersistenceConfiguration configuration,
4336:                                            String s) {
4337:                                        configuration
4338:                                                .setTransactionIsolation(s);
4339:                                    }
4340:                                });
4341:                map.put(PersistenceConfiguration.JTA_LOCATOR_PROPERTY,
4342:                        new StringPropertySetter() {
4343:                            public void set(
4344:                                    PersistenceConfiguration configuration,
4345:                                    String s) {
4346:                                configuration.setJtaLocator(s);
4347:                            }
4348:                        });
4349:                map.put(PersistenceConfiguration.JTA_JNDI_LOCATION_PROPERTY,
4350:                        new StringPropertySetter() {
4351:                            public void set(
4352:                                    PersistenceConfiguration configuration,
4353:                                    String s) {
4354:                                configuration.setJtaJndiLocation(s);
4355:                            }
4356:                        });
4357:                map
4358:                        .put(
4359:                                PersistenceConfiguration.DATASTORE_TXN_DELAY_OPERATIONS_PROPERTY,
4360:                                new StringPropertySetter() {
4361:                                    public void set(
4362:                                            PersistenceConfiguration configuration,
4363:                                            String s) {
4364:                                        configuration
4365:                                                .setDatastoreTransactionsDelayOperations(Boolean
4366:                                                        .valueOf(s)
4367:                                                        .booleanValue());
4368:                                    }
4369:                                });
4370:                map
4371:                        .put(
4372:                                PersistenceConfiguration.DATASTORE_TXN_FLUSH_LIMIT_PROPERTY,
4373:                                new StringPropertySetter() {
4374:                                    public void set(
4375:                                            PersistenceConfiguration configuration,
4376:                                            String s) {
4377:                                        try {
4378:                                            int len = (new Integer(s))
4379:                                                    .intValue();
4380:                                            configuration
4381:                                                    .setDatastoreTransactionFlushLimit(len);
4382:                                        } catch (NumberFormatException nfe) {
4383:                                            // Do nothing
4384:                                        }
4385:                                    }
4386:                                });
4387:                map
4388:                        .put(
4389:                                PersistenceConfiguration.POID_TRANSACTION_ATTRIBUTE_PROPERTY,
4390:                                new StringPropertySetter() {
4391:                                    public void set(
4392:                                            PersistenceConfiguration configuration,
4393:                                            String s) {
4394:                                        configuration
4395:                                                .setPoidTransactionAttribute(s);
4396:                                    }
4397:                                });
4398:                map
4399:                        .put(
4400:                                PersistenceConfiguration.POID_TRANSACTION_ISOLATION_PROPERTY,
4401:                                new StringPropertySetter() {
4402:                                    public void set(
4403:                                            PersistenceConfiguration configuration,
4404:                                            String s) {
4405:                                        configuration
4406:                                                .setPoidTransactionIsolation(s);
4407:                                    }
4408:                                });
4409:
4410:                map
4411:                        .put(
4412:                                PersistenceConfiguration.PERSISTENCE_BY_REACHABILITY_AT_COMMIT,
4413:                                new StringPropertySetter() {
4414:                                    public void set(
4415:                                            PersistenceConfiguration configuration,
4416:                                            String s) {
4417:                                        configuration
4418:                                                .setPersistenceByReachabilityAtCommit(Boolean
4419:                                                        .valueOf(s)
4420:                                                        .booleanValue());
4421:                                    }
4422:                                });
4423:                map.put(PersistenceConfiguration.MAX_FETCH_DEPTH_PROPERTY,
4424:                        new StringPropertySetter() {
4425:                            public void set(
4426:                                    PersistenceConfiguration configuration,
4427:                                    String s) {
4428:                                try {
4429:                                    int len = (new Integer(s)).intValue();
4430:                                    configuration.setMaxFetchDepth(len);
4431:                                } catch (NumberFormatException nfe) {
4432:                                    // Do nothing
4433:                                }
4434:                            }
4435:                        });
4436:                map
4437:                        .put(
4438:                                PersistenceConfiguration.CLASS_LOADER_RESOLVER_NAME_PROPERTY,
4439:                                new StringPropertySetter() {
4440:                                    public void set(
4441:                                            PersistenceConfiguration configuration,
4442:                                            String s) {
4443:                                        configuration
4444:                                                .setClassLoaderResolverName(s);
4445:                                    }
4446:                                });
4447:                map
4448:                        .put(
4449:                                PersistenceConfiguration.IMPLEMENTATION_CREATOR_NAME_PROPERTY,
4450:                                new StringPropertySetter() {
4451:                                    public void set(
4452:                                            PersistenceConfiguration configuration,
4453:                                            String s) {
4454:                                        configuration
4455:                                                .setImplementationCreatorName(s);
4456:                                    }
4457:                                });
4458:                map
4459:                        .put(
4460:                                PersistenceConfiguration.DATASTORE_IDENTITY_CLASS_NAME_PROPERTY,
4461:                                new StringPropertySetter() {
4462:                                    public void set(
4463:                                            PersistenceConfiguration configuration,
4464:                                            String s) {
4465:                                        configuration
4466:                                                .setDatastoreIdentityClassName(s);
4467:                                    }
4468:                                });
4469:
4470:                // Query
4471:                map
4472:                        .put(
4473:                                PersistenceConfiguration.QUERY_FLUSH_BEFORE_EXECUTION_PROPERTY,
4474:                                new StringPropertySetter() {
4475:                                    public void set(
4476:                                            PersistenceConfiguration configuration,
4477:                                            String s) {
4478:                                        try {
4479:                                            boolean use = (new Boolean(s))
4480:                                                    .booleanValue();
4481:                                            configuration
4482:                                                    .setQueryFlushBeforeExecution(use);
4483:                                        } catch (NumberFormatException nfe) {
4484:                                            // Do nothing
4485:                                        }
4486:                                    }
4487:                                });
4488:                map.put(PersistenceConfiguration.QUERY_USE_FETCH_PLAN_PROPERTY,
4489:                        new StringPropertySetter() {
4490:                            public void set(
4491:                                    PersistenceConfiguration configuration,
4492:                                    String s) {
4493:                                try {
4494:                                    boolean use = (new Boolean(s))
4495:                                            .booleanValue();
4496:                                    configuration.setQueryUseFetchPlan(use);
4497:                                } catch (NumberFormatException nfe) {
4498:                                    // Do nothing
4499:                                }
4500:                            }
4501:                        });
4502:                map.put(PersistenceConfiguration.QUERY_TIMEOUT_PROPERTY,
4503:                        new StringPropertySetter() {
4504:                            public void set(
4505:                                    PersistenceConfiguration configuration,
4506:                                    String s) {
4507:                                try {
4508:                                    int len = (new Integer(s)).intValue();
4509:                                    configuration.setQueryTimeout(len);
4510:                                } catch (NumberFormatException nfe) {
4511:                                    // Do nothing
4512:                                }
4513:                            }
4514:                        });
4515:                map
4516:                        .put(
4517:                                PersistenceConfiguration.QUERY_FETCH_DIRECTION_PROPERTY,
4518:                                new StringPropertySetter() {
4519:                                    public void set(
4520:                                            PersistenceConfiguration configuration,
4521:                                            String s) {
4522:                                        configuration.setQueryFetchDirection(s);
4523:                                    }
4524:                                });
4525:                map
4526:                        .put(
4527:                                PersistenceConfiguration.QUERY_RESULT_SET_TYPE_PROPERTY,
4528:                                new StringPropertySetter() {
4529:                                    public void set(
4530:                                            PersistenceConfiguration configuration,
4531:                                            String s) {
4532:                                        configuration.setQueryResultSetType(s);
4533:                                    }
4534:                                });
4535:                map
4536:                        .put(
4537:                                PersistenceConfiguration.QUERY_RESULT_SET_CONCURRENCY_PROPERTY,
4538:                                new StringPropertySetter() {
4539:                                    public void set(
4540:                                            PersistenceConfiguration configuration,
4541:                                            String s) {
4542:                                        configuration
4543:                                                .setQueryResultSetConcurrency(s);
4544:                                    }
4545:                                });
4546:                map.put(PersistenceConfiguration.QUERY_JOIN_TYPE_PROPERTY,
4547:                        new StringPropertySetter() {
4548:                            public void set(
4549:                                    PersistenceConfiguration configuration,
4550:                                    String s) {
4551:                                configuration.setQueryJoinType(s);
4552:                            }
4553:                        });
4554:                map
4555:                        .put(
4556:                                PersistenceConfiguration.QUERY_EXISTS_INCLUDES_PROPERTY,
4557:                                new StringPropertySetter() {
4558:                                    public void set(
4559:                                            PersistenceConfiguration configuration,
4560:                                            String s) {
4561:                                        configuration
4562:                                                .setQueryExistsIncludesConstraints(Boolean
4563:                                                        .valueOf(s)
4564:                                                        .booleanValue());
4565:                                    }
4566:                                });
4567:                map
4568:                        .put(
4569:                                PersistenceConfiguration.QUERY_CONTAINS_EXISTS_ALWAYS_PROPERTY,
4570:                                new StringPropertySetter() {
4571:                                    public void set(
4572:                                            PersistenceConfiguration configuration,
4573:                                            String s) {
4574:                                        configuration
4575:                                                .setQueryContainsUsesExistsAlways(Boolean
4576:                                                        .valueOf(s)
4577:                                                        .booleanValue());
4578:                                    }
4579:                                });
4580:                map
4581:                        .put(
4582:                                PersistenceConfiguration.QUERY_ALLOW_ALL_SQL_STATEMENTS,
4583:                                new StringPropertySetter() {
4584:                                    public void set(
4585:                                            PersistenceConfiguration configuration,
4586:                                            String s) {
4587:                                        try {
4588:                                            boolean allow = (new Boolean(s))
4589:                                                    .booleanValue();
4590:                                            configuration
4591:                                                    .setQueryAllowAllSQLStatements(allow);
4592:                                        } catch (NumberFormatException nfe) {
4593:                                            // Do nothing
4594:                                        }
4595:                                    }
4596:                                });
4597:
4598:                // Types
4599:                map
4600:                        .put(
4601:                                PersistenceConfiguration.STRING_DEFAULT_LENGTH_PROPERTY,
4602:                                new StringPropertySetter() {
4603:                                    public void set(
4604:                                            PersistenceConfiguration configuration,
4605:                                            String s) {
4606:                                        try {
4607:                                            int len = (new Integer(s))
4608:                                                    .intValue();
4609:                                            configuration
4610:                                                    .setStringDefaultLength(len);
4611:                                        } catch (NumberFormatException nfe) {
4612:                                            // Do nothing
4613:                                        }
4614:                                    }
4615:                                });
4616:                map.put(PersistenceConfiguration.STRING_LENGTH_ACTION_PROPERTY,
4617:                        new StringPropertySetter() {
4618:                            public void set(
4619:                                    PersistenceConfiguration configuration,
4620:                                    String s) {
4621:                                configuration.setStringLengthExceededAction(s);
4622:                            }
4623:                        });
4624:                map
4625:                        .put(
4626:                                PersistenceConfiguration.PERSIST_EMPTY_STRING_AS_NULL_PROPERTY,
4627:                                new StringPropertySetter() {
4628:                                    public void set(
4629:                                            PersistenceConfiguration configuration,
4630:                                            String s) {
4631:                                        configuration
4632:                                                .setPersistEmptyStringAsNull((new Boolean(
4633:                                                        s)).booleanValue());
4634:                                    }
4635:                                });
4636:
4637:                map
4638:                        .put(
4639:                                PersistenceConfiguration.DISCRIMINATOR_PER_SUBCLASSTABLE_PROPERTY,
4640:                                new StringPropertySetter() {
4641:                                    public void set(
4642:                                            PersistenceConfiguration configuration,
4643:                                            String s) {
4644:                                        configuration
4645:                                                .setDiscriminatorPerSubclassTable((new Boolean(
4646:                                                        s)).booleanValue());
4647:                                    }
4648:                                });
4649:
4650:                map.put(PersistenceConfiguration.ORACLE_SORT_ORDER_PROPERTY,
4651:                        new StringPropertySetter() {
4652:                            public void set(
4653:                                    PersistenceConfiguration configuration,
4654:                                    String s) {
4655:                                configuration.setOracleNlsSortOrder(s);
4656:                            }
4657:                        });
4658:
4659:                // Cache
4660:                map.put(PersistenceConfiguration.CACHE_COLLECTIONS_PROPERTY,
4661:                        new StringPropertySetter() {
4662:                            public void set(
4663:                                    PersistenceConfiguration configuration,
4664:                                    String s) {
4665:                                configuration.setCacheCollections(Boolean
4666:                                        .valueOf(s).booleanValue());
4667:                            }
4668:                        });
4669:                map
4670:                        .put(
4671:                                PersistenceConfiguration.CACHE_COLLECTIONS_LAZY_PROPERTY,
4672:                                new StringPropertySetter() {
4673:                                    public void set(
4674:                                            PersistenceConfiguration configuration,
4675:                                            String s) {
4676:                                        boolean lazy = Boolean.valueOf(s)
4677:                                                .booleanValue();
4678:                                        if (lazy) {
4679:                                            configuration
4680:                                                    .setCacheCollectionsLazy(Boolean.TRUE);
4681:                                        } else {
4682:                                            configuration
4683:                                                    .setCacheCollectionsLazy(Boolean.FALSE);
4684:                                        }
4685:                                    }
4686:                                });
4687:                map.put(PersistenceConfiguration.CACHE_LEVEL_1_TYPE_PROPERTY,
4688:                        new StringPropertySetter() {
4689:                            public void set(
4690:                                    PersistenceConfiguration configuration,
4691:                                    String s) {
4692:                                configuration.setCacheLevel1Type(s);
4693:                            }
4694:                        });
4695:                map.put(PersistenceConfiguration.CACHE_LEVEL_2_PROPERTY,
4696:                        new StringPropertySetter() {
4697:                            public void set(
4698:                                    PersistenceConfiguration configuration,
4699:                                    String s) {
4700:                                configuration.setCacheLevel2(Boolean.valueOf(s)
4701:                                        .booleanValue());
4702:                            }
4703:                        });
4704:                map.put(PersistenceConfiguration.CACHE_LEVEL_2_TYPE_PROPERTY,
4705:                        new StringPropertySetter() {
4706:                            public void set(
4707:                                    PersistenceConfiguration configuration,
4708:                                    String s) {
4709:                                configuration.setCacheLevel2Type(s);
4710:                            }
4711:                        });
4712:                map
4713:                        .put(
4714:                                PersistenceConfiguration.CACHE_LEVEL_2_CACHE_NAME_PROPERTY,
4715:                                new StringPropertySetter() {
4716:                                    public void set(
4717:                                            PersistenceConfiguration configuration,
4718:                                            String s) {
4719:                                        configuration
4720:                                                .setCacheLevel2CacheName(s);
4721:                                    }
4722:                                });
4723:                map
4724:                        .put(
4725:                                PersistenceConfiguration.CACHE_LEVEL_2_CONFIGURATION_FILE_PROPERTY,
4726:                                new StringPropertySetter() {
4727:                                    public void set(
4728:                                            PersistenceConfiguration configuration,
4729:                                            String s) {
4730:                                        configuration
4731:                                                .setCacheLevel2ConfigurationFile(s);
4732:                                    }
4733:                                });
4734:
4735:                map
4736:                        .put(
4737:                                PersistenceConfiguration.METADATA_JDO_FILE_EXTENSION_PROPERTY,
4738:                                new StringPropertySetter() {
4739:                                    public void set(
4740:                                            PersistenceConfiguration configuration,
4741:                                            String s) {
4742:                                        configuration
4743:                                                .setJdoMetaDataFileExtension(s);
4744:                                    }
4745:                                });
4746:                map
4747:                        .put(
4748:                                PersistenceConfiguration.METADATA_ORM_FILE_EXTENSION_PROPERTY,
4749:                                new StringPropertySetter() {
4750:                                    public void set(
4751:                                            PersistenceConfiguration configuration,
4752:                                            String s) {
4753:                                        configuration
4754:                                                .setOrmMetaDataFileExtension(s);
4755:                                    }
4756:                                });
4757:                map
4758:                        .put(
4759:                                PersistenceConfiguration.METADATA_JDOQUERY_FILE_EXTENSION_PROPERTY,
4760:                                new StringPropertySetter() {
4761:                                    public void set(
4762:                                            PersistenceConfiguration configuration,
4763:                                            String s) {
4764:                                        configuration
4765:                                                .setJdoqueryMetaDataFileExtension(s);
4766:                                    }
4767:                                });
4768:                map.put(PersistenceConfiguration.METADATA_VALIDATE_PROPERTY,
4769:                        new StringPropertySetter() {
4770:                            public void set(
4771:                                    PersistenceConfiguration configuration,
4772:                                    String s) {
4773:                                configuration.setMetaDataValidate(Boolean
4774:                                        .valueOf(s).booleanValue());
4775:                            }
4776:                        });
4777:                map
4778:                        .put(
4779:                                PersistenceConfiguration.METADATA_ANNOTATIONS_MANAGER_PROPERTY,
4780:                                new StringPropertySetter() {
4781:                                    public void set(
4782:                                            PersistenceConfiguration configuration,
4783:                                            String s) {
4784:                                        configuration
4785:                                                .setMetaDataAnnotationsManager(s);
4786:                                    }
4787:                                });
4788:
4789:                map
4790:                        .put(
4791:                                PersistenceConfiguration.MESSAGES_INCLUDE_CODES_PROPERTY,
4792:                                new StringPropertySetter() {
4793:                                    public void set(
4794:                                            PersistenceConfiguration configuration,
4795:                                            String s) {
4796:                                        configuration
4797:                                                .setMessagesIncludeCodes(Boolean
4798:                                                        .valueOf(s));
4799:                                    }
4800:                                });
4801:                map.put(PersistenceConfiguration.PROPERTIES_FILE,
4802:                        new StringPropertySetter() {
4803:                            public void set(
4804:                                    PersistenceConfiguration configuration,
4805:                                    String s) {
4806:                                configuration.setPropertiesFile(s);
4807:                            }
4808:                        });
4809:                map.put(PersistenceConfiguration.PLUGIN_REGISTRY_CLASS_NAME,
4810:                        new StringPropertySetter() {
4811:                            public void set(
4812:                                    PersistenceConfiguration configuration,
4813:                                    String s) {
4814:                                configuration.setPluginRegistryClassName(s);
4815:                            }
4816:                        });
4817:                map.put(PersistenceConfiguration.PLUGIN_REGISTRY_BUNDLE_CHECK,
4818:                        new StringPropertySetter() {
4819:                            public void set(
4820:                                    PersistenceConfiguration configuration,
4821:                                    String s) {
4822:                                configuration.setPluginRegistryBundleCheck(s);
4823:                            }
4824:                        });
4825:                map
4826:                        .put(
4827:                                PersistenceConfiguration.CONNECTION_PROVIDER_NAME_PROPERTY,
4828:                                new StringPropertySetter() {
4829:                                    public void set(
4830:                                            PersistenceConfiguration configuration,
4831:                                            String s) {
4832:                                        configuration
4833:                                                .setConnectionProviderName(s);
4834:                                    }
4835:                                });
4836:                map
4837:                        .put(
4838:                                PersistenceConfiguration.CONNECTION_PROVIDER_FAILONERROR_PROPERTY,
4839:                                new StringPropertySetter() {
4840:                                    public void set(
4841:                                            PersistenceConfiguration configuration,
4842:                                            String s) {
4843:                                        configuration
4844:                                                .setConnectionProviderFailOnError(Boolean
4845:                                                        .valueOf(s)
4846:                                                        .booleanValue());
4847:                                    }
4848:                                });
4849:                map.put(PersistenceConfiguration.PRIMARY_CLASS_LOADER_PROPERTY,
4850:                        new ObjectPropertySetter() {
4851:                            public void set(
4852:                                    PersistenceConfiguration configuration,
4853:                                    Object o) {
4854:                                configuration
4855:                                        .setPrimaryClassLoaderResolver((ClassLoader) o);
4856:                            }
4857:                        });
4858:
4859:                // Connection Properties
4860:                map.put(PersistenceConfiguration.CONNECTION_RESOURCE_TYPE,
4861:                        new StringPropertySetter() {
4862:                            public void set(
4863:                                    PersistenceConfiguration configuration,
4864:                                    String s) {
4865:                                configuration.setConnectionResourceType(s);
4866:                            }
4867:                        });
4868:                map.put(PersistenceConfiguration.CONNECTION2_RESOURCE_TYPE,
4869:                        new StringPropertySetter() {
4870:                            public void set(
4871:                                    PersistenceConfiguration configuration,
4872:                                    String s) {
4873:                                configuration.setConnection2ResourceType(s);
4874:                            }
4875:                        });
4876:
4877:                // DB4O Properties
4878:                map.put(PersistenceConfiguration.DB4O_OUTPUT_FILE_PROPERTY,
4879:                        new StringPropertySetter() {
4880:                            public void set(
4881:                                    PersistenceConfiguration configuration,
4882:                                    String s) {
4883:                                configuration.setDb4oOutputFile(s);
4884:                            }
4885:                        });
4886:                map.put(PersistenceConfiguration.DB4O_FLUSH_BUFFERS_PROPERTY,
4887:                        new StringPropertySetter() {
4888:                            public void set(
4889:                                    PersistenceConfiguration configuration,
4890:                                    String s) {
4891:                                configuration.setDb4oFlushFileBuffers(Boolean
4892:                                        .valueOf(s).booleanValue());
4893:                            }
4894:                        });
4895:                map.put(PersistenceConfiguration.DB4O_GENERATE_UUIDS_PROPERTY,
4896:                        new StringPropertySetter() {
4897:                            public void set(
4898:                                    PersistenceConfiguration configuration,
4899:                                    String s) {
4900:                                configuration.setDb4oGenerateUUIDs(Boolean
4901:                                        .valueOf(s).booleanValue());
4902:                            }
4903:                        });
4904:
4905:                return map;
4906:            }
4907:
4908:            /**
4909:             * Set the options for this PersistenceManagerFactory based on the
4910:             * given Properties.
4911:             * @param props  The Properties to set the options from.
4912:             */
4913:            protected void setOptions(Properties props) {
4914:                this .options = props;
4915:                for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
4916:                    String prop = (String) e.nextElement();
4917:
4918:                    StringPropertySetter setter = (StringPropertySetter) PROPERTY_SETTERS
4919:                            .get(prop);
4920:                    if (prop != null && setter != null) {
4921:                        String value = props.getProperty(prop);
4922:                        setter.set(this , value);
4923:                    } else if (prop != null && setter == null) {
4924:                        // Omit the ones that we dont have setters for
4925:                        if (!prop.equals(JDO_PMF_CLASS_PROPERTY)
4926:                                && !prop
4927:                                        .equals(JPA_PERSISTENCE_PROVIDER_PROPERTY)) {
4928:                            JPOXLogger.PERSISTENCE.warn(LOCALISER.msg("008015",
4929:                                    prop));
4930:                        }
4931:                    }
4932:                }
4933:            }
4934:
4935:            /**
4936:             * Set the options for this PersistenceManagerFactory based on the
4937:             * given map of properties.
4938:             * @param props The Properties to set the options from.
4939:             */
4940:            protected void setOptions(Map props) {
4941:                this .options = props;
4942:                Set keys = props.keySet();
4943:                Iterator keyIter = keys.iterator();
4944:                while (keyIter.hasNext()) {
4945:                    Object keyObj = keyIter.next();
4946:                    if (keyObj instanceof  String) {
4947:                        String key = (String) keyObj;
4948:                        Object valueObj = props.get(keyObj);
4949:                        Object setter = PROPERTY_SETTERS.get(key);
4950:                        if (setter == null) {
4951:                            // Omit the ones that we dont have setters for
4952:                            if (key != null
4953:                                    && !key
4954:                                            .equals("javax.jdo.PersistenceManagerFactoryClass")) {
4955:                                JPOXLogger.PERSISTENCE.warn(LOCALISER.msg(
4956:                                        "008015", key));
4957:                            }
4958:                        } else if (setter instanceof  StringPropertySetter) {
4959:                            StringPropertySetter strSetter = (StringPropertySetter) setter;
4960:                            if (valueObj != null) {
4961:                                if (valueObj instanceof  String) {
4962:                                    String valueStr = ((String) valueObj)
4963:                                            .trim();
4964:                                    strSetter.set(this , valueStr);
4965:                                } else {
4966:                                    throw new IllegalArgumentException(
4967:                                            LOCALISER.msg("008012", key,
4968:                                                    valueObj));
4969:                                }
4970:                            } else {
4971:                                strSetter.set(this , null);
4972:                            }
4973:                        } else if (setter instanceof  ObjectPropertySetter) {
4974:                            ObjectPropertySetter objSetter = (ObjectPropertySetter) setter;
4975:                            objSetter.set(this , valueObj);
4976:                        }
4977:                    } else {
4978:                        // Ignore this key since we only accept String keys
4979:                    }
4980:                }
4981:            }
4982:
4983:            /**
4984:             * Accessor for the options for this persistence configuration
4985:             * @return the options for this persistence configuration
4986:             */
4987:            public Map getOptions() {
4988:                return options;
4989:            }
4990:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.