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 newSQLPersistenceManagerFactory
without any user infoSQLPersistenceManagerFactory(PersistenceManagerFactory persistenceManagerFactory)
Creates newSQLPersistenceManagerFactory
with user parametersSQLPersistenceManagerFactory(Object connectionFactory)
Creates newSQLPersistenceManagerFactory
with user info
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Determines whether obj is a SQLPersistenceManagerFactory with the same configurationString
getConnectionDriverName()
Returns JDBC driver nameObject
getConnectionFactory()
Returns ConnectionFactoryString
getConnectionFactoryName()
Returns ConnectionFactory nameint
getConnectionLoginTimeout()
Returns the number of seconds to wait for a new connection to be established to the data sourcePrintWriter
getConnectionLogWriter()
Returns the LogWriter to which messages should be sentint
getConnectionMaxPool()
Returns maximum number of connections in the connection poolint
getConnectionMinPool()
Returns minimum number of connections in the connection poolint
getConnectionMsInterval()
Returns the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.int
getConnectionMsWait()
Returns the number of milliseconds to wait for an available connection from the connection pool before throwing an exceptionint
getConnectionTransactionIsolation()
Returns current transaction isolation level for connections of this PersistenceManagerFactory.String
getConnectionURL()
Returns connection URLString
getConnectionUserName()
Returns database user nameString
getIdentifier()
Gets Identifier.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.int
getMaxPool()
Returns maximum number of PersistenceManager instances in the poolint
getMinPool()
Returns minimum number of PersistenceManager instances in the poolboolean
getNontransactionalRead()
Returns the boolean value for the flag that allows non-transactional instances to be managed in the cache.boolean
getOptimistic()
Returns the boolean value of the optimistic flag for all PersistenceManagersPersistenceManager
getPersistenceManager()
Creates new PersistenceManager without specific info.PersistenceManager
getPersistenceManager(String username, char[] password)
Creates new PersistenceManager with specific username and password.PersistenceManagerFactory
getPersistenceManagerFactory()
Returns instance of PersistenceManagerFactoryProperties
getProperties()
Returns non-operational properties to be available to the application via a Properties instance.int
getQueryTimeout()
Gets the number of seconds to wait for a query statement to execute in the datastore associated with this PersistenceManagerFactory.boolean
getRequireCopyObjectId()
Returns the default value of the requireCopyObjectId flag.boolean
getRequireTrackedSCO()
Returns the boolean value of the requireTrackedSCO flag for this PersistenceManagerFactory.boolean
getRetainValues()
Returns the boolean value for the flag that will not cause the eviction of persistent instances after transaction completion.boolean
getSupersedeDeletedInstance()
Returns the boolean value of the supersedeDeletedInstance flag for all PersistenceManagers.int
getUpdateTimeout()
Gets the number of seconds to wait for an update statement to execute in the datastore associated with this PersistenceManagerFactory.VersionConsistencyCache
getVersionConsistencyCache()
Creates if necessary, and returns, this PMF's instance of its VersionConsistencyCache.int
hashCode()
Computes the hash code of this PersistenceManagerFactory.void
registerPersistenceManager(PersistenceManager pm, jakarta.transaction.Transaction t)
Registers PersistenceManager in the transactional cache in managed environment in case of BMT with JDO Transaction.void
releasePersistenceManager(PersistenceManager pm, jakarta.transaction.Transaction t)
Releases closed PersistenceManager that is not in usevoid
setConnectionDriverName(String driverName)
Sets JDBC driver namevoid
setConnectionFactory(Object cf)
Sets ConnectionFactoryvoid
setConnectionFactoryName(String connectionFactoryName)
Sets ConnectionFactory namevoid
setConnectionLoginTimeout(int LoginTimeout)
Sets the number of seconds to wait for a new connection to be established to the data sourcevoid
setConnectionLogWriter(PrintWriter pw)
Sets the LogWriter to which messages should be sentvoid
setConnectionMaxPool(int MaxPool)
Sets maximum number of connections in the connection poolvoid
setConnectionMinPool(int MinPool)
Sets minimum number of connections in the connection poolvoid
setConnectionMsInterval(int MsInterval)
Sets the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.void
setConnectionMsWait(int MsWait)
Sets the number of milliseconds to wait for an available connection from the connection pool before throwing an exceptionvoid
setConnectionPassword(char[] password)
Sets database user passwordvoid
setConnectionTransactionIsolation(int level)
Sets transaction isolation level for all connections of this PersistenceManagerFactory.void
setConnectionURL(String url)
Sets connection URLvoid
setConnectionUserName(String userName)
Sets database user namevoid
setIdentifier(String identifier)
Sets Identifier.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.void
setMaxPool(int MaxPool)
Sets maximum number of PersistenceManager instances in the poolvoid
setMinPool(int MinPool)
Sets minimum number of PersistenceManager instances in the poolvoid
setNontransactionalRead(boolean flag)
Sets the flag that allows non-transactional instances to be managed in the cache.void
setOptimistic(boolean flag)
Sets the optimistic flag for all PersistenceManagersvoid
setQueryTimeout(int timeout)
Sets the number of seconds to wait for a query statement to execute in the datastore associated with this PersistenceManagerFactory.void
setRequireCopyObjectId(boolean flag)
Sets the default value of the requireCopyObjectId.void
setRequireTrackedSCO(boolean flag)
Sets the requireTrackedSCO flag for this PersistenceManagerFactory.void
setRetainValues(boolean flag)
Sets flag that will not cause the eviction of persistent instances after transaction completion.void
setSupersedeDeletedInstance(boolean flag)
Sets the supersedeDeletedInstance flag for all PersistenceManagers.void
setUpdateTimeout(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 newSQLPersistenceManagerFactory
without any user info
-
SQLPersistenceManagerFactory
public SQLPersistenceManagerFactory(Object connectionFactory)
Creates newSQLPersistenceManagerFactory
with user info- Parameters:
connectionFactory
- Connection Factory as java.lang.Object
-
SQLPersistenceManagerFactory
public SQLPersistenceManagerFactory(PersistenceManagerFactory persistenceManagerFactory)
Creates newSQLPersistenceManagerFactory
with user parameters- Parameters:
persistenceManagerFactory
- PersistenceManagerFactory instance
-
-
Method Detail
-
setConnectionUserName
public void setConnectionUserName(String userName)
Sets database user name- Specified by:
setConnectionUserName
in interfacePersistenceManagerFactory
- Parameters:
userName
- user name
-
getConnectionUserName
public String getConnectionUserName()
Returns database user name- Specified by:
getConnectionUserName
in interfacePersistenceManagerFactory
- Returns:
- current database user name
-
setConnectionPassword
public void setConnectionPassword(char[] password)
Sets database user password- Specified by:
setConnectionPassword
in interfacePersistenceManagerFactory
- Parameters:
password
- user password
-
setConnectionURL
public void setConnectionURL(String url)
Sets connection URL- Specified by:
setConnectionURL
in interfacePersistenceManagerFactory
- Parameters:
url
- connection URL
-
getConnectionURL
public String getConnectionURL()
Returns connection URL- Specified by:
getConnectionURL
in interfacePersistenceManagerFactory
- Returns:
- connection URL
-
setConnectionDriverName
public void setConnectionDriverName(String driverName)
Sets JDBC driver name- Specified by:
setConnectionDriverName
in interfacePersistenceManagerFactory
- Parameters:
driverName
- driver name
-
getConnectionDriverName
public String getConnectionDriverName()
Returns JDBC driver name- Specified by:
getConnectionDriverName
in interfacePersistenceManagerFactory
- Returns:
- driver name
-
setConnectionFactory
public void setConnectionFactory(Object cf)
Sets ConnectionFactory- Specified by:
setConnectionFactory
in interfacePersistenceManagerFactory
- Parameters:
cf
- as java.lang.Object
-
getConnectionFactory
public Object getConnectionFactory()
Returns ConnectionFactory- Specified by:
getConnectionFactory
in interfacePersistenceManagerFactory
- Returns:
- Connection Factory as java.lang.Object
-
setOptimistic
public void setOptimistic(boolean flag)
Sets the optimistic flag for all PersistenceManagers- Specified by:
setOptimistic
in interfacePersistenceManagerFactory
- Parameters:
flag
- boolean optimistic flag
-
getOptimistic
public boolean getOptimistic()
Returns the boolean value of the optimistic flag for all PersistenceManagers- Specified by:
getOptimistic
in 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:
setRetainValues
in 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:
getRetainValues
in 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:
setNontransactionalRead
in 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:
getNontransactionalRead
in 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:
setIgnoreCache
in 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:
getIgnoreCache
in 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:
setQueryTimeout
in 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:
getQueryTimeout
in 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:
setConnectionMaxPool
in interfacePersistenceManagerFactory
- Parameters:
MaxPool
- maximum number of connections
-
getConnectionMaxPool
public int getConnectionMaxPool()
Returns maximum number of connections in the connection pool- Specified by:
getConnectionMaxPool
in interfacePersistenceManagerFactory
- Returns:
- connectionMaxPool
-
setConnectionMinPool
public void setConnectionMinPool(int MinPool)
Sets minimum number of connections in the connection pool- Specified by:
setConnectionMinPool
in interfacePersistenceManagerFactory
- Parameters:
MinPool
- minimum number of connections
-
getConnectionMinPool
public int getConnectionMinPool()
Returns minimum number of connections in the connection pool- Specified by:
getConnectionMinPool
in 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:
setConnectionMsWait
in 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:
getConnectionMsWait
in 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:
setConnectionMsInterval
in 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:
getConnectionMsInterval
in 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:
setConnectionLoginTimeout
in 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:
getConnectionLoginTimeout
in interfacePersistenceManagerFactory
- Returns:
- wait time in seconds
-
setConnectionLogWriter
public void setConnectionLogWriter(PrintWriter pw)
Sets the LogWriter to which messages should be sent- Specified by:
setConnectionLogWriter
in interfacePersistenceManagerFactory
- Parameters:
pw
- LogWriter
-
getConnectionLogWriter
public PrintWriter getConnectionLogWriter()
Returns the LogWriter to which messages should be sent- Specified by:
getConnectionLogWriter
in 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:
setConnectionTransactionIsolation
in 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:
getConnectionTransactionIsolation
in interfacePersistenceManagerFactory
- Returns:
- the current transaction isolation mode value as java.sql.Connection.TRANSACTION_*
-
setConnectionFactoryName
public void setConnectionFactoryName(String connectionFactoryName)
Sets ConnectionFactory name- Specified by:
setConnectionFactoryName
in interfacePersistenceManagerFactory
- Parameters:
connectionFactoryName
- ConnectionFactory name
-
getConnectionFactoryName
public String getConnectionFactoryName()
Returns ConnectionFactory name- Specified by:
getConnectionFactoryName
in interfacePersistenceManagerFactory
- Returns:
- ConnectionFactoryName
-
setIdentifier
public void setIdentifier(String identifier)
Sets Identifier.- Specified by:
setIdentifier
in interfacePersistenceManagerFactory
- Parameters:
identifier
-
-
getIdentifier
public String getIdentifier()
Gets Identifier.- Specified by:
getIdentifier
in interfacePersistenceManagerFactory
- Returns:
- identifier
-
getMaxPool
public int getMaxPool()
Returns maximum number of PersistenceManager instances in the pool- Specified by:
getMaxPool
in interfacePersistenceManagerFactory
- Returns:
- maxPool
-
setMaxPool
public void setMaxPool(int MaxPool)
Sets maximum number of PersistenceManager instances in the pool- Specified by:
setMaxPool
in interfacePersistenceManagerFactory
- Parameters:
MaxPool
- maximum number of PersistenceManager instances
-
getMinPool
public int getMinPool()
Returns minimum number of PersistenceManager instances in the pool- Specified by:
getMinPool
in interfacePersistenceManagerFactory
- Returns:
- minPool
-
setMinPool
public void setMinPool(int MinPool)
Sets minimum number of PersistenceManager instances in the pool- Specified by:
setMinPool
in 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:
setUpdateTimeout
in 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:
getUpdateTimeout
in 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:
getSupersedeDeletedInstance
in interfacePersistenceManagerFactory
- Returns:
- boolean supersedeDeletedInstance flag
-
setSupersedeDeletedInstance
public void setSupersedeDeletedInstance(boolean flag)
Sets the supersedeDeletedInstance flag for all PersistenceManagers.- Specified by:
setSupersedeDeletedInstance
in 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:
getRequireCopyObjectId
in 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:
setRequireCopyObjectId
in 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:
getRequireTrackedSCO
in 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:
setRequireTrackedSCO
in interfacePersistenceManagerFactory
- Parameters:
flag
- boolean requireTrackedSCO flag
-
getPersistenceManager
public PersistenceManager getPersistenceManager()
Creates new PersistenceManager without specific info.- Specified by:
getPersistenceManager
in 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:
getPersistenceManager
in 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:
getProperties
in 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:
registerPersistenceManager
in interfacePersistenceManagerFactory
-
releasePersistenceManager
public void releasePersistenceManager(PersistenceManager pm, jakarta.transaction.Transaction t)
Releases closed PersistenceManager that is not in use- Specified by:
releasePersistenceManager
in 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:
getVersionConsistencyCache
in interfacePersistenceManagerFactory
- Returns:
- This PMF's VersionConsistencyCache.
-
-