public abstract class PersistenceManagerFactoryImpl extends java.lang.Object implements PersistenceManagerFactoryInternal
Subclasses must override the following methods declared abstract:
getOptionArray()
createPersistenceManager(String userid, String password)
(Properties props)
encrypt(String s)
decrypt(String s)
setCFProperties(Properties p)
getCFFromProperties(Properties p)
isConnectionFactoryConfigured()
Modifier and Type | Class and Description |
---|---|
static interface |
PersistenceManagerFactoryImpl.PMFAccessor
The preferred way of getting & restoring a PMF in JNDI is to do so via
a Properties object.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
closed
These are used for implementing close().
|
protected java.lang.Object |
closeLock
The closeLock protects the close flag and pmSet.
|
protected java.lang.String |
password |
protected static java.util.HashMap |
pmfAccessors
Tables which map from names to PMFAccessors.
|
protected java.util.Set |
pmSet
The set of all PersistenceManagers that are not closed.
|
protected static java.util.HashMap |
propsAccessors
These PMFAccessors are for configuring non-connection properties.
|
Constructor and Description |
---|
PersistenceManagerFactoryImpl()
Creates new
PersistenceManagerFactoryImpl without
any user info. |
PersistenceManagerFactoryImpl(java.lang.String URL,
java.lang.String userName,
java.lang.String password,
java.lang.String driverName)
Creates new
PersistenceManagerFactoryImpl with user info |
Modifier and Type | Method and Description |
---|---|
protected void |
assertNotClosed()
Assert that this PersistenceManagerFactory is not closed.
|
void |
close()
Close this PersistenceManagerFactory.
|
protected void |
closeOpenPersistenceManagers()
Close all open PersistenceManagers.
|
protected abstract javax.jdo.PersistenceManager |
createPersistenceManager(java.lang.String userid,
java.lang.String password)
Creates a new instance of PersistenceManager from this factory.
|
protected abstract java.lang.String |
decrypt(java.lang.String s)
Provides a decrypted version of the given (encrypted) string.
|
protected void |
deregisterPersistenceManager(PersistenceManagerImpl pm,
java.lang.Object t)
Deregisters PersistenceManager that is not associated with
a JTA transaction any more.
|
protected void |
doReadObject(java.io.ObjectInputStream ois)
Read this object from a stream.
|
protected void |
doWriteObject(java.io.ObjectOutputStream oos)
Write this object to a stream.
|
protected abstract java.lang.String |
encrypt(java.lang.String s)
Provides an encrypted version of the given string.
|
boolean |
equals(java.lang.Object o) |
static void |
filterProperties(java.util.Properties props,
java.util.Properties filtered,
java.util.Map accessors)
Given an input Properties instance, add to the output Properties instance
only the non-default entries of the input Properties, based on the
Accessor map provided.
|
protected java.util.List |
getActivePersistenceManagers()
Get all active PersistenceManagers.
|
java.util.Properties |
getAsProperties()
Returns a Properties representation of this PMF.
|
protected java.util.Properties |
getAsPropertiesInternal()
Does not do assertConfigurable validation
|
protected abstract void |
getCFFromProperties(java.util.Properties p)
Create a ConnectionFactory for this PMF.
|
java.lang.String |
getConnectionDriverName()
Get the driver name for the data store connection.
|
java.lang.Object |
getConnectionFactory()
Get the data store connection factory.
|
java.lang.Object |
getConnectionFactory2()
Return the non-transactional connection factory
for optimistic transactions.
|
java.lang.String |
getConnectionFactory2Name()
Get the name of the connection factory for non-transactional connections.
|
java.lang.String |
getConnectionFactoryName()
Get the name for the data store connection factory.
|
protected java.lang.String |
getConnectionPassword()
Get the password for the data store connection.
|
java.lang.String |
getConnectionURL()
Get the URL for the data store connection.
|
java.lang.String |
getConnectionUserName()
Get the user name for the data store connection.
|
boolean |
getIgnoreCache()
Get the default IgnoreCache setting for all PersistenceManager instances
obtained from this factory.
|
protected java.util.HashMap |
getLocalAccessors()
Get JDO implementation-specific properties
(not specified by JDO specification).
|
int |
getMaxPool()
Get the default MaxPool setting for all PersistenceManager instances
obtained from this factory.
|
int |
getMinPool()
Get the default MinPool setting for all PersistenceManager instances
obtained from this factory.
|
int |
getMsWait()
Get the default MsWait setting for all PersistenceManager instances
obtained from this factory.
|
boolean |
getMultithreaded()
Get the default Multithreaded setting for all
PersistenceManager instances obtained from this factory.
|
boolean |
getNontransactionalRead()
Get the default NontransactionalRead setting for all
PersistenceManager instances obtained from this factory.
|
boolean |
getNontransactionalWrite()
Get the default NontransactionalWrite setting for all
PersistenceManager instances obtained from this factory.
|
boolean |
getOptimistic()
Get the default Optimistic setting for all PersistenceManager instances
obtained from this factory.
|
protected abstract java.lang.String[] |
getOptionArray()
Returns an array of Strings indicating which options are supported by
this PersistenceManagerFactory.
|
javax.jdo.PersistenceManager |
getPersistenceManager()
Get an instance of PersistenceManager from this factory.
|
javax.jdo.PersistenceManager |
getPersistenceManager(java.lang.String userid,
java.lang.String password)
Get an instance of PersistenceManager from this factory.
|
java.util.Properties |
getProperties()
Return "static" properties of this PersistenceManagerFactory.
|
int |
getQueryTimeout()
Get the default QueryTimeout setting for all PersistenceManager instances
obtained from this factory.
|
boolean |
getRestoreValues()
Get the default RestoreValues setting for all PersistenceManager instances
obtained from this factory.
|
boolean |
getRetainValues()
Get the default RetainValues setting for all PersistenceManager instances
obtained from this factory.
|
int |
getUpdateTimeout()
Get the default UpdateTimeout setting for all PersistenceManager instances
obtained from this factory.
|
int |
hashCode()
The returned value can change before this PMF is configured.
|
static void |
initPropsAccessors()
Initialize the Accessor hashmaps for
connection and non-connection properties.
|
protected abstract boolean |
isConnectionFactoryConfigured()
Returns if a connection factory is configured for this
PersistenceManagerFactory.
|
protected void |
registerPersistenceManager(PersistenceManagerImpl pm,
java.lang.Object t)
Registers PersistenceManager in the transactional cache in
managed environment in case of BMT with JDO Transaction.
|
protected void |
releasePersistenceManager(PersistenceManagerImpl pm,
java.lang.Object t)
Releases closed PersistenceManager that is not in use
|
protected abstract void |
setCFProperties(java.util.Properties p)
Set the PMF-specific ConnectionFactory's properties.
|
protected void |
setConfigured()
Set the configurable flag false so this
PersistenceManagerFactory can no longer be configured.
|
void |
setConnectionDriverName(java.lang.String driverName)
Set the driver name for the data store connection.
|
void |
setConnectionFactory(java.lang.Object connectionFactory)
Set the data store connection factory.
|
void |
setConnectionFactory2(java.lang.Object connectionFactory)
Set the non-transactional connection factory
for optimistic transactions.
|
void |
setConnectionFactory2Name(java.lang.String connectionFactoryName)
Set the name of the connection factory for non-transactional connections.
|
void |
setConnectionFactoryName(java.lang.String connectionFactoryName)
Set the name for the data store connection factory.
|
void |
setConnectionPassword(java.lang.String password)
Set the password for the data store connection.
|
void |
setConnectionURL(java.lang.String URL)
Set the URL for the data store connection.
|
void |
setConnectionUserName(java.lang.String userName)
Set the user name for the data store connection.
|
void |
setFromProperties(java.util.Properties p)
Configures a PMF from the given Properties.
|
void |
setIgnoreCache(boolean flag)
Set the default IgnoreCache setting for all PersistenceManager instances
obtained from this factory.
|
void |
setMaxPool(int maxPool)
Set the default MaxPool setting for all PersistenceManager instances
obtained from this factory.
|
void |
setMinPool(int minPool)
Set the default MinPool setting for all PersistenceManager instances
obtained from this factory.
|
void |
setMsWait(int msWait)
Set the default MsWait setting for all PersistenceManager instances
obtained from this factory.
|
void |
setMultithreaded(boolean flag)
Set the default Multithreaded setting for all
PersistenceManager instances obtained from this factory.
|
protected void |
setNonconfigured()
Set the configurable flag true so this
PersistenceManagerFactory can be again configured.
|
void |
setNontransactionalRead(boolean flag)
Set the default NontransactionalRead setting for all
PersistenceManager instances obtained from this factory.
|
void |
setNontransactionalWrite(boolean flag)
Set the default NontransactionalWrite setting for all
PersistenceManager instances obtained from this factory.
|
void |
setOptimistic(boolean flag)
Set the default Optimistic setting for all PersistenceManager instances
obtained from this factory.
|
protected abstract void |
setPMFClassProperty(java.util.Properties props)
Set the PMF class property for this PMF.
|
void |
setQueryTimeout(int queryTimeout)
Set the default QueryTimeout setting for all PersistenceManager instances
obtained from this factory.
|
void |
setRestoreValues(boolean flag)
Set the default RestoreValues setting for all PersistenceManager instances
obtained from this factory.
|
void |
setRetainValues(boolean flag)
Set the default RetainValues setting for all PersistenceManager instances
obtained from this factory.
|
void |
setUpdateTimeout(int updateTimeout)
Set the default UpdateTimeout setting for all
PersistenceManager instances obtained from this factory.
|
protected void |
shutdown()
Method called by the shudown hook to close pmf instances left open
when the JVM exits.
|
java.util.Collection |
supportedOptions()
The application can determine from the results of this
method which optional features are supported by the
JDO implementation.
|
protected static int |
toInt(java.lang.String s)
It should *never* be the case that our translation process encounters
a NumberFormatException.
|
java.lang.String |
toString()
The String representation of this PMF.
|
protected void |
verifyConfiguration()
Verify that the connection URL has been configured.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getObjectIdClass, getStoreManager, getTrackedClass, getTranscriberFactory, releaseStoreManager
protected java.lang.String password
protected boolean closed
protected java.lang.Object closeLock
protected java.util.Set pmSet
protected static java.util.HashMap pmfAccessors
protected static java.util.HashMap propsAccessors
public PersistenceManagerFactoryImpl()
PersistenceManagerFactoryImpl
without
any user info.public PersistenceManagerFactoryImpl(java.lang.String URL, java.lang.String userName, java.lang.String password, java.lang.String driverName)
PersistenceManagerFactoryImpl
with user infoURL
- URL for the data store connectionuserName
- user name for the data store connectionpassword
- password for the data store connectiondriverName
- driver name for the data store connectionpublic void setConnectionUserName(java.lang.String userName)
setConnectionUserName
in interface javax.jdo.PersistenceManagerFactory
userName
- the user name for the data store connection.public java.lang.String getConnectionUserName()
getConnectionUserName
in interface javax.jdo.PersistenceManagerFactory
public void setConnectionPassword(java.lang.String password)
setConnectionPassword
in interface javax.jdo.PersistenceManagerFactory
password
- the password for the data store connection.protected java.lang.String getConnectionPassword()
public void setConnectionURL(java.lang.String URL)
setConnectionURL
in interface javax.jdo.PersistenceManagerFactory
URL
- the URL for the data store connection.public java.lang.String getConnectionURL()
getConnectionURL
in interface javax.jdo.PersistenceManagerFactory
public void setConnectionDriverName(java.lang.String driverName)
setConnectionDriverName
in interface javax.jdo.PersistenceManagerFactory
driverName
- the driver name for the data store connection.public java.lang.String getConnectionDriverName()
getConnectionDriverName
in interface javax.jdo.PersistenceManagerFactory
public void setConnectionFactoryName(java.lang.String connectionFactoryName)
setConnectionFactoryName
in interface javax.jdo.PersistenceManagerFactory
connectionFactoryName
- the name of the data store
connection factory.public java.lang.String getConnectionFactoryName()
getConnectionFactoryName
in interface javax.jdo.PersistenceManagerFactory
public void setConnectionFactory(java.lang.Object connectionFactory)
setConnectionFactory
in interface javax.jdo.PersistenceManagerFactory
connectionFactory
- the data store connection factory.public java.lang.Object getConnectionFactory()
getConnectionFactory
in interface javax.jdo.PersistenceManagerFactory
public void setConnectionFactory2Name(java.lang.String connectionFactoryName)
setConnectionFactory2Name
in interface javax.jdo.PersistenceManagerFactory
connectionFactoryName
- the name of the connection factory
for non-transactional connections.PersistenceManagerFactory.setConnectionFactory2Name(java.lang.String)
public java.lang.String getConnectionFactory2Name()
getConnectionFactory2Name
in interface javax.jdo.PersistenceManagerFactory
PersistenceManagerFactory.getConnectionFactory2Name()
public void setConnectionFactory2(java.lang.Object connectionFactory)
setConnectionFactory2
in interface javax.jdo.PersistenceManagerFactory
connectionFactory
- the non-transactional connection factory.PersistenceManagerFactory.setConnectionFactory2(java.lang.Object)
public java.lang.Object getConnectionFactory2()
getConnectionFactory2
in interface javax.jdo.PersistenceManagerFactory
PersistenceManagerFactory.getConnectionFactory2()
public void setMultithreaded(boolean flag)
setMultithreaded
in interface javax.jdo.PersistenceManagerFactory
flag
- the default Multithreaded setting.public boolean getMultithreaded()
getMultithreaded
in interface javax.jdo.PersistenceManagerFactory
public void setOptimistic(boolean flag)
setOptimistic
in interface javax.jdo.PersistenceManagerFactory
flag
- the default Optimistic setting.public boolean getOptimistic()
getOptimistic
in interface javax.jdo.PersistenceManagerFactory
public void setRetainValues(boolean flag)
setRetainValues
in interface javax.jdo.PersistenceManagerFactory
flag
- the default RetainValues setting.public boolean getRetainValues()
getRetainValues
in interface javax.jdo.PersistenceManagerFactory
public void setRestoreValues(boolean flag)
setRestoreValues
in interface javax.jdo.PersistenceManagerFactory
flag
- the default RestoreValues setting.public boolean getRestoreValues()
getRestoreValues
in interface javax.jdo.PersistenceManagerFactory
public void setNontransactionalRead(boolean flag)
setNontransactionalRead
in interface javax.jdo.PersistenceManagerFactory
flag
- the default NontransactionalRead setting.public boolean getNontransactionalRead()
getNontransactionalRead
in interface javax.jdo.PersistenceManagerFactory
public void setNontransactionalWrite(boolean flag)
setNontransactionalWrite
in interface javax.jdo.PersistenceManagerFactory
flag
- the default NontransactionalWrite setting.public boolean getNontransactionalWrite()
getNontransactionalWrite
in interface javax.jdo.PersistenceManagerFactory
public void setIgnoreCache(boolean flag)
setIgnoreCache
in interface javax.jdo.PersistenceManagerFactory
flag
- the default IgnoreCache setting.public boolean getIgnoreCache()
getIgnoreCache
in interface javax.jdo.PersistenceManagerFactory
public void setMsWait(int msWait)
msWait
- the default MsWait setting.public int getMsWait()
public void setMinPool(int minPool)
minPool
- the default MinPool setting.public int getMinPool()
public void setMaxPool(int maxPool)
maxPool
- the default MaxPool setting.public int getMaxPool()
public void setQueryTimeout(int queryTimeout)
queryTimeout
- the default QueryTimeout setting.public int getQueryTimeout()
public void setUpdateTimeout(int updateTimeout)
updateTimeout
- the default UpdateTimeout setting.public int getUpdateTimeout()
public java.util.Properties getProperties()
getProperties
in interface javax.jdo.PersistenceManagerFactory
public java.util.Collection supportedOptions()
Each supported JDO optional feature is represented by a String with one of the following values:
javax.jdo.option.TransientTransactional
javax.jdo.option.NontransactionalRead
javax.jdo.option.NontransactionalWrite
javax.jdo.option.RetainValues
javax.jdo.option.Optimistic
javax.jdo.option.ApplicationIdentity
javax.jdo.option.DatastoreIdentity
javax.jdo.option.NonDatastoreIdentity
javax.jdo.option.ArrayList
javax.jdo.option.HashMap
javax.jdo.option.Hashtable
javax.jdo.option.LinkedList
javax.jdo.option.TreeMap
javax.jdo.option.TreeSet
javax.jdo.option.Vector
javax.jdo.option.Map
javax.jdo.option.List
javax.jdo.option.Array
javax.jdo.option.NullCollection
The standard JDO query language is represented by a String:
javax.jdo.query.JDOQL
supportedOptions
in interface javax.jdo.PersistenceManagerFactory
protected abstract java.lang.String[] getOptionArray()
protected abstract javax.jdo.PersistenceManager createPersistenceManager(java.lang.String userid, java.lang.String password)
userid
- The user id of the connection factory.password
- The password of the connection factory.public javax.jdo.PersistenceManager getPersistenceManager()
If pooling of PersistenceManager instances is supported by this factory, the instance might have been returned to the pool and is being reused.
After the first use of getPersistenceManager, no "set" methods will succeed.
getPersistenceManager
in interface javax.jdo.PersistenceManagerFactory
public javax.jdo.PersistenceManager getPersistenceManager(java.lang.String userid, java.lang.String password)
If pooling of PersistenceManager instances is supported by this factory, the instance might have been returned to the pool and is being reused.
After the first use of getPersistenceManager, no "set" methods will succeed.
getPersistenceManager
in interface javax.jdo.PersistenceManagerFactory
userid
- The user id of the connection factory.password
- The password of the connection factory.protected void registerPersistenceManager(PersistenceManagerImpl pm, java.lang.Object t)
pm
- the PersistenceManagert
- the Transaction used as the hashmap keyprotected void deregisterPersistenceManager(PersistenceManagerImpl pm, java.lang.Object t)
pm
- the PersistenceManagert
- the Transaction used as the hashmap keyprotected void releasePersistenceManager(PersistenceManagerImpl pm, java.lang.Object t)
pm
- the PersistenceManagert
- the Transaction used as the hashmap keyprotected void doWriteObject(java.io.ObjectOutputStream oos) throws java.io.IOException
oos
- the ObjectOutputStreamjava.io.IOException
- on errors writing to the streamprotected void doReadObject(java.io.ObjectInputStream ois) throws java.io.IOException, java.lang.ClassNotFoundException
ois
- the ObjectInputStreamjava.io.IOException
- on errors reading from the streamjava.lang.ClassNotFoundException
- if a referenced class cannot be loadedprotected java.util.HashMap getLocalAccessors()
public static void initPropsAccessors()
protected static int toInt(java.lang.String s)
s
- the input Stringpublic java.util.Properties getAsProperties()
protected java.util.Properties getAsPropertiesInternal()
getAsProperties()
protected abstract void setPMFClassProperty(java.util.Properties props)
props
- the Properties to which to add the PMF class propertypublic void setFromProperties(java.util.Properties p)
p
- the Properties used to configure this PMFprotected abstract java.lang.String encrypt(java.lang.String s)
s
- the String to be encryptedprotected abstract java.lang.String decrypt(java.lang.String s)
s
- the String to be decryptedprotected abstract void setCFProperties(java.util.Properties p)
p
- Properties object in which the PMF's ConnectioFactory's
properties are to be set.protected abstract void getCFFromProperties(java.util.Properties p)
p
- Properties from which the ConnectionFactory is to be created.protected abstract boolean isConnectionFactoryConfigured()
public java.lang.String toString()
toString
in class java.lang.Object
protected void verifyConfiguration()
protected void setConfigured()
hashCode()
,
setNonconfigured()
protected void setNonconfigured()
public static void filterProperties(java.util.Properties props, java.util.Properties filtered, java.util.Map accessors)
A properties instance will typically be filtered a number of times: once for the JDO standard PersistenceManagerFactory properties, another for the JDO implementation properties, and another for the implementation ConnectionFactory properties.
A properties accessor map is passed as an argument. The map contains the PMFAccessors, keyed by property name.
props
- the input Propertiesfiltered
- the output propertiesaccessors
- the hashmap of accessors to filter forpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
setConfigured()
,
setNonconfigured()
public void close()
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.
close
in interface javax.jdo.PersistenceManagerFactory
protected void assertNotClosed()
protected java.util.List getActivePersistenceManagers()
protected void closeOpenPersistenceManagers()
protected void shutdown()
Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.