You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2003/11/26 21:53:36 UTC
cvs commit: jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence TransactionStateException.java PersistencePlugin.java
weaver 2003/11/26 12:53:35
Modified: plugin/src/java/org/apache/jetspeed/persistence/impl
AbstractOJBPersistencePlugin.java
OJBODMGPersistencePlugin.java
OJBPBPersistencePlugin.java
plugin/src/java/org/apache/jetspeed/persistence
PersistencePlugin.java
Added: plugin/src/java/org/apache/jetspeed/persistence
TransactionStateException.java
Log:
Streamlined the persistence plugin to use thread based transactions as
opposed to exposing the transaction object.
Revision Changes Path
1.7 +0 -84 jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/AbstractOJBPersistencePlugin.java
Index: AbstractOJBPersistencePlugin.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/AbstractOJBPersistencePlugin.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractOJBPersistencePlugin.java 17 Oct 2003 00:38:03 -0000 1.6
+++ AbstractOJBPersistencePlugin.java 26 Nov 2003 20:53:35 -0000 1.7
@@ -106,42 +106,6 @@
private String overrideDefaultJcd;
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#abortTransaction(java.lang.Object)
- */
- public abstract void abortTransaction(Object transaction);
-
- /**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#add(java.lang.Object)
- */
- public void add(Object object)
- {
- Object tx = startTransaction();
- addObjectToTransaction(object, tx, LOCK_LEVEL_WRITE);
- commitTransaction(tx);
-
- }
-
- /**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#addObjectToTransaction(java.lang.Object, java.lang.Object)
- */
- public abstract void addObjectToTransaction(Object object, Object transaction, int lockLevel);
-
- /**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#commitTransaction(java.lang.Object)
- */
- public abstract void commitTransaction(Object transaction);
-
- /**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#delete(java.lang.Object)
- */
- public void delete(Object object)
- {
- Object tx = startTransaction();
- setObjectForDeletion(object, tx);
- commitTransaction(tx);
- }
-
- /**
* @return <code>true</code> if the <code>obj</code> is
* of type AbstractOJBPersistencePlugin and the name defined
* within the plugin configuration for <code>obj</code> is the
@@ -487,54 +451,6 @@
releaseBroker(pb);
}
- }
-
- /**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#setObjectForDeletion(java.lang.Object, java.lang.Object)
- */
- public abstract void setObjectForDeletion(Object object, Object transaction);
-
- /**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#startTransaction()
- */
- public abstract Object startTransaction();
-
- /**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#update(java.lang.Object)
- */
- public void update(Object object)
- {
- PersistenceBroker pb = null;
- try
- {
- pb = getBroker();
- // 1. remove object from the OJB cache
- pb.removeFromCache(object);
-
- // 2. Start the transaction
- Object tx = startTransaction();
-
- // 3. retreive a "stale" version of this object from the db
- Identity id = new Identity(object, pb);
- Object staleObject = pb.getObjectByIdentity(id);
- addObjectToTransaction(staleObject, tx, LOCK_LEVEL_WRITE);
-
- // 4. Map new values to the stale object
- BeanUtils.copyProperties(staleObject, object);
-
- // 5. Commit the transaction
- commitTransaction(tx);
- pb.removeFromCache(staleObject);
-
- }
- catch (Throwable e)
- {
- log.error("Unexpected exception thrown while updating object instance", e);
- }
- finally
- {
- releaseBroker(pb);
- }
}
public Collection getExtent(Class clazz)
1.4 +145 -140 jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/OJBODMGPersistencePlugin.java
Index: OJBODMGPersistencePlugin.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/OJBODMGPersistencePlugin.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- OJBODMGPersistencePlugin.java 17 Oct 2003 00:52:09 -0000 1.3
+++ OJBODMGPersistencePlugin.java 26 Nov 2003 20:53:35 -0000 1.4
@@ -56,12 +56,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fulcrum.InitializationException;
+import org.apache.jetspeed.persistence.*;
import org.apache.jetspeed.persistence.LookupCriteria;
import org.apache.jetspeed.persistence.ODMGPersistencePlugin;
import org.apache.jetspeed.persistence.PersistenceService;
import org.apache.jetspeed.services.plugin.PluginConfiguration;
-import org.apache.ojb.broker.Identity;
+
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.odmg.OJB;
import org.apache.ojb.odmg.TransactionImpl;
@@ -79,80 +80,160 @@
* @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
*/
public class OJBODMGPersistencePlugin extends AbstractOJBPersistencePlugin implements ODMGPersistencePlugin
-{
+{
- private static final Log log = LogFactory.getLog(OJBODMGPersistencePlugin.class);
+ private static final Log log = LogFactory.getLog(OJBODMGPersistencePlugin.class);
- private String overrideDefaultJcd;
- private PluginConfiguration configuration;
- private String persistenceApi;
- private Implementation odmg;
- private Database db;
- private PersistenceService ps;
+ private String overrideDefaultJcd;
+ private PluginConfiguration configuration;
+ private String persistenceApi;
+ private Implementation odmg;
+ private Database db;
+ private PersistenceService ps;
+
+ private ThreadLocal TLtx;
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#abortTransaction(java.lang.Object)
+ * @see com.rippe.essential.agora.services.entity.AgoraEntityService#beginTransaction()
*/
- public void abortTransaction(Object transaction)
+ public void beginTransaction() throws TransactionStateException
{
- Transaction tx = (Transaction) transaction;
- tx.abort();
- }
+ if (TLtx == null || TLtx.get() == null)
+ {
+ if (TLtx == null)
+ {
+ TLtx = new ThreadLocal();
+ }
+ Transaction tx = null;
+
+ try
+ {
+ tx = odmg.newTransaction();
+ tx.begin();
+ TLtx.set(tx);
+ }
+ catch (Exception e)
+ {
+ if (tx != null)
+ {
+ tx.abort();
+
+ }
+ log.fatal("beginTransaction() failed.", e);
+ throw new TransactionStateException("beginTransaction() failed.", e);
+ }
+ }
+ }
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#addObjectToTransaction(java.lang.Object, java.lang.Object)
+ * @see com.rippe.essential.agora.services.entity.AgoraEntityService#commitTransaction(java.lang.Object)
*/
- public void addObjectToTransaction(Object object, Object transaction, int lockLevel)
+ public void commitTransaction() throws TransactionStateException
{
- int useLevel = -1;
-
- switch (lockLevel)
+ Transaction tx = (Transaction) TLtx.get();
+ try
{
- case LOCK_LEVEL_READ :
- useLevel = Transaction.READ;
- break;
- default :
- useLevel = Transaction.WRITE;
- break;
+ if (tx == null)
+ {
+ throw new TransactionStateException("Transaction is null for this thread.");
+ }
+
+ if (!tx.isOpen())
+ {
+ throw new TransactionStateException(tx + " is not in open.");
+ }
+
+ tx.commit();
+ }
+ catch (Exception e)
+ {
+ log.error("Unable to commit transaction " + e.toString(), e);
+ tx.abort();
+ throw new TransactionStateException("Unable to commit transaction " + e.toString(), e);
}
+ finally
+ {
+ if (tx != null)
+ {
+ TLtx.set(null);
- Transaction tx = (Transaction) transaction;
- tx.lock(object, useLevel);
+ }
+ }
}
-
- /**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#commitTransaction(java.lang.Object)
- */
- public void commitTransaction(Object transaction)
+ public void prepareForDelete(Object obj) throws TransactionStateException
{
- Transaction tx = (Transaction) transaction;
- tx.commit();
- System.out.print("");
- }
+ Transaction tx = null;
+ if (TLtx == null || TLtx.get() == null)
+ {
+ throw new TransactionStateException("You can not mark objects for delete before a Transaction has been started.");
+ }
+ else
+ {
+ try
+ {
+ tx = (Transaction) TLtx.get();
+ tx.lock(obj, Transaction.WRITE);
+ db.deletePersistent(obj);
+ }
+ catch (Exception e)
+ {
+ throw new TransactionStateException("Unable to set object for deletion " + e.toString(), e);
+ }
+ }
+ }
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#setObjectForDeletion(java.lang.Object, java.lang.Object)
+ * @see com.rippe.essential.agora.services.entity.AgoraEntityService#update(java.lang.Object)
*/
- public void setObjectForDeletion(Object object, Object transaction)
+ public void prepareForUpdate(Object obj) throws TransactionStateException
{
- Transaction tx = (Transaction) transaction;
- tx.lock(object, Transaction.WRITE);
- db.deletePersistent(object);
- }
+ Transaction tx = null;
+ if (TLtx == null || TLtx.get() == null)
+ {
+ throw new TransactionStateException("You can not mark objects for update before a Transaction has been started.");
+ }
+ else
+ {
+ try
+ {
+ tx = (Transaction) TLtx.get();
+ tx.lock(obj, Transaction.WRITE);
+ }
+ catch (Exception e)
+ {
+ throw new TransactionStateException("Unable to set object for update " + e.toString(), e);
+ }
+ }
+ }
/**
- * This plug in uses ODMG to bacl its transactions.
- *
- * @return <code>org.odmg.Transaction</code>
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#startTransaction()
- *
+ * @see com.rippe.essential.agora.services.entity.AgoraEntityService#rollbackTranaction(java.lang.Object)
*/
- public Object startTransaction()
+ public void rollbackTransaction() throws TransactionStateException
{
- Transaction tx = odmg.newTransaction();
- tx.begin();
- return tx;
+ Transaction tx = (Transaction) TLtx.get();
+ try
+ {
+ if (tx != null && tx.isOpen())
+ {
+ tx.abort();
+ TLtx.set(null);
+ }
+ else
+ {
+ log.warn("Unable to rollback null or not-in-progess connection");
+ }
+
+ }
+ catch (Exception e)
+ {
+ if (e instanceof TransactionStateException)
+ {
+ throw (TransactionStateException) e;
+ }
+ throw new TransactionStateException("Unable to rollback transaction " + tx + " " + e.toString(), e);
+ }
}
protected void initODMG() throws InitializationException
@@ -198,88 +279,6 @@
}
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#update(java.lang.Object)
- */
- public void update(Object object)
- {
-
- try
- {
-
- // 1. Start the transaction
- TransactionImpl tx = (TransactionImpl) odmg.newTransaction();
- tx.begin();
-
- // 2. remove object from the OJB cache
- PersistenceBroker pb = tx.getBroker();
- //pb.removeFromCache(object);
-
- tx.markDirty(object);
-
- // 3. retreive a "stale" version of this object from the db
- Identity id = new Identity(object, pb);
- //Object staleObject = pb.getObjectByIdentity(id);
- // addObjectToTransaction(staleObject, tx, LOCK_LEVEL_WRITE);
- tx.lock(object, Transaction.WRITE);
-
- // 4. Map new values to the stale object
- //BeanUtils.copyProperties(object, object);
-
- // 5. Commit the transaction
- tx.commit();
-
- }
- catch (Throwable e)
- {
- log.error("Unexpected exception thrown while updating object instance", e);
- }
-
- }
-
- /**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#delete(java.lang.Object)
- */
- public void delete(Object object)
- {
- // // PersistenceBroker pb1 = getBroker();
- // try
- // {
- // // 1. Start the transaction
- // TransactionImpl tx = (TransactionImpl) odmg.newTransaction();
- //
- // // 2. remove object from the OJB cache
- //
- // tx.begin();
- // PersistenceBroker pb = tx.getBroker();
- // pb.removeFromCache(object);
- // Identity id = new Identity(object, pb);
- // // 3. retreive a "stale" version of this object from the db
- //
- // Object staleObject = pb.getObjectByIdentity(id);
- // tx.lock(staleObject, Transaction.WRITE);
- // db.deletePersistent(staleObject);
- // pb.removeFromCache(staleObject);
- //
- // // 5. Commit the transaction
- // tx.commit();
- // }
- // finally
- // {
- // // releaseBroker(pb1);
- // }
- PersistenceBroker pb = getBroker();
- try
- {
- pb.delete(object);
- }
- finally
- {
- releaseBroker(pb);
- }
-
- }
-
- /**
* @see org.apache.jetspeed.services.persistence.ODMGPersistencePlugin#newODMGTransaction()
*/
public Transaction newODMGTransaction()
@@ -296,15 +295,21 @@
}
/**
- * @see org.apache.jetspeed.services.persistence.PersistencePlugin#add(java.lang.Object)
+ * @see org.apache.jetspeed.persistence.PersistencePlugin#makeObjectConsistent(java.lang.Object)
*/
- public void add(Object object)
+ public Object markDirty(Object obj) throws TransactionStateException
{
- Transaction tx = odmg.newTransaction();
- tx.begin();
- tx.lock(object, Transaction.WRITE);
- tx.commit();
-
+ TransactionImpl ojbTx = (TransactionImpl) TLtx.get();
+ if(ojbTx != null && ojbTx.isOpen() )
+ {
+ ojbTx.markDirty(obj);
+ return obj;
+ }
+ else
+ {
+ throw new TransactionStateException("No transaction in progress");
+ }
+
}
}
1.3 +31 -70 jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/OJBPBPersistencePlugin.java
Index: OJBPBPersistencePlugin.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/OJBPBPersistencePlugin.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OJBPBPersistencePlugin.java 15 Aug 2003 18:37:14 -0000 1.2
+++ OJBPBPersistencePlugin.java 26 Nov 2003 20:53:35 -0000 1.3
@@ -58,6 +58,7 @@
import java.util.Iterator;
import org.apache.fulcrum.InitializationException;
+import org.apache.jetspeed.persistence.TransactionStateException;
import org.apache.ojb.broker.PersistenceBroker;
/**
@@ -65,111 +66,71 @@
* provide persistence operations. transaction support
* is provided straight through RDBMS.
*
+ * @deprecated Currently unimplemented. DO NOT USE!!!
* @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
*/
public class OJBPBPersistencePlugin extends AbstractOJBPersistencePlugin
{
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#abortTransaction(java.lang.Object)
+ * @see org.apache.jetspeed.services.perisistence.impl.AbstractOJBPersistencePlugin#postInit()
*/
- public void abortTransaction(Object transaction)
+ protected void postInit() throws InitializationException
{
- PersistenceBroker pb = getBroker();
- try
- {
- transaction = null;
- pb.abortTransaction();
- }
- finally
- {
- releaseBroker(pb);
- }
-
+ // nothing needs to be done
}
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#addObjectToTransaction(java.lang.Object, java.lang.Object, int)
+ * @see org.apache.jetspeed.persistence.PersistencePlugin#beginTransaction()
*/
- public void addObjectToTransaction(Object object, Object transaction, int lockLevel)
+ public void beginTransaction() throws TransactionStateException
{
- HashMap transactions = (HashMap) transaction;
- ArrayList list = (ArrayList) transactions.get("add");
- list.add(object);
+ throw new UnsupportedOperationException("Not Implemented!");
+
}
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#commitTransaction(java.lang.Object)
+ * @see org.apache.jetspeed.persistence.PersistencePlugin#commitTransaction()
*/
- public void commitTransaction(Object transaction)
+ public void commitTransaction() throws TransactionStateException
{
+ throw new UnsupportedOperationException("Not Implemented!");
- HashMap transactions = (HashMap) transaction;
- PersistenceBroker pb = (PersistenceBroker) transactions.get("pb");
- Iterator deletes = ((ArrayList) transactions.get("delete")).iterator();
- Iterator adds = ((ArrayList) transactions.get("add")).iterator();
- try
- {
- // process update/add operations
- while (adds.hasNext())
- {
- Object object = adds.next();
- pb.store(object);
- }
-
- // process delete operations
- while (deletes.hasNext())
- {
- pb.delete(deletes.next());
- }
-
- pb.commitTransaction();
- }
- finally
- {
- releaseBroker(pb);
- }
+ }
+ /**
+ * @see org.apache.jetspeed.persistence.PersistencePlugin#markDirty(java.lang.Object)
+ */
+ public Object markDirty(Object obj) throws TransactionStateException
+ {
+ throw new UnsupportedOperationException("Not Implemented!");
}
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#setObjectForDeletion(java.lang.Object, java.lang.Object)
+ * @see org.apache.jetspeed.persistence.PersistencePlugin#prepareForDelete(java.lang.Object)
*/
- public void setObjectForDeletion(Object object, Object transaction)
+ public void prepareForDelete(Object obj) throws TransactionStateException
{
- HashMap transactions = (HashMap) transaction;
- ArrayList list = (ArrayList) transactions.get("delete");
- list.add(object);
+ throw new UnsupportedOperationException("Not Implemented!");
+
}
/**
- * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#startTransaction()
+ * @see org.apache.jetspeed.persistence.PersistencePlugin#prepareForUpdate(java.lang.Object)
*/
- public Object startTransaction()
+ public void prepareForUpdate(Object obj) throws TransactionStateException
{
- try
- {
- HashMap transactions = new HashMap(2);
- transactions.put("add", new ArrayList());
- transactions.put("delete", new ArrayList());
- PersistenceBroker pb = getBroker();
- pb.beginTransaction();
- transactions.put("pb", pb);
- return transactions;
- }
- catch (Exception e)
- {
- e.printStackTrace();
- throw new JetspeedOJBRuntimeException(e);
- }
+ throw new UnsupportedOperationException("Not Implemented!");
+
}
/**
- * @see org.apache.jetspeed.services.perisistence.impl.AbstractOJBPersistencePlugin#postInit()
+ * @see org.apache.jetspeed.persistence.PersistencePlugin#rollbackTransaction()
*/
- protected void postInit() throws InitializationException
+ public void rollbackTransaction() throws TransactionStateException
{
- // nothing needs to be done
+ throw new UnsupportedOperationException("Not Implemented!");
+
}
}
1.4 +23 -95 jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/PersistencePlugin.java
Index: PersistencePlugin.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/PersistencePlugin.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PersistencePlugin.java 17 Oct 2003 00:38:21 -0000 1.3
+++ PersistencePlugin.java 26 Nov 2003 20:53:35 -0000 1.4
@@ -87,100 +87,28 @@
/** Constant that specifies a transaction lock level of read */
int LOCK_LEVEL_READ = 1;
-
- /**
- * <p>
- * Starts a transaction to which objects being persisted through this plugin
- * can be added to using the <code>addObjectToTransaction()</code> method.
- * <br/>
- * You should not perform operations directly on the returned transaction, instead
- * use the methods supplied through the <code>PersistencePlugin</code>
- * interface.
- * </p>
- * <p>
- * <strong>NOTE:<strong> Transaction support is not a requirement to creating
- * a PersistencePlugin. However, since almost all apis that support transactions
- * require that objects be modified within a transaction for there changes to be persisted
- * (requirements of both ODMG and JDO). So it is a good idea to perform these
- * operations within a transaction regardless of whether or not transactions are supported
- * by this plugin. Plugins not providing transactions should return a <code>NullTransaction</code>.
- * object. In addition they should also handle the <code>NullTransaction</code> object
- * gracefully within any plugin methods that deal directly with transaction i.e. ignore it
- * entirely with no exceptions being thrown.
- * </p>
- *
- * @return Object reflecting a transaction object specific to this plugin.
- */
- Object startTransaction();
-
- /**
- * Adds an <code>object</code> to the <code>transaction</code>
- * started by this plugin's <code>startTransaction()</code> method.
- * @param object Object to be added to the transaction
- * @param transaction Transaction object started by this plugin's startTransaction method
- */
- void addObjectToTransaction(Object object, Object transaction, int lockLevel);
-
- /**
- * Sets the <code>object</code> for deletion within the current
- * <code>treansaction</code>. Upon invoking the <code>commitTransaction()</code>
- * method, all objects scheduled for deletion are removed from persisteance.
- * Child objects and/or collections maybe removed/deleted
- * if the underlying api provides support for cascading deletes.
- * @param object Object to be scheduled for deletion
- * @param transaction Current transaction.
- */
- void setObjectForDeletion(Object object, Object transaction);
-
- /**
- * Aborts an existing transaction and all changes should be rolled back by the
- * underlying api, if transaction are supported.
- *
- * @param transaction Transaction to abort.
- */
- void abortTransaction(Object transaction);
-
- /**
- * Commits all changes made to objects that were added to the
- * current transaction via the <code>addObjectToTransaction()</code>
- * method and deletes all objects that have been scheduled for deletion
- * via the <code>setObjectForDeletion()</code> method.
- * @param transaction Transaction to be commited.
- */
- void commitTransaction(Object transaction);
-
- /**
- * Convenience method that updates a persistent object. If this PersistencePlugin supports
- * tranasctions, it should create an atomic transaction for updating this
- * object and commit it. This transaction will ONLY include this object
- * and possibly child object and/or collections, if the underlying api or
- * persistence mechanism supports it.
- * <br/>
- * <strong>NOTE:</strong>There is no need to perform this within a
- * transaction and may cause unexpected object locl contention if it is
- * used within a transaction.
- *
- * @param object persistent object to be updated
- */
- void update(Object object);
-
- /**
- * Convenience method that makes a previously non-persistent object persistent.
- * You should follow the same guidelines set
- * forth by the <code>update()</code> method in regards to transactions.
- * @param object Object to be persisted.
- */
- void add(Object object);
-
- /**
- * Convenience method that removes a persistent object. This operation
- * should be considered atomic as both <code>add()</code> and <code>update()</code>
- * with regards to transactions. Child objects and/or collections maybe removed
- * if the underlying api provides support for cascading deletes.
- *
- * @param object Object that will be removed from persistence.
- */
- void delete(Object object);
+
+ void beginTransaction() throws TransactionStateException;
+
+ void commitTransaction() throws TransactionStateException;
+
+ void prepareForDelete(Object obj) throws TransactionStateException;
+
+ void prepareForUpdate(Object obj) throws TransactionStateException;
+
+ void rollbackTransaction() throws TransactionStateException;
+
+ /**
+ * Takes an object that was modified outside of the current transaction
+ * and makes it so that it appears to have been modified within the
+ * current transaction.
+ * @param obj Object modified outside of a transaction
+ * @return An object the same type, whose object graph match those
+ * of the <code>obj</code> argument but is consistent within the
+ * current transaction.
+ * @throws TransactionStateException
+ */
+ Object markDirty(Object obj) throws TransactionStateException;
Collection getCollectionByQuery(Class clazz, Object query);
1.1 jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/TransactionStateException.java
Index: TransactionStateException.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.persistence;
import org.apache.commons.lang.exception.NestableException;
/**
* <p>
* TransactionStateException
* </p>
*
* @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
* @version $Id: TransactionStateException.java,v 1.1 2003/11/26 20:53:35 weaver Exp $
*
*/
public class TransactionStateException extends NestableException
{
/**
*
*/
public TransactionStateException()
{
super();
}
/**
* @param arg0
*/
public TransactionStateException(String arg0)
{
super(arg0);
}
/**
* @param arg0
*/
public TransactionStateException(Throwable arg0)
{
super(arg0);
}
/**
* @param arg0
* @param arg1
*/
public TransactionStateException(String arg0, Throwable arg1)
{
super(arg0, arg1);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org