You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by th...@apache.org on 2002/12/01 17:54:58 UTC
cvs commit: jakarta-ojb/src/jdori/org/apache/ojb/jdori/sql OjbStoreManager.java OjbStoreConnector.java OjbStoreFatalInternalException.java OjbStorePMF.java Bundle.properties package.html
thma 2002/12/01 08:54:58
Modified: src/jdori/org/apache/ojb/jdori/sql OjbStoreManager.java
OjbStoreConnector.java
OjbStoreFatalInternalException.java
OjbStorePMF.java
Removed: src/jdori/org/apache/ojb/jdori/sql Bundle.properties
package.html
Log:
clean up code
Revision Changes Path
1.3 +47 -136 jakarta-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreManager.java
Index: OjbStoreManager.java
===================================================================
RCS file: /home/cvs/jakarta-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OjbStoreManager.java 29 Nov 2002 17:40:14 -0000 1.2
+++ OjbStoreManager.java 1 Dec 2002 16:54:58 -0000 1.3
@@ -58,7 +58,6 @@
import java.util.Iterator;
import javax.jdo.Extent;
-import javax.jdo.JDODataStoreException;
import javax.jdo.JDOFatalInternalException;
import javax.jdo.JDOUserException;
import javax.jdo.spi.PersistenceCapable;
@@ -82,60 +81,46 @@
import com.sun.jdori.query.QueryResult;
import com.sun.jdori.query.QueryResultHelper;
-//
-// Note the exception handling herein; it is intentional: if we catch a
-// subclass of JDOException, rethrow it as it is "expected" by calling code,
-// but if it is not, then create a subclass of JDOException (as are all
-// FOStore exceptions) and throw that. In other words, the intent is that
-// only JDOException subclasses be thrown by this class.
-//
/**
-* StoreManager represents the datastore to the rest of the JDO components.
-* It provides the means to write and read instances, to get the extent of
-* classes, and to get the object id for a persistence capable object.
-*
-* @author Thomas Mahler
-*/
+ * StoreManager represents the datastore to the rest of the JDO components.
+ * It provides the means to write and read instances, to get the extent of
+ * classes, and to get the object id for a persistence capable object.
+ *
+ * @author Thomas Mahler
+ */
class OjbStoreManager implements StoreManager
{
private final OjbStorePMF pmf;
private final OjbStoreConnector connector;
- /** Indicates whether current transaction is optimistic or not. See
- * {@link flush}. */
private boolean optimistic;
/** the logger used for debugging*/
private Logger logger = LoggerFactory.getLogger("JDO");
-
-
OjbStoreManager(OjbStorePMF pmf)
{
this.pmf = pmf;
this.connector = new OjbStoreConnector(pmf);
}
- //
- // Implementcom.sun.jdori.StoreManager
- //
/**
- * @see com.sun.jdori.StoreManager#getConnector
- */
+ * @see com.sun.jdori.StoreManager#getConnector
+ */
public Connector getConnector()
{
return connector;
}
/**
- * @see com.sun.jdori.StoreManager#getConnector(String userid,
- * String password)
- */
+ * @see com.sun.jdori.StoreManager#getConnector(String userid,
+ * String password)
+ */
public Connector getConnector(String userid, String password)
{
- throw new JDOUserException("Not yet implemented"); // NOI18N
+ throw new JDOUserException("Not implemented");
}
/**
@@ -156,9 +141,9 @@
}
catch (Exception ex)
{
- throw new OjbStoreFatalInternalException(getClass(), "insert", ex); // NOI18N
+ throw new OjbStoreFatalInternalException(getClass(), "insert", ex);
}
- dirtyFields.xor(dirtyFields); // Clear all bits.
+ dirtyFields.xor(dirtyFields);
return StateManagerInternal.FLUSHED_COMPLETE;
}
@@ -181,9 +166,9 @@
}
catch (Exception ex)
{
- throw new OjbStoreFatalInternalException(getClass(), "update", ex); // NOI18N
+ throw new OjbStoreFatalInternalException(getClass(), "update", ex);
}
- dirtyFields.xor(dirtyFields); // Clear all bits.
+ dirtyFields.xor(dirtyFields);
return StateManagerInternal.FLUSHED_COMPLETE;
}
@@ -195,13 +180,7 @@
BitSet fieldsToVerify,
StateManagerInternal sm)
{
-
- if (!verify(sm, true, fieldsToVerify))
- {
- throw new JDODataStoreException(
- "Could not verify fields " + sm.toString() + ", " + fieldsToVerify.toString());
- }
- fieldsToVerify.xor(fieldsToVerify); // Clear all bits.
+ fieldsToVerify.xor(fieldsToVerify);
return StateManagerInternal.FLUSHED_COMPLETE;
}
@@ -223,7 +202,7 @@
}
catch (Exception ex)
{
- throw new OjbStoreFatalInternalException(getClass(), "delete", ex); // NOI18N
+ throw new OjbStoreFatalInternalException(getClass(), "delete", ex);
}
dirtyFields.xor(dirtyFields);
return StateManagerInternal.FLUSHED_COMPLETE;
@@ -260,7 +239,7 @@
catch (Exception ex)
{
- throw new OjbStoreFatalInternalException(getClass(), "fetch", ex); // NOI18N
+ throw new OjbStoreFatalInternalException(getClass(), "fetch", ex);
}
}
@@ -275,14 +254,14 @@
}
catch (JDOModelException ex)
{
- throw new JDOFatalInternalException("Not a JDO class: " + c.getName()); // NOI18N
+ throw new JDOFatalInternalException("Not a JDO class: " + c.getName());
}
return rc;
}
/**
- * @see com.sun.jdori.StoreManager#getExtent
- */
+ * @see com.sun.jdori.StoreManager#getExtent
+ */
public synchronized Extent getExtent(
Class pcClass,
boolean subclasses,
@@ -293,11 +272,8 @@
}
/**
- * Creates a new object id for the given sm. Delegates implementation to
- * #createInternalObjectId(StateManagerInternal sm,Class cls,
- * PersistenceManagerInternal pm)
- * @see com.sun.jdori.StoreManager#createObjectId
- */
+ * @see com.sun.jdori.StoreManager#createObjectId
+ */
public synchronized Object createObjectId(
StateManagerInternal sm,
PersistenceManagerInternal pm)
@@ -308,13 +284,8 @@
}
/**
- * Creates a new object id for the given class. Binds metadata for the sm
- * (i.e., ensures that there is a CLID for instances of the sm's object's
- * class). Creates a request in the message that will provide a datastore
- * oid for the provisional oid which is returned, but does not interact
- * with the store.
- * @see com.sun.jdori.StoreManager#createObjectId
- */
+ * @see com.sun.jdori.StoreManager#createObjectId
+ */
public synchronized Object createInternalObjectId(
StateManagerInternal sm,
PersistenceCapable pc,
@@ -326,32 +297,25 @@
}
/**
- * Provides a datastore object id.
- * If objectId is not provisional, return it. Otherwise, see if we have a
- * corresponding datastore objectId and return that if so. If neither of
- * those works out, flush the current message which (we hope) will have a
- * corresponding CreateObjectIdRequest in it. Then look as before for a
- * corresponding datastore objectId in our mapping and return that. If we
- * still don't have a correspondance, throw an exception.
- * @see com.sun.jdori.StoreManager#getExternalObjectId(Object oid,
- * PersistenceCapable pc)
- */
+ * @see com.sun.jdori.StoreManager#getExternalObjectId(Object oid,
+ * PersistenceCapable pc)
+ */
public synchronized Object getExternalObjectId(Object objectId, PersistenceCapable pc)
{
return new Identity(pc);
}
/**
- * @see com.sun.jdori.StoreManager#copyKeyFieldsFromObjectId
- */
+ * @see com.sun.jdori.StoreManager#copyKeyFieldsFromObjectId
+ */
public void copyKeyFieldsFromObjectId(StateManagerInternal sm, Class pcClass)
{
new Identity(sm.getObject());
}
/**
- * @see com.sun.jdori.StoreManager#hasActualPCClass
- */
+ * @see com.sun.jdori.StoreManager#hasActualPCClass
+ */
public boolean hasActualPCClass(Object objectId)
{
boolean rc = true;
@@ -359,28 +323,23 @@
}
/**
- * @see com.sun.jdori.StoreManager#getInternalObjectId
- */
+ * @see com.sun.jdori.StoreManager#getInternalObjectId
+ */
public synchronized Object getInternalObjectId(Object objectId, PersistenceManagerInternal pm)
{
return objectId;
}
/**
- * @see com.sun.jdori.StoreManager#getPCClassForOid
- */
+ * @see com.sun.jdori.StoreManager#getPCClassForOid
+ */
public synchronized Class getPCClassForOid(Object objectId, PersistenceManagerInternal pm)
{
return ((Identity) objectId).getObjectsClass();
}
- /**
- * This method returns an object id instance corresponding to the Class
- * and String arguments. The String argument might have been the
- * result of executing toString on an object id instance.
- * @param pcClass the Class of the persistence-capable instance
- * @param str the String form of the object id
- * @return an instance of the object identity class
+ /**
+ * @see com.sun.jdori.StoreManager#newObjectIdInstance
*/
public Object newObjectIdInstance(Class pcClass, String str)
{
@@ -388,17 +347,11 @@
}
/**
- * Flushes all StateManagerInternals in the iterator. This will in turn
- * cause invocations of insert, delete, and update on this
- * FOStoreStoreManager. Update, in particular, must be done after this
- * flush method is invoked, so that the value of <code>optimistic</code> is
- * set correctly.
- * @see com.sun.jdori.StoreManager#flush
- */
+ * @see com.sun.jdori.StoreManager#flush
+ */
public void flush(Iterator it, PersistenceManagerInternal pm)
{
this.optimistic = pm.currentTransaction().getOptimistic();
-
boolean err = false;
while (it.hasNext())
@@ -419,7 +372,7 @@
if (err)
{
- throw new JDOFatalInternalException("UnableToFlushAll");
+ throw new JDOFatalInternalException("Error in flush");
}
}
@@ -446,54 +399,12 @@
}
}
-
-
/**
- * Returns a QueryResult instance which is then returned as the result of
- * Query.execute(...). This method allows support for datastore specific
- * query execution strategies, since each StoreManager can have its own
- * implementation of the QueryResult interface.
- * For now fostore uses the non optimized BasicQueryResult as QueryResult
- * implemenatation.
- * @param qrh the helper providing the query tree, the candidates
- * and the actual parameters.
- * @return a datastore specific query result instance
- */
- public QueryResult newQueryResult(QueryResultHelper qrh)
- {
- return new BasicQueryResult(qrh);
- }
-
- //
- // Used within FOStore
- //
-
- //
- // Implementation detail
- //
-
- /**
- * Verifies existence or values of a state manager's object in the
- * database.
- * @param sm The state manager whose object is to be verified.
- * @param verifyFields If true, verify values of object, otherwise verify
- * only existence (and ignore remaining parameters).
- * @param nonNullIdentifyingFieldNums Field numbers of the fields in the
- * concurrency groups fetched in this transaction plus PK fields whose
- * value is not null.
- * @param nullIdentifyingFieldNums Field number of fields in the
- * concurrency group fetched in this transaction plus PK fields whose
- * value is null.
- * @return true if verify was successful (either by existence of value
- * matching as per verifyFields).
- */
- private boolean verify(StateManagerInternal sm, boolean verifyFields, BitSet fieldsToVerify)
- {
- logger.debug("OjbStoreManager.verify");
- boolean rc = false;
- // thma: implement here!
- return rc;
+ * @see com.sun.jdori.StoreManager#newObjectIdInstance
+ */
+ public QueryResult newQueryResult(QueryResultHelper queryResultHelper)
+ {
+ return new BasicQueryResult(queryResultHelper);
}
-
}
1.3 +31 -56 jakarta-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreConnector.java
Index: OjbStoreConnector.java
===================================================================
RCS file: /home/cvs/jakarta-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreConnector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OjbStoreConnector.java 29 Nov 2002 17:40:14 -0000 1.2
+++ OjbStoreConnector.java 1 Dec 2002 16:54:58 -0000 1.3
@@ -69,26 +69,29 @@
*/
class OjbStoreConnector implements Connector
{
- /** @see com.sun.jdori.Connector#setRollbackOnly */
- private boolean rollbackOnly = false;
+ /**
+ * rollback only flag
+ */
+ private boolean rollbackOnlyFlag = false;
/**
- * Datasource to which this Connector writes its Message.
- */
+ * Datasource to which this Connector writes its Message.
+ */
private final OjbStorePMF pmf;
/**
- * Connection for interacting with store.
- */
+ * broker represents the backend store.
+ */
PersistenceBroker broker = null;
/**
- * True if we can release this connection after flushing. By default we
- * can; affected by transactions beginning and ending and their types.
- */
- private boolean okToReleaseConnection = true;
+ * if true underlying connection can be released
+ */
+ private boolean connectionReadyForRelease = true;
- /** the logger used for debugging*/
+ /**
+ * the logger used for debugging
+ */
private Logger logger = LoggerFactory.getLogger("JDO");
OjbStoreConnector(OjbStorePMF pmf)
@@ -96,9 +99,6 @@
this.pmf = pmf;
}
- //
- // Implement Connector
- //
/**
* @see com.sun.jdori.Connector#begin
@@ -107,18 +107,12 @@
{
assertNotRollbackOnly();
- // If transaction is optimistic, then we can release the connection as
- // soon as data is flushed. If it's datastore, then we can't release
- // the connection until after commit/rollback.
- //this.okToReleaseConnection = optimistic;
-
- this.okToReleaseConnection = false;
- logger.debug("OjbStoreConnector.begin: okToReleaseConnection=" + okToReleaseConnection);
+ connectionReadyForRelease = false;
+ logger.debug("OjbStoreConnector.begin: connectionReadyForRelease=" + connectionReadyForRelease);
// obtain a fresh broker and open a tx on it
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
broker.beginTransaction();
-
}
/**
@@ -127,65 +121,51 @@
public void beforeCompletion()
{
assertNotRollbackOnly();
-
// Nothing to do.
}
/**
- * Get a connection, process the message by using that connection to
- * interact with the database, read back the reply, release the
- connection.
* @see com.sun.jdori.Connector#flush
*/
public void flush()
{
assertNotRollbackOnly();
-
- logger.debug("OjbStoreConnector.flush: " + // NOI18N
- "okToReleaseConnection=" + okToReleaseConnection);
+ logger.debug("OjbStoreConnector.flush: " + "connectionReadyForRelease=" + connectionReadyForRelease);
// thma: noop?
}
/**
- * Add a CommitRequest to the connector's message, and send it to the
- * store. Then close the connection.
- * @see com.sun.jdori.Connector#commit
- */
+ * @see com.sun.jdori.Connector#commit
+ */
public synchronized void commit()
{
assertNotRollbackOnly();
try
{
- logger.debug("OjbStoreConnector.commit"); // NOI18N
+ logger.debug("OjbStoreConnector.commit");
broker.commitTransaction();
broker.close();
broker = null;
}
catch (Exception ex)
{
- throw new OjbStoreFatalInternalException(getClass(), "commit", ex); // NOI18N
+ throw new OjbStoreFatalInternalException(getClass(), "commit", ex);
}
finally
{
- // Now that we've commited, we can release the connection.
- okToReleaseConnection = true;
- flush();
+ connectionReadyForRelease = true;
}
}
/**
- * If rollbackOnly is set, then the store has already done a
- * rollback, so we don't do one now (but neither do we throw an
- * exception, as do other methds).
* @see com.sun.jdori.Connector#rollback
- * @see com.sun.jdori.fostore.ReplyHandler#processReplies
*/
public synchronized void rollback()
{
- logger.debug("OjbStoreConnector.rollback, RBO=" + rollbackOnly); // NOI18N
+ logger.debug("OjbStoreConnector.rollback");
- if (!rollbackOnly)
+ if (!rollbackOnlyFlag)
{
try
{
@@ -195,13 +175,11 @@
}
catch (Exception ex)
{
- throw new OjbStoreFatalInternalException(getClass(), "rollback", ex); // NOI18N
+ throw new OjbStoreFatalInternalException(getClass(), "rollback", ex);
}
finally
{
- // Now that we've rolled back, we can release the connection.
- okToReleaseConnection = true;
- flush();
+ connectionReadyForRelease = true;
}
}
}
@@ -211,7 +189,7 @@
*/
public void setRollbackOnly()
{
- rollbackOnly = true;
+ rollbackOnlyFlag = true;
}
/**
@@ -219,20 +197,17 @@
*/
public boolean getRollbackOnly()
{
- return rollbackOnly;
+ return rollbackOnlyFlag;
}
- //
- // Implementation
- //
-
private void assertNotRollbackOnly()
{
- if (rollbackOnly)
+ if (rollbackOnlyFlag)
{
- throw new JDODataStoreException("Rollback Only !"); // NOI18N
+ throw new JDODataStoreException("Rollback Only !");
}
}
+
/**
* Returns the broker.
* @return PersistenceBroker
1.2 +16 -20 jakarta-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreFatalInternalException.java
Index: OjbStoreFatalInternalException.java
===================================================================
RCS file: /home/cvs/jakarta-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreFatalInternalException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- OjbStoreFatalInternalException.java 28 Nov 2002 07:24:01 -0000 1.1
+++ OjbStoreFatalInternalException.java 1 Dec 2002 16:54:58 -0000 1.2
@@ -56,43 +56,39 @@
import javax.jdo.JDOFatalInternalException;
/**
-* This is an exception which _should_ never be thrown, as it indicates an
-* error in the implementation, such as a bug that has been found.
+* This is exception indicates internal errors
*
* @author Thomas Mahler
*/
public class OjbStoreFatalInternalException extends JDOFatalInternalException
{
/**
- * @param className Name of the file in which the exception is thrown.
- * @param methodName Name of the method from which the exception is
- * thrown.
+ * @param className class in which the exception is thrown.
+ * @param methodName method throwing the exception.
*/
- OjbStoreFatalInternalException(Class clz, String methodName, String msg)
+ OjbStoreFatalInternalException(Class clazz, String methodName, String msg)
{
- super(clz.getName() + "." + methodName + ": " + msg); // NOI18N
+ super(clazz.getName() + "." + methodName + ": " + msg);
}
/**
- * @param className Name of the file in which the exception is thrown.
- * @param methodName Name of the method from which the exception is
- * thrown.
+ * @param className class in which the exception is thrown.
+ * @param methodName method throwing the exception.
+ * @param nested nested Exception
*/
- OjbStoreFatalInternalException(Class clz, String methodName, Exception nested)
+ OjbStoreFatalInternalException(Class clazz, String methodName, Exception nested)
{
- super(clz.getName() + "." + methodName, // NOI18N
- new Exception[] { nested }); // NOI18N
+ super(clazz.getName() + "." + methodName, new Exception[] { nested });
}
/**
- * @param className Name of the file in which the exception is thrown.
- * @param methodName Name of the method from which the exception is
- * thrown.
+ * @param className class in which the exception is thrown.
+ * @param methodName method throwing the exception.
+ * @param msg the error message
+ * @param nested nested Exception
*/
- OjbStoreFatalInternalException(Class clz, String methodName, String msg, Exception nested)
+ OjbStoreFatalInternalException(Class clazz, String methodName, String msg, Exception nested)
{
-
- super(clz.getName() + "." + methodName + ": " + msg, // NOI18N
- new Exception[] { nested }); // NOI18N
+ super(clazz.getName() + "." + methodName + ": " + msg, new Exception[] { nested });
}
}
1.2 +171 -595 jakarta-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStorePMF.java
Index: OjbStorePMF.java
===================================================================
RCS file: /home/cvs/jakarta-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStorePMF.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- OjbStorePMF.java 28 Nov 2002 07:24:01 -0000 1.1
+++ OjbStorePMF.java 1 Dec 2002 16:54:58 -0000 1.2
@@ -53,335 +53,151 @@
* <http://www.apache.org/>.
*/
-import java.io.ByteArrayOutputStream;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.util.Enumeration;
+
import java.util.HashMap;
import java.util.Properties;
import javax.jdo.JDOException;
import javax.jdo.PersistenceManager;
import javax.jdo.spi.PersistenceCapable;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.naming.Referenceable;
-import javax.naming.StringRefAddr;
import org.apache.ojb.broker.Identity;
-import org.apache.ojb.broker.PersistenceBrokerFactory;
-import org.apache.ojb.broker.util.logging.Logger;
-import org.apache.ojb.broker.util.logging.LoggerFactory;
import com.sun.jdori.StoreManager;
import com.sun.jdori.TranscriberFactory;
import com.sun.jdori.common.PersistenceManagerFactoryImpl;
import com.sun.jdori.common.PersistenceManagerImpl;
-//
-// Note the exception handling herein; it is intentional: if we catch a
-// subclass of JDOException, rethrow it as it is "expected" by calling code,
-// but if it is not, then create a subclass of JDOException (as are all
-// FOStore exceptions) and throw that. In other words, the intent is that
-// only JDOException subclasses be thrown by this class.
-//
-
/**
-* The File/Object Store's implementation of a PersistenceManagerFactory.
-* <p>
-* This class is <code>public</code> so that clients can create instances of it
-* with <code>new</code>.
-*
-* @author Thomas Mahler
-*/
-public class OjbStorePMF
- extends PersistenceManagerFactoryImpl
- implements Externalizable, Referenceable
+ * PMF for OjbStore implementation
+ * @author thma
+ *
+ */
+public class OjbStorePMF extends PersistenceManagerFactoryImpl
{
- /**
- * StoreManagers provided by this PMF, one per-PM.
- */
private final HashMap storeManagers = new HashMap();
- /**
- * Map provisional id's that were created on behalf of this PMF to the
- * real id's that have been returned by various StoreManager instances
- * that are bound to this PMF.
- */
- private final HashMap provisionalOIDs = new HashMap();
-
- /** Flag to tell whether to create. This is not a JDO property.
- */
- private boolean create;
-
- /** JNDI property type
- */
- static final String addrType = "Serialized-com.sun.jdori.fostore.OjbStorePMF"; // NOI18N
-
- /** Supported list of options for this implementation.
- */
- private final String[] optionArray =
- new String[] { "javax.jdo.option.TransientTransactional", // NOI18N
- "javax.jdo.option.NontransactionalRead", // NOI18N
- "javax.jdo.option.NontransactionalWrite", // NOI18N
- "javax.jdo.option.RetainValues", // NOI18N
- "javax.jdo.option.RestoreValues", // NOI18N
- "javax.jdo.option.Optimistic", // NOI18N
- "javax.jdo.option.ApplicationIdentity", // NOI18N
- "javax.jdo.option.DatastoreIdentity", // NOI18N
- // "javax.jdo.option.NonDatastoreIdentity", // NOI18N
- "javax.jdo.option.ArrayList", // NOI18N
- "javax.jdo.option.HashMap", // NOI18N
- "javax.jdo.option.Hashtable", // NOI18N
- "javax.jdo.option.LinkedList", // NOI18N
- "javax.jdo.option.TreeMap", // NOI18N
- "javax.jdo.option.TreeSet", // NOI18N
- "javax.jdo.option.Vector", // NOI18N
- // "javax.jdo.option.Map", // NOI18N
- // "javax.jdo.option.List", // NOI18N
- "javax.jdo.option.Array", // NOI18N
- "javax.jdo.option.NullCollection", // NOI18N
- "javax.jdo.query.JDOQL" // NOI18N
- };
-
- /** the logger used for debugging*/
- private Logger logger = LoggerFactory.getLogger("JDO");
-
- /** Properties accessors hash map for fostore-specific properties.
- */
- protected static HashMap fostorePropsAccessors = new HashMap(3);
-
- /**
- * Mapping of supported java.util classes to the tracked
- * SCO classes in com.sun.jdori.common.sco package
- */
- private static HashMap trackedClasses = new HashMap();
-
- /** Initialize fostorePropsAccessors.
- */
- // XXX Jikes bug
- // If this is protected, OjbStorePMF.initPropsAccessors cannot invoke it,
- // due to a bug in jikes (http://www-124.ibm.com/developerworks/bugs/?func=detailbug&bug_id=213&group_id=10)
- //protected static void initPropsAccessors() {
- //
- public static void initPropsAccessors()
- {
- PersistenceManagerFactoryImpl.initPropsAccessors();
- if (fostorePropsAccessors.size() != 0)
- return;
- synchronized (fostorePropsAccessors)
- {
- if (fostorePropsAccessors.size() != 0)
- {
- return;
- }
- fostorePropsAccessors.put("com.sun.jdori.option.ConnectionCreate", // NOI18N
- new PMFAccessor()
- {
- public String get(PersistenceManagerFactoryImpl pmf)
- {
- return new Boolean(((OjbStorePMF) pmf).getConnectionCreate()).toString();
- }
- public String getNonDefault(PersistenceManagerFactoryImpl pmf)
- {
- return (!((OjbStorePMF) pmf).getConnectionCreate()) ? null : "true";
- } // NOI18N
- public String getDefault()
- {
- return "false";
- } // NOI18N
- public void set(PersistenceManagerFactoryImpl pmf, String s)
- {
- ((OjbStorePMF) pmf).setConnectionCreate(Boolean.valueOf(s).booleanValue());
- }
- });
- fostorePropsAccessors.put("com.sun.jdori.option.QueryTimeout", // NOI18N
- new PMFAccessor()
- {
- public String get(PersistenceManagerFactoryImpl pmf)
- {
- return Integer.toString(pmf.getQueryTimeout());
- }
- public String getNonDefault(PersistenceManagerFactoryImpl pmf)
- {
- return (pmf.getQueryTimeout() == 0)
- ? null
- : Integer.toString(pmf.getQueryTimeout());
- }
- public String getDefault()
- {
- return "0";
- } // NOI18N
- public void set(PersistenceManagerFactoryImpl pmf, String s)
- {
- pmf.setQueryTimeout(toInt(s));
- }
- });
- fostorePropsAccessors.put("com.sun.jdori.option.UpdateTimeout", // NOI18N
- new PMFAccessor()
- {
- public String get(PersistenceManagerFactoryImpl pmf)
- {
- return Integer.toString(pmf.getUpdateTimeout());
- }
- public String getNonDefault(PersistenceManagerFactoryImpl pmf)
- {
- return (pmf.getUpdateTimeout() == 0)
- ? null
- : Integer.toString(pmf.getUpdateTimeout());
- }
- public String getDefault()
- {
- return "0";
- } // NOI18N
- public void set(PersistenceManagerFactoryImpl pmf, String s)
- {
- pmf.setUpdateTimeout(toInt(s));
- }
- });
- }
- }
+ private static HashMap trackedClassesMap = getTrackedClasses();
- /** Return the FOStore-specific accessors (the
- * properties that are not in the JDO specification).
- * @return the hash map of FOStore accessors
+ /**
+ * Constructor for PMF.
*/
- protected HashMap getLocalAccessors()
+ public OjbStorePMF()
{
- initPropsAccessors();
- return fostorePropsAccessors;
+ super();
}
- /** Initialize trackedClasses.
- */
- private void initTrackedClasses()
- {
- if (trackedClasses.size() != 0)
- {
- return;
- }
- synchronized (trackedClasses)
- {
- if (trackedClasses.size() != 0)
- {
- return;
- }
+ /**
+ * Constructor for PMF.
+ * @param URL
+ * @param userName
+ * @param password
+ * @param driverName
+ */
+ public OjbStorePMF(String URL, String userName, String password, String driverName)
+ {
+ super(URL, userName, password, driverName);
+ }
+
+ private static HashMap getTrackedClasses()
+ {
+ HashMap classMap = new HashMap();
+ // java.util.Date and java.sql classes:
+ classMap.put(java.util.Date.class, com.sun.jdori.common.sco.Date.class);
+ classMap.put(com.sun.jdori.common.sco.Date.class, com.sun.jdori.common.sco.Date.class);
+ classMap.put(java.sql.Date.class, com.sun.jdori.common.sco.SqlDate.class);
+ classMap.put(
+ com.sun.jdori.common.sco.SqlDate.class,
+ com.sun.jdori.common.sco.SqlDate.class);
+ classMap.put(java.sql.Time.class, com.sun.jdori.common.sco.SqlTime.class);
+ classMap.put(
+ com.sun.jdori.common.sco.SqlTime.class,
+ com.sun.jdori.common.sco.SqlTime.class);
+ classMap.put(java.sql.Timestamp.class, com.sun.jdori.common.sco.SqlTimestamp.class);
+ classMap.put(
+ com.sun.jdori.common.sco.SqlTimestamp.class,
+ com.sun.jdori.common.sco.SqlTimestamp.class);
+
+ // java.util.Set
+ classMap.put(java.util.HashSet.class, com.sun.jdori.common.sco.HashSet.class);
+ classMap.put(java.util.AbstractSet.class, com.sun.jdori.common.sco.HashSet.class);
+ classMap.put(java.util.Set.class, com.sun.jdori.common.sco.HashSet.class);
+ classMap.put(
+ com.sun.jdori.common.sco.HashSet.class,
+ com.sun.jdori.common.sco.HashSet.class);
+
+ // java.util.List
+ classMap.put(java.util.ArrayList.class, com.sun.jdori.common.sco.ArrayList.class);
+ classMap.put(java.util.AbstractList.class, com.sun.jdori.common.sco.ArrayList.class);
+ classMap.put(java.util.List.class, com.sun.jdori.common.sco.ArrayList.class);
+ classMap.put(java.util.AbstractCollection.class, com.sun.jdori.common.sco.ArrayList.class);
+ classMap.put(java.util.Collection.class, com.sun.jdori.common.sco.ArrayList.class);
+ classMap.put(
+ com.sun.jdori.common.sco.ArrayList.class,
+ com.sun.jdori.common.sco.ArrayList.class);
+
+ // java.util.Vector
+ classMap.put(java.util.Vector.class, com.sun.jdori.common.sco.Vector.class);
+ classMap.put(com.sun.jdori.common.sco.Vector.class, com.sun.jdori.common.sco.Vector.class);
+
+ // java.util.SortedSet
+ classMap.put(java.util.TreeSet.class, com.sun.jdori.common.sco.TreeSet.class);
+ classMap.put(java.util.SortedSet.class, com.sun.jdori.common.sco.TreeSet.class);
+ classMap.put(
+ com.sun.jdori.common.sco.TreeSet.class,
+ com.sun.jdori.common.sco.TreeSet.class);
+
+ // java.util.LinkedList
+ classMap.put(java.util.LinkedList.class, com.sun.jdori.common.sco.LinkedList.class);
+ classMap.put(
+ java.util.AbstractSequentialList.class,
+ com.sun.jdori.common.sco.LinkedList.class);
+ classMap.put(
+ com.sun.jdori.common.sco.LinkedList.class,
+ com.sun.jdori.common.sco.LinkedList.class);
+
+ // java.util.Map
+ classMap.put(java.util.Map.class, com.sun.jdori.common.sco.HashMap.class);
+ classMap.put(java.util.AbstractMap.class, com.sun.jdori.common.sco.HashMap.class);
+ classMap.put(java.util.HashMap.class, com.sun.jdori.common.sco.HashMap.class);
+ classMap.put(
+ com.sun.jdori.common.sco.HashMap.class,
+ com.sun.jdori.common.sco.HashMap.class);
+
+ // java.util.Hashtable
+ classMap.put(java.util.Hashtable.class, com.sun.jdori.common.sco.Hashtable.class);
+ classMap.put(
+ com.sun.jdori.common.sco.Hashtable.class,
+ com.sun.jdori.common.sco.Hashtable.class);
+
+ // java.util.SortedMap
+ classMap.put(java.util.SortedMap.class, com.sun.jdori.common.sco.TreeMap.class);
+ classMap.put(java.util.TreeMap.class, com.sun.jdori.common.sco.TreeMap.class);
+ classMap.put(
+ com.sun.jdori.common.sco.TreeMap.class,
+ com.sun.jdori.common.sco.TreeMap.class);
- // We will need to compare equals to ensure that we do not override
- // user's defined classes:
+ return classMap;
+ }
- // java.util.Date and java.sql classes:
- trackedClasses.put(java.util.Date.class, com.sun.jdori.common.sco.Date.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.Date.class,
- com.sun.jdori.common.sco.Date.class);
- trackedClasses.put(java.sql.Date.class, com.sun.jdori.common.sco.SqlDate.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.SqlDate.class,
- com.sun.jdori.common.sco.SqlDate.class);
- trackedClasses.put(java.sql.Time.class, com.sun.jdori.common.sco.SqlTime.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.SqlTime.class,
- com.sun.jdori.common.sco.SqlTime.class);
- trackedClasses.put(
- java.sql.Timestamp.class,
- com.sun.jdori.common.sco.SqlTimestamp.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.SqlTimestamp.class,
- com.sun.jdori.common.sco.SqlTimestamp.class);
-
- // java.util.Set
- trackedClasses.put(java.util.HashSet.class, com.sun.jdori.common.sco.HashSet.class);
- trackedClasses.put(java.util.AbstractSet.class, com.sun.jdori.common.sco.HashSet.class);
- trackedClasses.put(java.util.Set.class, com.sun.jdori.common.sco.HashSet.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.HashSet.class,
- com.sun.jdori.common.sco.HashSet.class);
-
- // java.util.List
- trackedClasses.put(java.util.ArrayList.class, com.sun.jdori.common.sco.ArrayList.class);
- trackedClasses.put(
- java.util.AbstractList.class,
- com.sun.jdori.common.sco.ArrayList.class);
- trackedClasses.put(java.util.List.class, com.sun.jdori.common.sco.ArrayList.class);
- trackedClasses.put(
- java.util.AbstractCollection.class,
- com.sun.jdori.common.sco.ArrayList.class);
- trackedClasses.put(
- java.util.Collection.class,
- com.sun.jdori.common.sco.ArrayList.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.ArrayList.class,
- com.sun.jdori.common.sco.ArrayList.class);
-
- // java.util.Vector
- trackedClasses.put(java.util.Vector.class, com.sun.jdori.common.sco.Vector.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.Vector.class,
- com.sun.jdori.common.sco.Vector.class);
-
- // java.util.SortedSet
- trackedClasses.put(java.util.TreeSet.class, com.sun.jdori.common.sco.TreeSet.class);
- trackedClasses.put(java.util.SortedSet.class, com.sun.jdori.common.sco.TreeSet.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.TreeSet.class,
- com.sun.jdori.common.sco.TreeSet.class);
-
- // java.util.LinkedList
- trackedClasses.put(
- java.util.LinkedList.class,
- com.sun.jdori.common.sco.LinkedList.class);
- trackedClasses.put(
- java.util.AbstractSequentialList.class,
- com.sun.jdori.common.sco.LinkedList.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.LinkedList.class,
- com.sun.jdori.common.sco.LinkedList.class);
-
- // java.util.Map
- trackedClasses.put(java.util.Map.class, com.sun.jdori.common.sco.HashMap.class);
- trackedClasses.put(java.util.AbstractMap.class, com.sun.jdori.common.sco.HashMap.class);
- trackedClasses.put(java.util.HashMap.class, com.sun.jdori.common.sco.HashMap.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.HashMap.class,
- com.sun.jdori.common.sco.HashMap.class);
-
- // java.util.Hashtable
- trackedClasses.put(java.util.Hashtable.class, com.sun.jdori.common.sco.Hashtable.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.Hashtable.class,
- com.sun.jdori.common.sco.Hashtable.class);
-
- // java.util.SortedMap
- trackedClasses.put(java.util.SortedMap.class, com.sun.jdori.common.sco.TreeMap.class);
- trackedClasses.put(java.util.TreeMap.class, com.sun.jdori.common.sco.TreeMap.class);
- trackedClasses.put(
- com.sun.jdori.common.sco.TreeMap.class,
- com.sun.jdori.common.sco.TreeMap.class);
- }
+ /**
+ * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#getOptionArray()
+ */
+ protected String[] getOptionArray()
+ {
+ return null;
}
- //
- // Methods from PersistenceManagerFactory that are not already
- // implemented in com.sun.jdori.common.PersistenceManagerFactoryImpl.
- //
-
- /** Create a new instance of PersistenceManager with
- * the specific user name and password.
- * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#createPersistenceManager(String userid, String password)
- * @param userid the user name
- * @param password the password
- * @return the Persistencemanager
+ /**
+ * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#createPersistenceManager(String, String)
*/
protected PersistenceManager createPersistenceManager(String userid, String password)
{
- PersistenceManager rc = null;
+ PersistenceManager result = null;
try
{
- rc = new PersistenceManagerImpl(this, userid, password);
- setConfigured();
+ result = new PersistenceManagerImpl(this, userid, password);
}
catch (JDOException ex)
{
@@ -393,368 +209,128 @@
getClass(),
"createPersistenceManager(userid, password)",
ex);
- // NOI18N
- }
- return rc;
- }
-
- /**
- * Closes the database unless there are any active store managers.
- * @param force If true, forces the database to close anyway, regardless of
- * whether or not any store managers are still active.
- * @return true if the database was closed, false if not (i.e., force is
- * false and there are active store managers).
- * @see javax.jdo.PersistenceManagerFactory#getPersistenceManager
- */
- public boolean close(boolean force)
- {
- boolean rc = false;
-
- try
- {
- if (storeManagers.isEmpty() || force)
- {
- logger.debug("OjbPMF closing database");
- PersistenceBrokerFactory.defaultPersistenceBroker().close();
- rc = true;
- }
- }
- catch (JDOException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new OjbStoreFatalInternalException(getClass(), "close", ex); // NOI18N
}
- return rc;
+ return result;
}
- //
- // Methods from PersistenceManagerFactoryInternal
- //
-
/**
- * @see com.sun.jdori.PersistenceManagerFactoryInternal#getTranscriberFactory()
- * @return The PersistenceManagerFactory's transcriber factory.
+ * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#setPMFClassProperty(Properties)
*/
- public TranscriberFactory getTranscriberFactory()
- {
- return null; //FOStoreTranscriberFactory.getInstance();
- }
-
- /**
- * If parameter is non-null and implements PersistenceCapable, returns
- * OID.class.
- * @see com.sun.jdori.PersistenceManagerFactoryInternal#getObjectIdClass(
- * Class cls)
- */
- public Class getObjectIdClass(Class cls)
- {
- Class rc = null;
- if (null != cls && PersistenceCapable.class.isAssignableFrom(cls))
- {
- rc = Identity.class;
- }
- return rc;
- }
-
- /**
- * @see com.sun.jdori.PersistenceManagerFactoryInternal#getStoreManager(
- * PersistenceManager pm)
- */
- public StoreManager getStoreManager(PersistenceManager pm)
- {
- OjbStoreManager rc = null;
- try
- {
- rc = (OjbStoreManager) storeManagers.get(pm);
- if (null == rc)
- {
- rc = new OjbStoreManager(this);
- storeManagers.put(pm, rc);
- }
- }
- catch (JDOException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new OjbStoreFatalInternalException(getClass(), "getStoreManager", ex); // NOI18N
- }
- return rc;
- }
-
- /**
- * @see com.sun.jdori.PersistenceManagerFactoryInternal#releaseStoreManager(
- * PersistenceManager pm)
- */
- public void releaseStoreManager(PersistenceManager pm)
- {
- try
- {
- storeManagers.remove(pm);
- }
- catch (JDOException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new OjbStoreFatalInternalException(getClass(), "releaseStoreManager", ex);
- // NOI18N
- }
- }
-
- /**
- * @see com.sun.jdori.PersistenceManagerFactoryInternal#getTrackedClass(
- * Class type)
- */
- public Class getTrackedClass(Class type)
- {
- initTrackedClasses();
- return (Class) trackedClasses.get(type);
- }
-
- //
- // Package-private methods
- //
-
- //
- // Implement Externalizable
- // Support for serialization. We don't have any state to save, but want
- // all the superclass's state saved
- //
-
- /**
- * Writes this PMF's state to the given object output.
- * @param out ObjectOutput to which this PMF's state is written.
- */
- public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
+ protected void setPMFClassProperty(Properties props)
{
-
- super.doWriteObject((java.io.ObjectOutputStream) out);
+ props.setProperty("javax.jdo.PersistenceManagerFactoryClass", this.getClass().getName());
}
/**
- * Reads this PMF's state from the given object input.
- * @param in ObjectInput from which this PMF's state is read.
- */
- public void readExternal(java.io.ObjectInput in)
- throws java.io.IOException, ClassNotFoundException
- {
-
- super.doReadObject((java.io.ObjectInputStream) in);
- }
-
- /**
- * Uses rot13 algorithm.
- * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#encrypt
- */
+ * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#encrypt(String)
+ */
protected String encrypt(String s)
{
- return doEncrypt(s);
+ return s;
}
/**
- * Uses rot13 algorithm.
- * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#decrypt
- */
+ * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#decrypt(String)
+ */
protected String decrypt(String s)
{
- return doEncrypt(s);
+ return s;
}
/**
- * Use same encryption for others in this package (e.g. FOStoreConnectionFactory).
+ * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#setCFProperties(Properties)
*/
- static String doEncrypt(String s)
+ protected void setCFProperties(Properties p)
{
- return doDecrypt(s);
}
/**
- * Use same encryption for others in this package (e.g. FOStoreConnectionFactory).
+ * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#getCFFromProperties(Properties)
*/
- static String doDecrypt(String s)
- {
- String rc = null;
- if (null != s)
- {
- rc = rot13(s);
- }
- return rc;
- }
-
- // Standard Rot13 stuff. Translated to Java from a C implementation found
- // on the net.
- private static String rot13(String s)
- {
- String rc = null;
- int length = s.length();
- StringBuffer sb = new StringBuffer(length);
- for (int i = 0; i < length; i++)
- {
- int c = s.charAt(i);
- int cap = c & 32;
- c &= ~cap;
- c = ((c >= 'A') && (c <= 'Z') ? ((c - 'A' + 13) % 26 + 'A') : c) | cap;
- sb.append((char) c);
- }
- rc = sb.toString();
- LoggerFactory.getDefaultLogger().debug("encrypted " + s + " to be " + rc);
- return rc;
- }
-
- /**
- * @param create specifies whether to create the database */
- public void setConnectionCreate(boolean create)
- {
- this.create = create;
- }
-
- /**
- * @param create tells whether to create the database*/
- public void setConnectionCreate(String create)
+ protected void getCFFromProperties(Properties p)
{
- this.create = Boolean.valueOf(create).booleanValue();
}
/**
- * @return whether to create the database */
- public boolean getConnectionCreate()
+ * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#isConnectionFactoryConfigured()
+ */
+ protected boolean isConnectionFactoryConfigured()
{
- return create;
+ return true;
}
/**
- * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#setCFProperties
+ * @see com.sun.jdori.PersistenceManagerFactoryInternal#getTranscriberFactory()
*/
- protected void setCFProperties(Properties p)
+ public TranscriberFactory getTranscriberFactory()
{
- /*if (null != cf)
- {
- cf.setProperties(p);
- }*/
+ return null;
}
/**
- * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#getCFFromProperties
+ * @see com.sun.jdori.PersistenceManagerFactoryInternal#getObjectIdClass(Class)
*/
- protected void getCFFromProperties(Properties p)
+ public Class getObjectIdClass(Class cls)
{
- //cf = new FOStoreConnectionFactory();
- //cf.setFromProperties(p);
+ Class result = null;
+ if (null != cls && PersistenceCapable.class.isAssignableFrom(cls))
+ {
+ result = Identity.class;
+ }
+ return result;
}
- //
- // Implement Referenceable
- //
-
/**
- * Uses StringRefAddr's to store the information
+ * @see com.sun.jdori.PersistenceManagerFactoryInternal#getStoreManager(PersistenceManager)
*/
- public Reference getReference() throws NamingException
+ public StoreManager getStoreManager(PersistenceManager pm)
{
- Reference rc = null;
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
+ OjbStoreManager result = null;
try
{
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(this);
- rc = new Reference(OjbStorePMF.class.getName(), null, null);
- Properties p = getAsProperties();
- for (Enumeration e = p.propertyNames(); e.hasMoreElements();)
+ result = (OjbStoreManager) storeManagers.get(pm);
+ if (null == result)
{
- String key = (String) e.nextElement();
- String value = p.getProperty(key);
- rc.add(new StringRefAddr(key, value));
+ result = new OjbStoreManager(this);
+ storeManagers.put(pm, result);
}
}
- catch (IOException ex)
+ catch (JDOException ex)
{
- throw new OjbStoreFatalInternalException(getClass(), "getReference", ex); // NOI18N
+ throw ex;
}
- return rc;
- }
-
- /**
- * @return configuration information */
- public String toString()
- {
- return super.toString() +
- //thma "model: " + model + "\n" + // NOI18N
- "storeManagers: " + storeManagers + "\n" + // NOI18N
- "provisionalOIDs: " + provisionalOIDs + "\n"; // + // NOI18N
- //"cf: " + cf + "\n"; // NOI18N
- }
-
- /**
- * @see PersistenceManagerFactoryImpl#getOptionArray
- */
- protected String[] getOptionArray()
- {
- return optionArray;
- }
-
- /** A HashMap that associates PersistenceManagerFactory instances with a
- * Properties instance.
- */
- protected static HashMap hashMapByFilteredProperties = new HashMap();
-
- /**
- * Construct a Properties instance from the given Properties. Only
- * those property entries recognized by this implementation will be
- * stored in the internal Properties instance.
- *
- * <P>This method attempts to find an existing PersistenceManagerFactory
- * with the properties as specified in the parameter. Only the non-default
- * properties are considered when trying to find a match.
- *
- * <P>This method cannot be implemented by the superclass because
- */
- public static PersistenceManagerFactoryImpl getPersistenceManagerFactory(Properties props)
- {
- initPropsAccessors();
- //FOStoreConnectionFactory.initPropsAccessors();
- Properties filtered = new Properties();
- filterProperties(props, filtered, pmfAccessors);
- filterProperties(props, filtered, propsAccessors);
- filterProperties(props, filtered, fostorePropsAccessors);
- //filterProperties (props, filtered, FOStoreConnectionFactory.CFpropsAccessors);
- OjbStorePMF pmf = null;
- synchronized (hashMapByFilteredProperties)
+ catch (Exception ex)
{
- pmf = (OjbStorePMF) hashMapByFilteredProperties.get(filtered);
- if (pmf != null)
- return pmf;
- pmf = new OjbStorePMF();
- pmf.setFromProperties(filtered);
- pmf.verifyConfiguration();
- pmf.setConfigured();
- hashMapByFilteredProperties.put(filtered, pmf);
+ throw new OjbStoreFatalInternalException(getClass(), "getStoreManager", ex);
}
- return pmf;
+ return result;
}
- /** Set the PMF class property for this PMF.
+ /**
+ * @see com.sun.jdori.PersistenceManagerFactoryInternal#releaseStoreManager(PersistenceManager)
*/
- protected void setPMFClassProperty(Properties props)
+ public void releaseStoreManager(PersistenceManager pm)
{
- props.setProperty(
- "javax.jdo.PersistenceManagerFactoryClass",
- "org.apache.ojb.jdori.sql.OjbStorePMF");
- // NOI18N
+ try
+ {
+ storeManagers.remove(pm);
+ }
+ catch (JDOException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new OjbStoreFatalInternalException(getClass(), "releaseStoreManager", ex);
+ }
}
/**
- * @see com.sun.jdori.common.PersistenceManagerFactoryImpl#isConnectionFactoryConfigured()
+ * @see com.sun.jdori.PersistenceManagerFactoryInternal#getTrackedClass(Class)
*/
- protected boolean isConnectionFactoryConfigured()
+ public Class getTrackedClass(Class type)
{
- return true;
+ return (Class) trackedClassesMap.get(type);
}
}