Class SQLPersistenceManagerFactory
- java.lang.Object
-
- com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory
-
- All Implemented Interfaces:
PersistenceManagerFactory,PersistenceManagerFactory,Serializable
public class SQLPersistenceManagerFactory extends Object implements PersistenceManagerFactory
- Version:
- 0.1
- Author:
- Marina Vatkina
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SQLPersistenceManagerFactory()Creates newSQLPersistenceManagerFactorywithout any user infoSQLPersistenceManagerFactory(PersistenceManagerFactory persistenceManagerFactory)Creates newSQLPersistenceManagerFactorywith user parametersSQLPersistenceManagerFactory(Object connectionFactory)Creates newSQLPersistenceManagerFactorywith user info
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Determines whether obj is a SQLPersistenceManagerFactory with the same configurationStringgetConnectionDriverName()Returns JDBC driver nameObjectgetConnectionFactory()Returns ConnectionFactoryStringgetConnectionFactoryName()Returns ConnectionFactory nameintgetConnectionLoginTimeout()Returns the number of seconds to wait for a new connection to be established to the data sourcePrintWritergetConnectionLogWriter()Returns the LogWriter to which messages should be sentintgetConnectionMaxPool()Returns maximum number of connections in the connection poolintgetConnectionMinPool()Returns minimum number of connections in the connection poolintgetConnectionMsInterval()Returns the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.intgetConnectionMsWait()Returns the number of milliseconds to wait for an available connection from the connection pool before throwing an exceptionintgetConnectionTransactionIsolation()Returns current transaction isolation level for connections of this PersistenceManagerFactory.StringgetConnectionURL()Returns connection URLStringgetConnectionUserName()Returns database user nameStringgetIdentifier()Gets Identifier.booleangetIgnoreCache()Returns the boolean value for the flag that allows the user to request that queries be optimized to return approximate results by ignoring changed values in the cache.intgetMaxPool()Returns maximum number of PersistenceManager instances in the poolintgetMinPool()Returns minimum number of PersistenceManager instances in the poolbooleangetNontransactionalRead()Returns the boolean value for the flag that allows non-transactional instances to be managed in the cache.booleangetOptimistic()Returns the boolean value of the optimistic flag for all PersistenceManagersPersistenceManagergetPersistenceManager()Creates new PersistenceManager without specific info.PersistenceManagergetPersistenceManager(String username, char[] password)Creates new PersistenceManager with specific username and password.PersistenceManagerFactorygetPersistenceManagerFactory()Returns instance of PersistenceManagerFactoryPropertiesgetProperties()Returns non-operational properties to be available to the application via a Properties instance.intgetQueryTimeout()Gets the number of seconds to wait for a query statement to execute in the datastore associated with this PersistenceManagerFactory.booleangetRequireCopyObjectId()Returns the default value of the requireCopyObjectId flag.booleangetRequireTrackedSCO()Returns the boolean value of the requireTrackedSCO flag for this PersistenceManagerFactory.booleangetRetainValues()Returns the boolean value for the flag that will not cause the eviction of persistent instances after transaction completion.booleangetSupersedeDeletedInstance()Returns the boolean value of the supersedeDeletedInstance flag for all PersistenceManagers.intgetUpdateTimeout()Gets the number of seconds to wait for an update statement to execute in the datastore associated with this PersistenceManagerFactory.VersionConsistencyCachegetVersionConsistencyCache()Creates if necessary, and returns, this PMF's instance of its VersionConsistencyCache.inthashCode()Computes the hash code of this PersistenceManagerFactory.voidregisterPersistenceManager(PersistenceManager pm, jakarta.transaction.Transaction t)Registers PersistenceManager in the transactional cache in managed environment in case of BMT with JDO Transaction.voidreleasePersistenceManager(PersistenceManager pm, jakarta.transaction.Transaction t)Releases closed PersistenceManager that is not in usevoidsetConnectionDriverName(String driverName)Sets JDBC driver namevoidsetConnectionFactory(Object cf)Sets ConnectionFactoryvoidsetConnectionFactoryName(String connectionFactoryName)Sets ConnectionFactory namevoidsetConnectionLoginTimeout(int LoginTimeout)Sets the number of seconds to wait for a new connection to be established to the data sourcevoidsetConnectionLogWriter(PrintWriter pw)Sets the LogWriter to which messages should be sentvoidsetConnectionMaxPool(int MaxPool)Sets maximum number of connections in the connection poolvoidsetConnectionMinPool(int MinPool)Sets minimum number of connections in the connection poolvoidsetConnectionMsInterval(int MsInterval)Sets the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.voidsetConnectionMsWait(int MsWait)Sets the number of milliseconds to wait for an available connection from the connection pool before throwing an exceptionvoidsetConnectionPassword(char[] password)Sets database user passwordvoidsetConnectionTransactionIsolation(int level)Sets transaction isolation level for all connections of this PersistenceManagerFactory.voidsetConnectionURL(String url)Sets connection URLvoidsetConnectionUserName(String userName)Sets database user namevoidsetIdentifier(String identifier)Sets Identifier.voidsetIgnoreCache(boolean flag)Sets the flag that allows the user to request that queries be optimized to return approximate results by ignoring changed values in the cache.voidsetMaxPool(int MaxPool)Sets maximum number of PersistenceManager instances in the poolvoidsetMinPool(int MinPool)Sets minimum number of PersistenceManager instances in the poolvoidsetNontransactionalRead(boolean flag)Sets the flag that allows non-transactional instances to be managed in the cache.voidsetOptimistic(boolean flag)Sets the optimistic flag for all PersistenceManagersvoidsetQueryTimeout(int timeout)Sets the number of seconds to wait for a query statement to execute in the datastore associated with this PersistenceManagerFactory.voidsetRequireCopyObjectId(boolean flag)Sets the default value of the requireCopyObjectId.voidsetRequireTrackedSCO(boolean flag)Sets the requireTrackedSCO flag for this PersistenceManagerFactory.voidsetRetainValues(boolean flag)Sets flag that will not cause the eviction of persistent instances after transaction completion.voidsetSupersedeDeletedInstance(boolean flag)Sets the supersedeDeletedInstance flag for all PersistenceManagers.voidsetUpdateTimeout(int timeout)Sets the number of seconds to wait for an update statement to execute in the datastore associated with this PersistenceManagerFactory.
-
-
-
Constructor Detail
-
SQLPersistenceManagerFactory
public SQLPersistenceManagerFactory()
Creates newSQLPersistenceManagerFactorywithout any user info
-
SQLPersistenceManagerFactory
public SQLPersistenceManagerFactory(Object connectionFactory)
Creates newSQLPersistenceManagerFactorywith user info- Parameters:
connectionFactory- Connection Factory as java.lang.Object
-
SQLPersistenceManagerFactory
public SQLPersistenceManagerFactory(PersistenceManagerFactory persistenceManagerFactory)
Creates newSQLPersistenceManagerFactorywith user parameters- Parameters:
persistenceManagerFactory- PersistenceManagerFactory instance
-
-
Method Detail
-
setConnectionUserName
public void setConnectionUserName(String userName)
Sets database user name- Specified by:
setConnectionUserNamein interfacePersistenceManagerFactory- Parameters:
userName- user name
-
getConnectionUserName
public String getConnectionUserName()
Returns database user name- Specified by:
getConnectionUserNamein interfacePersistenceManagerFactory- Returns:
- current database user name
-
setConnectionPassword
public void setConnectionPassword(char[] password)
Sets database user password- Specified by:
setConnectionPasswordin interfacePersistenceManagerFactory- Parameters:
password- user password
-
setConnectionURL
public void setConnectionURL(String url)
Sets connection URL- Specified by:
setConnectionURLin interfacePersistenceManagerFactory- Parameters:
url- connection URL
-
getConnectionURL
public String getConnectionURL()
Returns connection URL- Specified by:
getConnectionURLin interfacePersistenceManagerFactory- Returns:
- connection URL
-
setConnectionDriverName
public void setConnectionDriverName(String driverName)
Sets JDBC driver name- Specified by:
setConnectionDriverNamein interfacePersistenceManagerFactory- Parameters:
driverName- driver name
-
getConnectionDriverName
public String getConnectionDriverName()
Returns JDBC driver name- Specified by:
getConnectionDriverNamein interfacePersistenceManagerFactory- Returns:
- driver name
-
setConnectionFactory
public void setConnectionFactory(Object cf)
Sets ConnectionFactory- Specified by:
setConnectionFactoryin interfacePersistenceManagerFactory- Parameters:
cf- as java.lang.Object
-
getConnectionFactory
public Object getConnectionFactory()
Returns ConnectionFactory- Specified by:
getConnectionFactoryin interfacePersistenceManagerFactory- Returns:
- Connection Factory as java.lang.Object
-
setOptimistic
public void setOptimistic(boolean flag)
Sets the optimistic flag for all PersistenceManagers- Specified by:
setOptimisticin interfacePersistenceManagerFactory- Parameters:
flag- boolean optimistic flag
-
getOptimistic
public boolean getOptimistic()
Returns the boolean value of the optimistic flag for all PersistenceManagers- Specified by:
getOptimisticin interfacePersistenceManagerFactory- Returns:
- boolean optimistic flag
-
setRetainValues
public void setRetainValues(boolean flag)
Sets flag that will not cause the eviction of persistent instances after transaction completion.- Specified by:
setRetainValuesin interfacePersistenceManagerFactory- Parameters:
flag- boolean flag passed
-
getRetainValues
public boolean getRetainValues()
Returns the boolean value for the flag that will not cause the eviction of persistent instances after transaction completion.- Specified by:
getRetainValuesin interfacePersistenceManagerFactory- Returns:
- boolean setting for the flag
-
setNontransactionalRead
public void setNontransactionalRead(boolean flag)
Sets the flag that allows non-transactional instances to be managed in the cache.- Specified by:
setNontransactionalReadin interfacePersistenceManagerFactory- Parameters:
flag- boolean flag passed
-
getNontransactionalRead
public boolean getNontransactionalRead()
Returns the boolean value for the flag that allows non-transactional instances to be managed in the cache.- Specified by:
getNontransactionalReadin interfacePersistenceManagerFactory- Returns:
- boolean setting for the flag
-
setIgnoreCache
public void setIgnoreCache(boolean flag)
Sets the flag that allows the user to request that queries be optimized to return approximate results by ignoring changed values in the cache.- Specified by:
setIgnoreCachein interfacePersistenceManagerFactory- Parameters:
flag- boolean flag passed
-
getIgnoreCache
public boolean getIgnoreCache()
Returns the boolean value for the flag that allows the user to request that queries be optimized to return approximate results by ignoring changed values in the cache.- Specified by:
getIgnoreCachein interfacePersistenceManagerFactory- Returns:
- boolean setting for the flag
-
setQueryTimeout
public void setQueryTimeout(int timeout)
Sets the number of seconds to wait for a query statement to execute in the datastore associated with this PersistenceManagerFactory.- Specified by:
setQueryTimeoutin interfacePersistenceManagerFactory- Parameters:
timeout- new timout value in seconds; zero means unlimited
-
getQueryTimeout
public int getQueryTimeout()
Gets the number of seconds to wait for a query statement to execute in the datastore associated with this PersistenceManagerFactory.- Specified by:
getQueryTimeoutin interfacePersistenceManagerFactory- Returns:
- timout value in seconds; zero means unlimited
-
setConnectionMaxPool
public void setConnectionMaxPool(int MaxPool)
Sets maximum number of connections in the connection pool- Specified by:
setConnectionMaxPoolin interfacePersistenceManagerFactory- Parameters:
MaxPool- maximum number of connections
-
getConnectionMaxPool
public int getConnectionMaxPool()
Returns maximum number of connections in the connection pool- Specified by:
getConnectionMaxPoolin interfacePersistenceManagerFactory- Returns:
- connectionMaxPool
-
setConnectionMinPool
public void setConnectionMinPool(int MinPool)
Sets minimum number of connections in the connection pool- Specified by:
setConnectionMinPoolin interfacePersistenceManagerFactory- Parameters:
MinPool- minimum number of connections
-
getConnectionMinPool
public int getConnectionMinPool()
Returns minimum number of connections in the connection pool- Specified by:
getConnectionMinPoolin interfacePersistenceManagerFactory- Returns:
- connectionMinPool
-
setConnectionMsWait
public void setConnectionMsWait(int MsWait)
Sets the number of milliseconds to wait for an available connection from the connection pool before throwing an exception- Specified by:
setConnectionMsWaitin interfacePersistenceManagerFactory- Parameters:
MsWait- number in milliseconds
-
getConnectionMsWait
public int getConnectionMsWait()
Returns the number of milliseconds to wait for an available connection from the connection pool before throwing an exception- Specified by:
getConnectionMsWaitin interfacePersistenceManagerFactory- Returns:
- number in milliseconds
-
setConnectionMsInterval
public void setConnectionMsInterval(int MsInterval)
Sets the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.- Specified by:
setConnectionMsIntervalin interfacePersistenceManagerFactory- Parameters:
MsInterval- the interval between attempts to get a database connection, in milliseconds.
-
getConnectionMsInterval
public int getConnectionMsInterval()
Returns the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.- Specified by:
getConnectionMsIntervalin interfacePersistenceManagerFactory- Returns:
- the length of the interval between tries in milliseconds
-
setConnectionLoginTimeout
public void setConnectionLoginTimeout(int LoginTimeout)
Sets the number of seconds to wait for a new connection to be established to the data source- Specified by:
setConnectionLoginTimeoutin interfacePersistenceManagerFactory- Parameters:
LoginTimeout- wait time in seconds
-
getConnectionLoginTimeout
public int getConnectionLoginTimeout()
Returns the number of seconds to wait for a new connection to be established to the data source- Specified by:
getConnectionLoginTimeoutin interfacePersistenceManagerFactory- Returns:
- wait time in seconds
-
setConnectionLogWriter
public void setConnectionLogWriter(PrintWriter pw)
Sets the LogWriter to which messages should be sent- Specified by:
setConnectionLogWriterin interfacePersistenceManagerFactory- Parameters:
pw- LogWriter
-
getConnectionLogWriter
public PrintWriter getConnectionLogWriter()
Returns the LogWriter to which messages should be sent- Specified by:
getConnectionLogWriterin interfacePersistenceManagerFactory- Returns:
- LogWriter
-
setConnectionTransactionIsolation
public void setConnectionTransactionIsolation(int level)
Sets transaction isolation level for all connections of this PersistenceManagerFactory. All validation is done by java.sql.Connection itself, so e.g. while Oracle will not allow to set solation level to TRANSACTION_REPEATABLE_READ, this method does not have any explicit restrictions- Specified by:
setConnectionTransactionIsolationin interfacePersistenceManagerFactory- Parameters:
level- - one of the java.sql.Connection.TRANSACTION_* isolation values
-
getConnectionTransactionIsolation
public int getConnectionTransactionIsolation()
Returns current transaction isolation level for connections of this PersistenceManagerFactory.- Specified by:
getConnectionTransactionIsolationin interfacePersistenceManagerFactory- Returns:
- the current transaction isolation mode value as java.sql.Connection.TRANSACTION_*
-
setConnectionFactoryName
public void setConnectionFactoryName(String connectionFactoryName)
Sets ConnectionFactory name- Specified by:
setConnectionFactoryNamein interfacePersistenceManagerFactory- Parameters:
connectionFactoryName- ConnectionFactory name
-
getConnectionFactoryName
public String getConnectionFactoryName()
Returns ConnectionFactory name- Specified by:
getConnectionFactoryNamein interfacePersistenceManagerFactory- Returns:
- ConnectionFactoryName
-
setIdentifier
public void setIdentifier(String identifier)
Sets Identifier.- Specified by:
setIdentifierin interfacePersistenceManagerFactory- Parameters:
identifier-
-
getIdentifier
public String getIdentifier()
Gets Identifier.- Specified by:
getIdentifierin interfacePersistenceManagerFactory- Returns:
- identifier
-
getMaxPool
public int getMaxPool()
Returns maximum number of PersistenceManager instances in the pool- Specified by:
getMaxPoolin interfacePersistenceManagerFactory- Returns:
- maxPool
-
setMaxPool
public void setMaxPool(int MaxPool)
Sets maximum number of PersistenceManager instances in the pool- Specified by:
setMaxPoolin interfacePersistenceManagerFactory- Parameters:
MaxPool- maximum number of PersistenceManager instances
-
getMinPool
public int getMinPool()
Returns minimum number of PersistenceManager instances in the pool- Specified by:
getMinPoolin interfacePersistenceManagerFactory- Returns:
- minPool
-
setMinPool
public void setMinPool(int MinPool)
Sets minimum number of PersistenceManager instances in the pool- Specified by:
setMinPoolin interfacePersistenceManagerFactory- Parameters:
MinPool- minimum number of PersistenceManager instances
-
setUpdateTimeout
public void setUpdateTimeout(int timeout)
Sets the number of seconds to wait for an update statement to execute in the datastore associated with this PersistenceManagerFactory.- Specified by:
setUpdateTimeoutin interfacePersistenceManagerFactory- Parameters:
timeout- new timout value in seconds; zero means unlimited
-
getUpdateTimeout
public int getUpdateTimeout()
Gets the number of seconds to wait for an update statement to execute in the datastore associated with this PersistenceManagerFactory.- Specified by:
getUpdateTimeoutin interfacePersistenceManagerFactory- Returns:
- timout value in seconds; zero means unlimited
-
getSupersedeDeletedInstance
public boolean getSupersedeDeletedInstance()
Returns the boolean value of the supersedeDeletedInstance flag for all PersistenceManagers. If set to true, deleted instances are allowed to be replaced with persistent-new instances with the equal Object Id.- Specified by:
getSupersedeDeletedInstancein interfacePersistenceManagerFactory- Returns:
- boolean supersedeDeletedInstance flag
-
setSupersedeDeletedInstance
public void setSupersedeDeletedInstance(boolean flag)
Sets the supersedeDeletedInstance flag for all PersistenceManagers.- Specified by:
setSupersedeDeletedInstancein interfacePersistenceManagerFactory- Parameters:
flag- boolean supersedeDeletedInstance flag
-
getRequireCopyObjectId
public boolean getRequireCopyObjectId()
Returns the default value of the requireCopyObjectId flag. If set to false, PersistenceManagers will not create a copy of an ObjectId forPersistenceManager.getObjectId(Object pc)andPersistenceManager.getObjectById(Object oid)requests.- Specified by:
getRequireCopyObjectIdin interfacePersistenceManagerFactory- Returns:
- boolean requireCopyObjectId flag
- See Also:
PersistenceManager.getObjectId(Object pc),PersistenceManager.getObjectById(Object oid)
-
setRequireCopyObjectId
public void setRequireCopyObjectId(boolean flag)
Sets the default value of the requireCopyObjectId. If set to false, PersistenceManagers will not create a copy of an ObjectId forPersistenceManager.getObjectId(Object pc)andPersistenceManager.getObjectById(Object oid)requests.- Specified by:
setRequireCopyObjectIdin interfacePersistenceManagerFactory- Parameters:
flag- boolean requireCopyObjectId flag- See Also:
PersistenceManager.getObjectId(Object pc),PersistenceManager.getObjectById(Object oid)
-
getRequireTrackedSCO
public boolean getRequireTrackedSCO()
Returns the boolean value of the requireTrackedSCO flag for this PersistenceManagerFactory. If set to false, by default the PersistenceManager will not create tracked SCO instances for new persistent instances at commit with retainValues set to true and while retrieving data from a datastore.- Specified by:
getRequireTrackedSCOin interfacePersistenceManagerFactory- Returns:
- boolean requireTrackedSCO flag
-
setRequireTrackedSCO
public void setRequireTrackedSCO(boolean flag)
Sets the requireTrackedSCO flag for this PersistenceManagerFactory. If set to false, by default the PersistenceManager will not create tracked SCO instances for new persistent instances at commit with retainValues set to true requests and while retrieving data from a datastore.- Specified by:
setRequireTrackedSCOin interfacePersistenceManagerFactory- Parameters:
flag- boolean requireTrackedSCO flag
-
getPersistenceManager
public PersistenceManager getPersistenceManager()
Creates new PersistenceManager without specific info.- Specified by:
getPersistenceManagerin interfacePersistenceManagerFactory- Returns:
- the persistence manager
- Throws:
JDOUserException- if data source info is not set
-
getPersistenceManager
public PersistenceManager getPersistenceManager(String username, char[] password)
Creates new PersistenceManager with specific username and password. Used to call ConnectionFactory.getConnection(String, String)- Specified by:
getPersistenceManagerin interfacePersistenceManagerFactory- Parameters:
username- datasource userpassword- datasource user password- Returns:
- the persistence manager
- Throws:
JDOUserException- if data source info is not set
-
getProperties
public Properties getProperties()
Returns non-operational properties to be available to the application via a Properties instance.- Specified by:
getPropertiesin interfacePersistenceManagerFactory- Returns:
- Properties object
-
getPersistenceManagerFactory
public PersistenceManagerFactory getPersistenceManagerFactory()
Returns instance of PersistenceManagerFactory
-
registerPersistenceManager
public void registerPersistenceManager(PersistenceManager pm, jakarta.transaction.Transaction t)
Registers PersistenceManager in the transactional cache in managed environment in case of BMT with JDO Transaction. There is no jakarta.transaction.Transaction available before the user starts the transaction.- Specified by:
registerPersistenceManagerin interfacePersistenceManagerFactory
-
releasePersistenceManager
public void releasePersistenceManager(PersistenceManager pm, jakarta.transaction.Transaction t)
Releases closed PersistenceManager that is not in use- Specified by:
releasePersistenceManagerin interfacePersistenceManagerFactory
-
equals
public boolean equals(Object obj)
Determines whether obj is a SQLPersistenceManagerFactory with the same configuration
-
hashCode
public int hashCode()
Computes the hash code of this PersistenceManagerFactory.
-
getVersionConsistencyCache
public VersionConsistencyCache getVersionConsistencyCache()
Creates if necessary, and returns, this PMF's instance of its VersionConsistencyCache.- Specified by:
getVersionConsistencyCachein interfacePersistenceManagerFactory- Returns:
- This PMF's VersionConsistencyCache.
-
-