Methods Summary |
---|
public boolean | equals(java.lang.Object obj)Determines whether obj is a SQLPersistenceManagerFactory with the same configuration
if ((obj != null) && (obj instanceof SQLPersistenceManagerFactory)) {
SQLPersistenceManagerFactory pmf = (SQLPersistenceManagerFactory) obj;
return (pmf._persistenceManagerFactory.equals(this._persistenceManagerFactory));
}
return false;
|
private java.sql.Connection | getConnection(java.lang.String username, java.lang.String password)Get Database connection for username and password.
Connection conn = null;
if (_connectionFactory != null) {
conn = _connectionFactory.getConnection();
} else if (EJBHelper.isManaged()) {
conn = EJBHelper.getConnection(_dataSource, username, password);
} else {
if (username == null) {
conn = ((DataSource)_dataSource).getConnection();
} else {
conn = ((DataSource)_dataSource).getConnection(username, password);
}
}
return conn;
|
public java.lang.String | getConnectionDriverName()Returns JDBC driver name
return _persistenceManagerFactory.getConnectionDriverName();
|
public java.lang.Object | getConnectionFactory()Returns ConnectionFactory
if (_dataSource != null)
return _dataSource;
return _connectionFactory;
|
public java.lang.String | getConnectionFactoryName()Returns ConnectionFactory name
return _persistenceManagerFactory.getConnectionFactoryName();
|
public java.io.PrintWriter | getConnectionLogWriter()Returns the LogWriter to which messages should be sent
return _persistenceManagerFactory.getConnectionLogWriter();
|
public int | getConnectionLoginTimeout()Returns the number of seconds to wait for a new connection to be
established to the data source
return _persistenceManagerFactory.getConnectionLoginTimeout();
|
public int | getConnectionMaxPool()Returns maximum number of connections in the connection pool
return _persistenceManagerFactory.getConnectionMaxPool();
|
public int | getConnectionMinPool()Returns minimum number of connections in the connection pool
return _persistenceManagerFactory.getConnectionMinPool();
|
public int | getConnectionMsInterval()Returns the amount of time, in milliseconds, between the connection
manager's attempts to get a pooled connection.
return _persistenceManagerFactory.getConnectionMsInterval();
|
public int | getConnectionMsWait()Returns the number of milliseconds to wait for an available connection
from the connection pool before throwing an exception
return _persistenceManagerFactory.getConnectionMsWait();
|
public int | getConnectionTransactionIsolation()Returns current transaction isolation level for connections of this PersistenceManagerFactory.
return _persistenceManagerFactory.getConnectionTransactionIsolation();
|
public java.lang.String | getConnectionURL()Returns connection URL
return _persistenceManagerFactory.getConnectionURL();
|
public java.lang.String | getConnectionUserName()Returns database user name
return _persistenceManagerFactory.getConnectionUserName();
|
private PersistenceManagerImpl | getFromPool(javax.transaction.Transaction tx, java.lang.String username, java.lang.String password)Returns an instance of PersistenceManagerImpl from available pool
or creates a new one
boolean debug = logger.isLoggable(Logger.FINEST);
if (debug) {
logger.finest("sqlstore.sqlpersistencemgrfactory.getfrompool"); // NOI18N
}
synchronized (this) {
if (_store == null) {
initializeSQLStoreManager(username, password);
}
}
// create new PersistenceManager object and set its atributes
PersistenceManagerImpl pm = new PersistenceManagerImpl(this, tx, username, password);
pm.setStore(_store);
if (debug) {
Object[] items = new Object[] {pm,tx};
logger.finest("sqlstore.sqlpersistencemgrfactory.getfrompool.pmt",items); // NOI18N
}
return pm;
|
public java.lang.String | getIdentifier()Gets Identifier.
return _persistenceManagerFactory.getIdentifier();
|
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.
return _persistenceManagerFactory.getIgnoreCache();
|
public int | getMaxPool()Returns maximum number of PersistenceManager instances in the pool
return maxPool;
|
public int | getMinPool()Returns minimum number of PersistenceManager instances in the pool
return minPool;
|
public boolean | getNontransactionalRead()Returns the boolean value for the flag that allows non-transactional instances to be
managed in the cache.
return _persistenceManagerFactory.getNontransactionalRead();
|
public boolean | getOptimistic()Returns the boolean value of the optimistic flag for all PersistenceManagers
return _persistenceManagerFactory.getOptimistic();
|
public PersistenceManager | getPersistenceManager()Creates new PersistenceManager without specific
info.
return getPersistenceManager(null, null);
|
public PersistenceManager | getPersistenceManager(java.lang.String username, java.lang.String password)Creates new PersistenceManager with specific
username and password. Used to call ConnectionFactory.getConnection(String, String)
boolean debug = logger.isLoggable(Logger.FINEST);
if (_connectionFactory == null && _dataSource == null) {
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.getpersistencemanager.notconfigured"));// NOI18N
}
if (debug) {
logger.finest("sqlstore.sqlpersistencemgrfactory.getpersistencemgr",Thread.currentThread()); // NOI18N
}
// Check if we are in managed environment and PersistenceManager is cached
PersistenceManagerImpl pm = null;
javax.transaction.Transaction t = EJBHelper.getTransaction();
if (t != null) {
if (debug) {
Object[] items = new Object[] {Thread.currentThread(),t};
logger.finest("sqlstore.sqlpersistencemgrfactory.getpersistencemgr.found",items); // NOI18N
}
pm = (PersistenceManagerImpl) pmCache.get(t);
if (pm == null) {
// Not found
pm = getFromPool(t, username, password);
pmCache.put(t, pm);
} else if(pm.isClosed()) {
if (debug) {
Object[] items = new Object[] {Thread.currentThread(),t};
logger.finest("sqlstore.sqlpersistencemgrfactory.getpersistencemgr.pmclosedfor",items); // NOI18N
}
throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.getpersistencemanager.closed", // NOI18N
t));
}
// We know we are in the managed environment and
// JTA transaction is active. We need to start
// JDO Transaction internally if it is not active.
com.sun.jdo.spi.persistence.support.sqlstore.Transaction tx =
(com.sun.jdo.spi.persistence.support.sqlstore.Transaction) pm.currentTransaction();
if (debug) {
logger.finest("sqlstore.sqlpersistencemgrfactory.getpersistencemgr.jdotx",tx); // NOI18N
}
if (!tx.isActive()) {
tx.begin(t);
}
if (!(pm.verify(username, password))) {
;
throw new JDOUserException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.getpersistencemanager.error")); // NOI18N
}
} else {
if (debug) {
logger.finest("sqlstore.sqlpersistencemgrfactory.getpersistencemgr.jdotx.notfound"); // NOI18N
}
// We don't know if we are in the managed environment or not
// If Yes, it is BMT with JDO Transaction and it will register
// itself at the begin().
pm = getFromPool(null, username, password);
}
if (debug) {
Object[] items = new Object[] {Thread.currentThread(),pm,t};
logger.finest("sqlstore.sqlpersistencemgrfactory.getpersistencemgr.pmt",items); // NOI18N
}
// Always return a wrapper
return new PersistenceManagerWrapper(pm);
|
public PersistenceManagerFactory | getPersistenceManagerFactory()Returns instance of PersistenceManagerFactory
return _persistenceManagerFactory;
|
public java.util.Properties | getProperties()Returns non-operational properties to be available to the application via a Properties instance.
return _persistenceManagerFactory.getProperties();
|
public int | getQueryTimeout()Gets the number of seconds to wait for a query statement
to execute in the datastore associated with this PersistenceManagerFactory.
return _persistenceManagerFactory.getQueryTimeout();
|
public boolean | getRequireCopyObjectId()Returns the default value of the requireCopyObjectId flag. If set to false, PersistenceManagers
will not create a copy of an ObjectId for PersistenceManager.getObjectId(Object pc)
and PersistenceManager.getObjectById(Object oid) requests.
return _persistenceManagerFactory.getRequireCopyObjectId();
|
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.
return _persistenceManagerFactory.getRequireTrackedSCO();
|
public boolean | getRetainValues()Returns the boolean value for the flag that will not cause the eviction of persistent
instances after transaction completion.
return _persistenceManagerFactory.getRetainValues();
|
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.
return _persistenceManagerFactory.getSupersedeDeletedInstance();
|
public int | getUpdateTimeout()Gets the number of seconds to wait for an update statement
to execute in the datastore associated with this PersistenceManagerFactory.
return _persistenceManagerFactory.getUpdateTimeout();
|
public com.sun.jdo.spi.persistence.support.sqlstore.VersionConsistencyCache | getVersionConsistencyCache()Creates if necessary, and returns, this PMF's instance of its
VersionConsistencyCache.
if (null == vcCache) {
if (_store == null) {
// Store should be configured already.
throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.getversionconsistencycache.nullstore")); // NOI18N
}
vcCache = VersionConsistencyCacheImpl.create();
_store.getConfigCache().setVersionConsistencyCache(vcCache);
}
return vcCache;
|
public int | hashCode()Computes the hash code of this PersistenceManagerFactory.
return this._persistenceManagerFactory.hashCode();
|
private void | initialize()
logger.finest("sqlstore.sqlpersistencemgrfactory.init"); // NOI18N
optimistic = _persistenceManagerFactory.getOptimistic();
retainValues = _persistenceManagerFactory.getRetainValues();
nontransactionalRead = _persistenceManagerFactory.getNontransactionalRead();
ignoreCache = _persistenceManagerFactory.getIgnoreCache();
queryTimeout = _persistenceManagerFactory.getQueryTimeout();
updateTimeout = _persistenceManagerFactory.getUpdateTimeout();
minPool = _persistenceManagerFactory.getMinPool();
maxPool = _persistenceManagerFactory.getMaxPool();
|
private void | initializeSQLStoreManager(java.lang.String username, java.lang.String password)
Connection conn = null;
try {
conn = getConnection(username, password);
if (conn != null) {
_store = new SQLStoreManager(conn.getMetaData(),
getIdentifier() );
}
} catch(Exception e) {
if (logger.isLoggable(Logger.WARNING)) {
logger.log(Logger.WARNING, "jdo.sqlpersistencemanagerfactory.errorgettingDatabaseInfo", e); //NOI18N
}
if (e instanceof JDOException) {
throw (JDOException) e;
} else {
throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
"core.configuration.getvendortypefailed"), e); // NOI18N
}
} finally {
if (conn != null) {
try {
conn.close();
} catch(Exception ex) {}
}
}
|
public void | registerPersistenceManager(com.sun.jdo.spi.persistence.support.sqlstore.PersistenceManager pm, javax.transaction.Transaction t)Registers PersistenceManager in the transactional cache in
managed environment in case of BMT with JDO Transaction.
There is no javax.transaction.Transaction
available before the user starts the transaction.
boolean debug = logger.isLoggable(Logger.FINEST);
if (debug) {
Object[] items = new Object[] {pm,t};
logger.finest("sqlstore.sqlpersistencemgrfactory.registerpersistencemgr.pmt",items); // NOI18N
}
PersistenceManager pm1 = (PersistenceManager) pmCache.get(t);
// double-check locking has been removed
if (pm1 == null) {
pmCache.put(t, pm);
((PersistenceManagerImpl) pm).setJTATransaction(t);
return;
}
if (pm1 != pm) {
Object[] items = new Object[] {t, pm1};
throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.registerpm.registered", // NOI18N
items));
} else {
// do nothing ???
}
|
public void | releasePersistenceManager(com.sun.jdo.spi.persistence.support.sqlstore.PersistenceManager pm, javax.transaction.Transaction t)Releases closed PersistenceManager that is not in use
boolean debug = logger.isLoggable(Logger.FINEST);
if (debug) {
Object[] items = new Object[] {pm,t};
logger.finest("sqlstore.sqlpersistencemgrfactory.releasepm.pmt",items); // NOI18N
}
if (t != null) {
// Managed environment
// Deregister only
PersistenceManager pm1 = (PersistenceManager) pmCache.get(t);
if (pm1 == null || pm1 != pm) {
Object[] items = new Object[] {t, pm1};
throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.registerpm.registered", // NOI18N
items));
} else {
pmCache.remove(t);
}
} else {
returnToPool(pm);
}
|
private void | returnToPool(PersistenceManager pm)Returns unused PersistenceManager to the free pool
// do nothing for now
logger.finest("sqlstore.sqlpersistencemgrfactory.returnToPool"); // NOI18N
|
public void | setConnectionDriverName(java.lang.String driverName)Sets JDBC driver name
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionFactory(java.lang.Object cf)Sets ConnectionFactory
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionFactoryName(java.lang.String connectionFactoryName)Sets ConnectionFactory name
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionLogWriter(java.io.PrintWriter pw)Sets the LogWriter to which messages should be sent
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionLoginTimeout(int LoginTimeout)Sets the number of seconds to wait for a new connection to be
established to the data source
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionMaxPool(int MaxPool)Sets maximum number of connections in the connection pool
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionMinPool(int MinPool)Sets minimum number of connections in the connection pool
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionMsInterval(int MsInterval)Sets the amount of time, in milliseconds, between the connection
manager's attempts to get a pooled connection.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionMsWait(int MsWait)Sets the number of milliseconds to wait for an available connection
from the connection pool before throwing an exception
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionPassword(java.lang.String password)Sets database user password
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
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
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionURL(java.lang.String url)Sets connection URL
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setConnectionUserName(java.lang.String userName)Sets database user name
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setIdentifier(java.lang.String identifier)Sets Identifier.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
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.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setMaxPool(int MaxPool)Sets maximum number of PersistenceManager instances in the pool
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setMinPool(int MinPool)Sets minimum number of PersistenceManager instances in the pool
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setNontransactionalRead(boolean flag)Sets the flag that allows non-transactional instances to be managed in the cache.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setOptimistic(boolean flag)Sets the optimistic flag for all PersistenceManagers
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
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.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
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 for PersistenceManager.getObjectId(Object pc)
and PersistenceManager.getObjectById(Object oid) requests.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
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.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setRetainValues(boolean flag)Sets flag that will not cause the eviction of persistent instances after transaction completion.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
public void | setSupersedeDeletedInstance(boolean flag)Sets the supersedeDeletedInstance flag for all PersistenceManagers.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|
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.
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages,
"jdo.persistencemanagerfactoryimpl.notsupported")); //NOI18N
|