org.jpox
Class AbstractPersistenceManagerFactory

java.lang.Object
  extended byorg.jpox.PMFConfiguration
      extended byorg.jpox.AbstractPersistenceManagerFactory
Direct Known Subclasses:
ManagedConnectionFactoryImpl, PersistenceManagerFactoryImpl

public abstract class AbstractPersistenceManagerFactory
extends PMFConfiguration

A factory used to obtain PersistenceManager instances. The factory is configurable up to a point when it is frozen. Thereafter nothing can be changed.

Version:
$Revision: 1.71 $

Nested Class Summary
 
Nested classes inherited from class org.jpox.PMFConfiguration
PMFConfiguration.ObjectPropertySetter, PMFConfiguration.StringPropertySetter
 
Field Summary
protected  Level2Cache cache
          Level 2 Cache
protected  java.util.List lifecycleListeners
          Lifecycle Listeners
protected  PMFContext pmfContext
          The context that this PMF uses.
 
Fields inherited from class org.jpox.PMFConfiguration
ADD_UNIQUE_CONSTRAINT_MAP_INVERSE_PROPERTY, AUTO_CREATE_COLUMNS_PROPERTY, AUTO_CREATE_CONSTRAINTS_PROPERTY, AUTO_CREATE_SCHEMA_PROPERTY, AUTO_CREATE_TABLES_PROPERTY, AUTO_CREATE_WARN_ON_ERROR_PROPERTY, AUTO_START_CLASS_NAMES_PROPERTY, AUTO_START_MECHANISM_MODE_PROPERTY, AUTO_START_MECHANISM_PROPERTY, AUTO_START_MECHANISM_XML_FILE_PROPERTY, CACHE_COLLECTIONS_LAZY_PROPERTY, CACHE_COLLECTIONS_PROPERTY, CACHE_LEVEL_1_TYPE_PROPERTY, CACHE_LEVEL_2_CACHE_NAME_PROPERTY, CACHE_LEVEL_2_CONFIGURATION_FILE_PROPERTY, CACHE_LEVEL_2_PROPERTY, CACHE_LEVEL_2_TYPE_PROPERTY, CHECK_EXIST_TABLES_VIEWS_PROPERTY, CLASS_LOADER_RESOLVER_NAME_PROPERTY, configurable, CONNECTION_POOLING_CONFIGURATION_FILE_PROPERTY, CONNECTION_POOLING_TYPE_PROPERTY, DATASTORE_ADAPTER_CLASSNAME_PROPERTY, DATASTORE_CLASS_ADDITION_MAX_RETRIES_PROPERTY, DATASTORE_DELAY_OPERATIONS_UNTIL_COMMIT_PROPERTY, DATE_TIMEZONE_PROPERTY, DEFAULT_INHERITANCE_STRATEGY_PROPERTY, DETACH_ON_CLOSE_PROPERTY, FIXED_SCHEMA_PROPERTY, FOREIGN_KEY_AUTO_MODE, FOREIGN_KEY_CREATE_MODE_PROPERTY, FOREIGN_KEY_STRICT_MODE, GENERATOR_ID_CLASS_PROPERTY, IMPLEMENTATION_CREATOR_NAME_PROPERTY, INITILIAZE_PRIMARY_KEY_COLUMN_INFO, JDO_CONNECTION_FACTORY_NAME_PROPERTY, JDO_CONNECTION_FACTORY_PROPERTY, JDO_CONNECTION_FACTORY2_NAME_PROPERTY, JDO_CONNECTION_FACTORY2_PROPERTY, JDO_DATASTORE_DRIVERNAME_PROPERTY, JDO_DATASTORE_PASSWORD_PROPERTY, JDO_DATASTORE_URL_PROPERTY, JDO_DATASTORE_USERNAME_PROPERTY, JDO_DETACHALLONCOMMIT_PROPERTY, JDO_IGNORECACHE_PROPERTY, JDO_MAPPING_CATALOG_PROPERTY, JDO_MAPPING_PROPERTY, JDO_MAPPING_SCHEMA_PROPERTY, JDO_MULTITHREADED_PROPERTY, JDO_NONTRANSACTIONAL_READ_PROPERTY, JDO_NONTRANSACTIONAL_WRITE_PROPERTY, JDO_OPTIMISTIC_PROPERTY, JDO_RESTOREVALUES_PROPERTY, JDO_RETAINVALUES_PROPERTY, LOCALISER, MAX_FETCH_DEPTH_PROPERTY, METADATA_JDO_FILE_EXTENSION_PROPERTY, METADATA_JDOQUERY_FILE_EXTENSION_PROPERTY, METADATA_ORM_FILE_EXTENSION_PROPERTY, METADATA_VALIDATE_PROPERTY, PERSISTENCE_BY_REACHABILITY_AT_COMMIT, POID_TRANSACTION_ATTRIBUTE_PROPERTY, POID_TRANSACTION_ISOLATION_PROPERTY, PROPERTIES_FILE, QUERY_ALLOW_ALL_SQL_STATEMENTS, QUERY_FETCH_DIRECTION_PROPERTY, QUERY_FETCH_SIZE_PROPERTY, QUERY_RESULT_SET_CONCURRENCY_PROPERTY, QUERY_RESULT_SET_TYPE_PROPERTY, QUERY_TIMEOUT_PROPERTY, QUERY_USE_FETCH_PLAN_PROPERTY, QUERY_USE_INNER_JOINS_ONLY_PROPERTY, READ_ONLY_SCHEMA_PROPERTY, STRING_DEFAULT_LENGTH_PROPERTY, TRANSACTION_ISOLATION_PROPERTY, USE_UPDATE_LOCK_PROPERTY, VALIDATE_COLUMNS_PROPERTY, VALIDATE_CONSTRAINTS_PROPERTY, VALIDATE_TABLES_PROPERTY
 
Constructor Summary
AbstractPersistenceManagerFactory()
          Constructor for the PMF.
 
Method Summary
 void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener, java.lang.Class[] classes)
          Method to add lifecycle listeners for particular classes.
protected  void assertIsOpen()
          Asserts that's the PMF is open.
 void close()
          Close this PersistenceManagerFactory.
protected  void freezeConfiguration()
          Freezes the current configuration.
 javax.jdo.datastore.DataStoreCache getDataStoreCache()
          Accessor for the DataStore (level 2) Cache
 ImplementationCreator getImplementationCreator()
          Accessor to the ImplementationCreator
 java.util.List getLifecycleListenerSpecifications()
           
 javax.sql.DataSource[] getNontransactionalDataSource()
          Returns the data source to be used for non-transactional access.
protected  java.util.Set getPmCache()
          Return the Set of PersistenceManagers actually in cache
 PMFConfiguration getPMFConfiguration()
          Accessor for the PMFConfiguration.
 PMFContext getPMFContext()
          Gets the context for this PersistenceManagerFactory
 java.util.Properties getProperties()
          Return non-configurable properties of this PersistenceManagerFactory.
 javax.sql.DataSource[] getTransactionalDataSource()
          Returns the data source to be used for transactional access.
static java.lang.String getVendorName()
          Utility to get the vendor of JPOX.
static java.lang.String getVersionNumber()
          Utility to get the version of JPOX.
 boolean isClosed()
          Utility to return whether the PMF is closed or not.
 void releasePersistenceManager(PersistenceManager pm)
          Remove a PersistenceManager from the cache Only the PersistenceManager is allowed to call this method
 void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
          Method to remove a lifecycle listener.
 java.util.Collection supportedOptions()
          The application can determine from the results of this method which optional features, and which query languages are supported by the JDO implementation.
 
Methods inherited from class org.jpox.PMFConfiguration
assertConfigurable, equals, getAutoCreateColumns, getAutoCreateConstraints, getAutoCreateTables, getAutoCreateWarnOnError, getAutoStartClassNames, getAutoStartMechanism, getAutoStartMechanismMode, getAutoStartMechanismXmlFile, getCalendarForDateTimezone, getCatalog, getCheckExistTablesOrViews, getClassLoaderResolverName, getConnectionDriverName, getConnectionFactory, getConnectionFactory2, getConnectionFactory2Name, getConnectionFactoryName, getConnectionPassword, getConnectionPoolingConfigurationFile, getConnectionPoolingType, getConnectionURL, getConnectionUserName, getDatastoreAdapterClassName, getDatastoreClassAdditionMaxRetries, getDatastoreDelayOperationsEnabled, getDateTimezone, getDefaultInheritanceStrategy, getDetachAllOnCommit, getDetachOnClose, getDictionary, getFixedSchema, getForeignKeyCreateMode, getIdentifierCase, getIdentifierNamingStrategy, getIdentifierTablePrefix, getIdentifierTableSuffix, getIdentifierWordSeparator, getIgnoreCache, getImplementationCreatorName, getInitializePrimaryKeyColumnInfo, getJdoCacheCollections, getJdoCacheCollectionsLazy, getJdoCacheLevel1Type, getJdoCacheLevel2, getJdoCacheLevel2CacheName, getJdoCacheLevel2ConfigurationFile, getJdoCacheLevel2Type, getJdoMetaDataFileExtension, getJdoqueryMetaDataFileExtension, getMapping, getMaxFetchDepth, getMetaDataValidate, getMultithreaded, getNontransactionalRead, getNontransactionalWrite, getOptimistic, getOptions, getOrmMetaDataFileExtension, getPersistenceByReachabilityAtCommit, getPersistentIdGenerator, getPoidTransactionAttribute, getPoidTransactionIsolationLevel, getPropertiesFile, getQueryFetchDirection, getQueryFetchSize, getQueryResultSetConcurrency, getQueryResultSetType, getQueryTimeout, getQueryUseFetchPlan, getQueryUseInnerJoinsOnly, getReadOnlySchema, getRestoreValues, getRetainValues, getSchema, getStringDefaultLength, getTransactionIsolation, getUniqueConstraintsMapInverse, getUseUpdateLock, getValidateColumns, getValidateConstraints, getValidateTables, initPropertySetters, isQueryAllowAllSQLStatements, setAutoCreateColumns, setAutoCreateConstraints, setAutoCreateSchema, setAutoCreateTables, setAutoCreateWarnOnError, setAutoStartClassNames, setAutoStartMechanism, setAutoStartMechanismMode, setAutoStartMechanismXmlFile, setCatalog, setCheckExistTablesOrViews, setClassLoaderResolverName, setConnectionDriverName, setConnectionFactory, setConnectionFactory2, setConnectionFactory2Name, setConnectionFactoryName, setConnectionPassword, setConnectionPoolingConfigurationFile, setConnectionPoolingType, setConnectionURL, setConnectionUserName, setDatastoreAdapterClassName, setDatastoreClassAdditionMaxRetries, setDatastoreDelayOperationsEnabled, setDateTimezone, setDefaultInheritanceStrategy, setDetachAllOnCommit, setDetachOnClose, setFixedSchema, setForeignKeyCreateMode, setIdentifierCase, setIdentifierNamingStrategy, setIdentifierTablePrefix, setIdentifierTableSuffix, setIdentifierWordSeparator, setIgnoreCache, setImplementationCreatorName, setInitializePrimaryKeyColumnInfo, setJdoCacheCollections, setJdoCacheCollectionsLazy, setJdoCacheLevel1Type, setJdoCacheLevel2, setJdoCacheLevel2CacheName, setJdoCacheLevel2ConfigurationFile, setJdoCacheLevel2Type, setJdoMetaDataFileExtension, setJdoqueryMetaDataFileExtension, setMapping, setMaxFetchDepth, setMetaDataValidate, setMultithreaded, setNontransactionalRead, setNontransactionalWrite, setOptimistic, setOptions, setOptions, setOrmMetaDataFileExtension, setPersistenceByReachabilityAtCommit, setPersistentIdGenerator, setPoidTransactionAttribute, setPoidTransactionIsolation, setPoidTransactionIsolation, setPropertiesFile, setQueryAllowAllSQLStatements, setQueryFetchDirection, setQueryFetchSize, setQueryResultSetConcurrency, setQueryResultSetType, setQueryTimeout, setQueryUseFetchPlan, setQueryUseInnerJoinsOnly, setReadOnlySchema, setRestoreValues, setRetainValues, setSchema, setStringDefaultLength, setTransactionIsolation, setTransactionIsolation, setUniqueConstraintsMapInverse, setUseUpdateLock, setValidateColumns, setValidateConstraints, setValidateTables
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pmfContext

protected PMFContext pmfContext
The context that this PMF uses.


cache

protected Level2Cache cache
Level 2 Cache


lifecycleListeners

protected java.util.List lifecycleListeners
Lifecycle Listeners

Constructor Detail

AbstractPersistenceManagerFactory

public AbstractPersistenceManagerFactory()
Constructor for the PMF.

Method Detail

getImplementationCreator

public ImplementationCreator getImplementationCreator()
Accessor to the ImplementationCreator

Returns:
The ImplementationCreator

assertIsOpen

protected void assertIsOpen()
Asserts that's the PMF is open.

Throws:
javax.jdo.JDOUserException - if it is already closed

freezeConfiguration

protected void freezeConfiguration()
Freezes the current configuration.

Throws:
UnsupportedConnectionFactoryException - If the configured connection factory is not a javax.sql.DataSource.

getTransactionalDataSource

public javax.sql.DataSource[] getTransactionalDataSource()
Returns the data source to be used for transactional access.

Returns:
The data source to be used for transactional access. Possible to have more than one datasource for failover

getNontransactionalDataSource

public javax.sql.DataSource[] getNontransactionalDataSource()
Returns the data source to be used for non-transactional access.

Returns:
The data source to be used for non-transactional access. Possible to have more than one datasource for failover

getProperties

public java.util.Properties getProperties()
Return non-configurable properties of this PersistenceManagerFactory. Properties with keys VendorName and VersionNumber are required. Other keys are optional.

Returns:
the non-configurable properties of this PersistenceManagerFactory.

getVersionNumber

public static java.lang.String getVersionNumber()
Utility to get the version of JPOX.

Returns:
Version number for JPOX.

getVendorName

public static java.lang.String getVendorName()
Utility to get the vendor of JPOX.

Returns:
Vendor name for JPOX.

supportedOptions

public java.util.Collection supportedOptions()
The application can determine from the results of this method which optional features, and which query languages are supported by the JDO implementation. Se esection 11.6 of the JDO 2 specification.

Returns:
A Collection of String representing the supported options.

getPmCache

protected java.util.Set getPmCache()
Return the Set of PersistenceManagers actually in cache

Returns:
Set this contains instances of PersistenceManagers in the cache

releasePersistenceManager

public void releasePersistenceManager(PersistenceManager pm)
Remove a PersistenceManager from the cache Only the PersistenceManager is allowed to call this method

Parameters:
pm - the PersistenceManager to be removed from cache

close

public void close()
Close this PersistenceManagerFactory. Check for JDOPermission("closePersistenceManagerFactory") and if not authorized, throw SecurityException.

If the authorization check succeeds, check to see that all PersistenceManager instances obtained from this PersistenceManagerFactory have no active transactions. If any PersistenceManager instances have an active transaction, throw a JDOUserException, with one nested JDOUserException for each PersistenceManager with an active Transaction.

If there are no active transactions, then close all PersistenceManager instances obtained from this PersistenceManagerFactory, mark this PersistenceManagerFactory as closed, disallow getPersistenceManager methods, and allow all other get methods. If a set method or getPersistenceManager method is called after close, then JDOUserException is thrown.

See Also:
PersistenceManagerFactory.close()

isClosed

public boolean isClosed()
Utility to return whether the PMF is closed or not.

Returns:
Whether it is closed.

getPMFContext

public PMFContext getPMFContext()
Gets the context for this PersistenceManagerFactory

Returns:
Returns the pmfContext.

getPMFConfiguration

public PMFConfiguration getPMFConfiguration()
Accessor for the PMFConfiguration.

Returns:
Returns the PMF config.

getDataStoreCache

public javax.jdo.datastore.DataStoreCache getDataStoreCache()
Accessor for the DataStore (level 2) Cache

Returns:
The datastore cache
Since:
1.1

getLifecycleListenerSpecifications

public java.util.List getLifecycleListenerSpecifications()
Returns:
Returns either null or a List with instances of LifecycleListenerSpecification.

addInstanceLifecycleListener

public void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener,
                                         java.lang.Class[] classes)
Method to add lifecycle listeners for particular classes. Adds the listener to all PMs already created.

Parameters:
listener - The listener
classes - The classes that the listener relates to
Since:
1.1

removeInstanceLifecycleListener

public void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
Method to remove a lifecycle listener. Removes the listener from all PM's as well.

Parameters:
listener - The Listener
Since:
1.1


Copyright © -2007 . All Rights Reserved.