Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ITransaction.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AutoAttacherTest.java85
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java94
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java451
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/logic/HorizontalTestLogic.java1
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavePoint.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java36
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java74
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java53
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java20
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOAutoAttacher.java266
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOPackageType.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavePointImpl.java188
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java43
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java6
24 files changed, 681 insertions, 710 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java
index 3d00fa14b5..e0e1ad3641 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java
@@ -50,8 +50,8 @@ public interface IStore extends IRepositoryElement
* Returns if this store supports the retrieval of historical newRevisions.
* <p>
* The contract includes that store implementations with auditing support must also implement
- * {@link IStoreReader#readRevisionByTime(org.eclipse.emf.cdo.protocol.CDOID, int, long) IStoreReader.readRevisionByTime(CDOID, int, long)}
- * to not throw an <code>UnsupportedOperationException</code>.
+ * {@link IStoreReader#readRevisionByTime(org.eclipse.emf.cdo.protocol.CDOID, int, long)
+ * IStoreReader.readRevisionByTime(CDOID, int, long)} to not throw an <code>UnsupportedOperationException</code>.
*
* @return <code>true</code> if this store supports the retrieval of historical newRevisions, <code>false</code>
* otherwise.
@@ -79,9 +79,9 @@ public interface IStore extends IRepositoryElement
* Returns a reader that can be used to read from this store in the context of the given session.
*
* @param session
- * The session that should be used as a context for read access or <code>null</code>. The store
- * implementor is free to interpret and use the session in a manner suitable for him or ignore it at all. It
- * is meant only as a hint. Implementor can use it as a key into a cache and/or register a
+ * The session that should be used as a context for read access or <code>null</code>. The store implementor
+ * is free to interpret and use the session in a manner suitable for him or ignore it at all. It is meant
+ * only as a hint. Implementor can use it as a key into a cache and/or register a
* {@link org.eclipse.net4j.internal.util.lifecycle.LifecycleEventAdapter LifecycleEventAdapter} with it to
* intercept cleanup on session close. Note however that the session can be <code>null</code>, for example
* during startup of the server while the repositories are initialized but before any user session has been
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
index db8136bac8..05963ad91c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
@@ -42,8 +42,8 @@ public interface IStoreWriter extends IStoreReader
public interface CommitContext
{
/**
- * Returns the ID of the transactional view (<code>ITransaction</code>) which is the scope of the commit
- * operation represented by this <code>CommitContext</code>.
+ * Returns the ID of the transactional view (<code>ITransaction</code>) which is the scope of the commit operation
+ * represented by this <code>CommitContext</code>.
*/
public int getTransactionID();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ITransaction.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ITransaction.java
index 4c70f547f9..5f229cf6cc 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ITransaction.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ITransaction.java
@@ -25,9 +25,8 @@ public interface ITransaction extends IView
/**
* Returns the temporary, transactional package manager associated with this ITransaction during the process of a
- * commit operation. In addition to the packages registered with the session
- * {@link IRepository#getPackageManager() package manager} this package manager also contains the new packages that
- * are part of the commit operation.
+ * commit operation. In addition to the packages registered with the session {@link IRepository#getPackageManager()
+ * package manager} this package manager also contains the new packages that are part of the commit operation.
*
* @return a temporary, transactional package manager if this ITransaction is in the process of a commit operation,
* <code>null</code> otherwise.
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AutoAttacherTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AutoAttacherTest.java
index 0dd5155862..a9c620e826 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AutoAttacherTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AutoAttacherTest.java
@@ -22,82 +22,79 @@ import org.eclipse.emf.cdo.util.CDOAutoAttacher;
import org.eclipse.emf.internal.cdo.CDOTransactionImpl;
-
/**
* @author Simon McDuff
*/
public class AutoAttacherTest extends AbstractCDOTest
{
-
public void testBasic() throws Exception
{
CDOSession session = openModel1Session();
-
+
CDOTransactionImpl transaction = (CDOTransactionImpl)session.openTransaction();
-
+
new CDOAutoAttacher(transaction);
-
+
CDOResource resource1 = transaction.getOrCreateResource("/test1");
- Product product = Model1Factory.eINSTANCE.createProduct();
- {
- assertTransient(product);
-
- resource1.getContents().add(product);
- assertEquals(resource1, product.eResource());
- //assertEquals(resource1, ((EObjectImpl)product).eDirectResource());
-
- assertNew(product, transaction);
-
- }
-
- OrderDetail orderDetail = Model1Factory.eINSTANCE.createOrderDetail();
- {
- assertTransient(orderDetail);
- product.getOrderDetails().add(orderDetail);
- assertNew(orderDetail, transaction);
- }
-
- Order order = Model1Factory.eINSTANCE.createOrder();
- {
- // Bidirectionnel/containment relationship
- assertTransient(order);
+ Product product = Model1Factory.eINSTANCE.createProduct();
+ {
+ assertTransient(product);
+
+ resource1.getContents().add(product);
+ assertEquals(resource1, product.eResource());
+ // assertEquals(resource1, ((EObjectImpl)product).eDirectResource());
+
+ assertNew(product, transaction);
+
+ }
+
+ OrderDetail orderDetail = Model1Factory.eINSTANCE.createOrderDetail();
+ {
+ assertTransient(orderDetail);
+ product.getOrderDetails().add(orderDetail);
+ assertNew(orderDetail, transaction);
+ }
+
+ Order order = Model1Factory.eINSTANCE.createOrder();
+ {
+ // Bidirectionnel/containment relationship
+ assertTransient(order);
// Fail for now. Need to be able to handle that case!
- //order.getOrderDetails().add(orderDetail);
+ // order.getOrderDetails().add(orderDetail);
+
+ // assertTransient(order);
+ }
- //assertTransient(order);
- }
-
- transaction.close();
- session.close();
+ transaction.close();
+ session.close();
}
-
+
public void testBasic2() throws Exception
{
CDOSession session = openModel1Session();
-
+
CDOTransactionImpl transaction = (CDOTransactionImpl)session.openTransaction();
-
+
new CDOAutoAttacher(transaction);
-
+
CDOResource resource1 = transaction.getOrCreateResource("/test1");
Supplier supplier = Model1Factory.eINSTANCE.createSupplier();
PurchaseOrder purchaseOrder = Model1Factory.eINSTANCE.createPurchaseOrder();
-
+
supplier.getPurchaseOrders().add(purchaseOrder);
-
+
assertTransient(supplier);
-
+
resource1.getContents().add(supplier);
-
+
assertNew(supplier, transaction);
assertNew(purchaseOrder, transaction);
-
transaction.close();
session.close();
}
-
+
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
index 81d50caa52..4d537f24fe 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
@@ -734,53 +734,53 @@ public class InitialTest extends AbstractCDOTest
msg("Verifying product");
assertEquals(null, orderDetail.getProduct());
}
-
+
public void testResourceAccessor() throws Exception
{
- msg("Opening session");
- CDOSession session = openModel1Session();
-
- msg("Opening transaction");
- CDOTransaction transaction = session.openTransaction();
-
- msg("Creating resource");
- CDOResource resource = transaction.createResource("/test1");
-
- msg("Creating supplier");
- Supplier supplier = Model1Factory.eINSTANCE.createSupplier();
-
- msg("Setting name");
- supplier.setName("Stepper");
-
- msg("Adding supplier");
- resource.getContents().add(supplier);
-
- URI supplierTempURI = EcoreUtil.getURI(supplier);
-
- msg("Retrieving supplier from URI before commit");
- EObject supplier1 = transaction.getResourceSet().getEObject(supplierTempURI, true);
-
- assertEquals(supplier, supplier1);
-
- msg("Committing");
- transaction.commit();
-
- URI supplierURI = EcoreUtil.getURI(supplier);
-
- msg("Retrieving supplier from URI after commit");
- EObject supplierFromURI = transaction.getResourceSet().getEObject(supplierURI, true);
-
- assertEquals(supplier, supplierFromURI);
-
- try
- {
- EObject supplierAfterCommit2 = transaction.getResourceSet().getEObject(supplierTempURI, true);
- assertEquals(null, supplierAfterCommit2);
- }
- catch(IllegalStateException excep)
- {
-
- }
-
- }
+ msg("Opening session");
+ CDOSession session = openModel1Session();
+
+ msg("Opening transaction");
+ CDOTransaction transaction = session.openTransaction();
+
+ msg("Creating resource");
+ CDOResource resource = transaction.createResource("/test1");
+
+ msg("Creating supplier");
+ Supplier supplier = Model1Factory.eINSTANCE.createSupplier();
+
+ msg("Setting name");
+ supplier.setName("Stepper");
+
+ msg("Adding supplier");
+ resource.getContents().add(supplier);
+
+ URI supplierTempURI = EcoreUtil.getURI(supplier);
+
+ msg("Retrieving supplier from URI before commit");
+ EObject supplier1 = transaction.getResourceSet().getEObject(supplierTempURI, true);
+
+ assertEquals(supplier, supplier1);
+
+ msg("Committing");
+ transaction.commit();
+
+ URI supplierURI = EcoreUtil.getURI(supplier);
+
+ msg("Retrieving supplier from URI after commit");
+ EObject supplierFromURI = transaction.getResourceSet().getEObject(supplierURI, true);
+
+ assertEquals(supplier, supplierFromURI);
+
+ try
+ {
+ EObject supplierAfterCommit2 = transaction.getResourceSet().getEObject(supplierTempURI, true);
+ assertEquals(null, supplierAfterCommit2);
+ }
+ catch (IllegalStateException excep)
+ {
+
+ }
+
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java
index aa3b55ad79..b1e495e78c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java
@@ -8,9 +8,9 @@
* Contributors:
* Simon McDuff - initial API and implementation
**************************************************************************/
-
-package org.eclipse.emf.cdo.tests;
-
+
+package org.eclipse.emf.cdo.tests;
+
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOSavePoint;
import org.eclipse.emf.cdo.CDOSession;
@@ -25,245 +25,246 @@ import org.eclipse.emf.internal.cdo.CDOTransactionImpl;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
import junit.framework.Assert;
-
-/**
- * @author Simon McDuff
- */
-public class SavePointTest extends AbstractCDOTest
-{
- public void testRollbackWithNewObject_Collection() throws Exception
- {
-
+
+/**
+ * @author Simon McDuff
+ */
+public class SavePointTest extends AbstractCDOTest
+{
+ public void testRollbackWithNewObject_Collection() throws Exception
+ {
+
CDOSession session = openModel1Session();
-
- session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);
-
- CDOTransaction transaction1 = session.openTransaction();
- // Client1
- CDOResource resource1 = transaction1.createResource("/test1");
-
- Company company1 = Model1Factory.eINSTANCE.createCompany();
- resource1.getContents().add(company1);
- Category category1 = Model1Factory.eINSTANCE.createCategory();
- company1.getCategories().add(category1);
-
- transaction1.createSavePoint();
-
- Category category2 = Model1Factory.eINSTANCE.createCategory();
- company1.getCategories().add(category2);
-
- CDOSavePoint savePoint2 = transaction1.createSavePoint();
-
- Category category3 = Model1Factory.eINSTANCE.createCategory();
- company1.getCategories().add(category3);
-
- transaction1.createSavePoint();
-
- transaction1.rollback(savePoint2, false);
-
- assertEquals(2, company1.getCategories().size());
-
- transaction1.commit();
-
- }
-
- public void testRollbackWithNewObject_Commit() throws Exception
- {
- flow1(false, true);
- }
- public void testRollbackWithNewObject_Rollback() throws Exception
- {
-
- flow1(false, false);
- }
-
- public void testRollbackWithPersistedObject_Commit() throws Exception
- {
- flow1(true, true);
- }
- public void testRollbackWithPersistedObject_Rollback() throws Exception
- {
- flow1(true, false);
- }
-
- public void testWrongSavePoint() throws Exception
- {
- CDOSession session = openModel1Session();
- session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);
-
- CDOTransactionImpl transaction1 = (CDOTransactionImpl)session.openTransaction();
- // Client1
- CDOResource resource1 = transaction1.createResource("/test1");
- Company company1 = Model1Factory.eINSTANCE.createCompany();
- resource1.getContents().add(company1);
- Category category1 = Model1Factory.eINSTANCE.createCategory();
- company1.getCategories().add(category1);
-
- CDOSavePoint savePoint1 = transaction1.createSavePoint();
- CDOSavePoint savePoint2 = transaction1.createSavePoint();
- transaction1.rollback(savePoint1, false);
- try
- {
- transaction1.rollback(savePoint2, false);
- Assert.assertEquals("Should have thrown an exception", false, true);
- }
- catch (IllegalArgumentException illegalArgumentException)
- {
-
- }
- try
- {
- transaction1.rollback(null, false);
- Assert.assertEquals("Should have thrown an exception", false, true);
- }
- catch (IllegalArgumentException illegalArgumentException)
- {
-
- }
- }
- public void testisDirty() throws Exception
- {
- CDOSession session = openModel1Session();
- session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);
-
+
+ session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);
+
+ CDOTransaction transaction1 = session.openTransaction();
+ // Client1
+ CDOResource resource1 = transaction1.createResource("/test1");
+
+ Company company1 = Model1Factory.eINSTANCE.createCompany();
+ resource1.getContents().add(company1);
+ Category category1 = Model1Factory.eINSTANCE.createCategory();
+ company1.getCategories().add(category1);
+
+ transaction1.createSavePoint();
+
+ Category category2 = Model1Factory.eINSTANCE.createCategory();
+ company1.getCategories().add(category2);
+
+ CDOSavePoint savePoint2 = transaction1.createSavePoint();
+
+ Category category3 = Model1Factory.eINSTANCE.createCategory();
+ company1.getCategories().add(category3);
+
+ transaction1.createSavePoint();
+
+ transaction1.rollback(savePoint2, false);
+
+ assertEquals(2, company1.getCategories().size());
+
+ transaction1.commit();
+
+ }
+
+ public void testRollbackWithNewObject_Commit() throws Exception
+ {
+ flow1(false, true);
+ }
+
+ public void testRollbackWithNewObject_Rollback() throws Exception
+ {
+
+ flow1(false, false);
+ }
+
+ public void testRollbackWithPersistedObject_Commit() throws Exception
+ {
+ flow1(true, true);
+ }
+
+ public void testRollbackWithPersistedObject_Rollback() throws Exception
+ {
+ flow1(true, false);
+ }
+
+ public void testWrongSavePoint() throws Exception
+ {
+ CDOSession session = openModel1Session();
+ session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);
+
+ CDOTransactionImpl transaction1 = (CDOTransactionImpl)session.openTransaction();
+ // Client1
+ CDOResource resource1 = transaction1.createResource("/test1");
+ Company company1 = Model1Factory.eINSTANCE.createCompany();
+ resource1.getContents().add(company1);
+ Category category1 = Model1Factory.eINSTANCE.createCategory();
+ company1.getCategories().add(category1);
+
+ CDOSavePoint savePoint1 = transaction1.createSavePoint();
+ CDOSavePoint savePoint2 = transaction1.createSavePoint();
+ transaction1.rollback(savePoint1, false);
+ try
+ {
+ transaction1.rollback(savePoint2, false);
+ Assert.assertEquals("Should have thrown an exception", false, true);
+ }
+ catch (IllegalArgumentException illegalArgumentException)
+ {
+
+ }
+ try
+ {
+ transaction1.rollback(null, false);
+ Assert.assertEquals("Should have thrown an exception", false, true);
+ }
+ catch (IllegalArgumentException illegalArgumentException)
+ {
+
+ }
+ }
+
+ public void testisDirty() throws Exception
+ {
+ CDOSession session = openModel1Session();
+ session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);
+
CDOTransactionImpl transaction1 = (CDOTransactionImpl)session.openTransaction();
-
+
CDOSavePoint savePoint0 = transaction1.createSavePoint();
- // Client1
- CDOResource resource1 = transaction1.createResource("/test1");
- Company company1 = Model1Factory.eINSTANCE.createCompany();
- resource1.getContents().add(company1);
- Category category1 = Model1Factory.eINSTANCE.createCategory();
- company1.getCategories().add(category1);
-
+ // Client1
+ CDOResource resource1 = transaction1.createResource("/test1");
+ Company company1 = Model1Factory.eINSTANCE.createCompany();
+ resource1.getContents().add(company1);
+ Category category1 = Model1Factory.eINSTANCE.createCategory();
+ company1.getCategories().add(category1);
+
CDOSavePoint savePoint1 = transaction1.createSavePoint();
Category category2 = Model1Factory.eINSTANCE.createCategory();
company1.getCategories().add(category2);
-
+
CDOSavePoint savePoint2 = transaction1.createSavePoint();
CDOSavePoint savePoint3 = transaction1.createSavePoint();
-
+
assertEquals(true, transaction1.isDirty());
-
+
transaction1.rollback(savePoint3, false);
assertEquals(true, transaction1.isDirty());
-
+
transaction1.rollback(savePoint2, false);
assertEquals(true, transaction1.isDirty());
-
+
transaction1.rollback(savePoint1, false);
assertEquals(true, transaction1.isDirty());
-
+
// Didn`t make any modification prior to savepoint0
transaction1.rollback(savePoint0, false);
assertEquals(false, transaction1.isDirty());
-
+
transaction1.rollback(false);
assertEquals(false, transaction1.isDirty());
- }
- public void flow1(boolean commitBegin, boolean commitEnd) throws Exception
- {
- CDOSession session = openModel1Session();
- session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);
-
- CDOTransactionImpl transaction1 = (CDOTransactionImpl)session.openTransaction();
- // Client1
- CDOResource resource1 = transaction1.createResource("/test1");
- Category category3,category2, category4;
-
- Company company1 = Model1Factory.eINSTANCE.createCompany();
- resource1.getContents().add(company1);
- Category category1 = Model1Factory.eINSTANCE.createCategory();
- company1.getCategories().add(category1);
-
- CDOSavePoint savePoint1 = transaction1.createSavePoint();
-
- // Modification for savePoint1
- Company company2 = Model1Factory.eINSTANCE.createCompany();
- resource1.getContents().add(company2);
- company1.setCity("CITY1");
-
- assertEquals(2, resource1.getContents().size());
-
- // Rollback
- transaction1.rollback(savePoint1, false);
-
- if (commitBegin)
- transaction1.commit();
-
-
- {
- assertEquals(null, company1.getCity());
- assertEquals(1, resource1.getContents().size());
- company1.setCity("CITY1");
- category2 = Model1Factory.eINSTANCE.createCategory();
- company1.getCategories().add(category2);
- }
-
- CDOSavePoint savePoint2 = transaction1.createSavePoint();
- {
- company1.setCity("CITY2");
- category3 = Model1Factory.eINSTANCE.createCategory();
- company1.getCategories().add(category3);
- }
-
-
- transaction1.createSavePoint();
- {
- company1.setCity("CITY3");
- assertEquals(3, company1.getCategories().size());
- category4 = Model1Factory.eINSTANCE.createCategory();
- company1.getCategories().add(category4);
-
- }
-
- transaction1.rollback(savePoint2, false);
-
- assertEquals(true , transaction1.isDirty());
-
- // Test NEW TO NEW
- assertEquals(false , FSMUtil.isTransient(company1));
-
- // Test NEW TO TRANSIENT (2 step back)
- assertEquals(true , FSMUtil.isTransient(category3));
- assertEquals(false, transaction1.getNewObjects().containsKey(((CDOObject)category3).cdoID()));
-
- // Test NEW TO TRANSIENT (1 step back)
- assertEquals(true , FSMUtil.isTransient(category4));
- assertEquals(false, transaction1.getNewObjects().containsKey(((CDOObject)category4).cdoID()));
-
- // Test NEW TO NEW
- assertEquals(false , FSMUtil.isTransient(category2));
- assertEquals(true, transaction1.getNewObjects().containsKey(((CDOObject)category2).cdoID()));
-
- // Test rollback NEW
- assertEquals("CITY1", company1.getCity());
- assertEquals(2, company1.getCategories().size());
- if (commitEnd)
- {
- transaction1.commit();
-
- assertClean(company1, transaction1);
- assertClean(category2, transaction1);
-
- assertEquals("CITY1", company1.getCity());
-
- assertEquals(2, company1.getCategories().size());
-
- assertEquals(null, transaction1.getLastSavePoint().getPreviousSavePoint());
- }
- else
- {
- transaction1.rollback(false);
- assertEquals(false , transaction1.isDirty());
- assertEquals(null , transaction1.getLastSavePoint().getNextSavePoint());
- assertEquals(null , transaction1.getLastSavePoint().getPreviousSavePoint());
-
- assertEquals(commitBegin , !FSMUtil.isTransient(company1));
-
- assertEquals(commitBegin , !FSMUtil.isTransient(resource1));
-
- }
-
- }
-}
+ }
+
+ public void flow1(boolean commitBegin, boolean commitEnd) throws Exception
+ {
+ CDOSession session = openModel1Session();
+ session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE);
+
+ CDOTransactionImpl transaction1 = (CDOTransactionImpl)session.openTransaction();
+ // Client1
+ CDOResource resource1 = transaction1.createResource("/test1");
+ Category category3, category2, category4;
+
+ Company company1 = Model1Factory.eINSTANCE.createCompany();
+ resource1.getContents().add(company1);
+ Category category1 = Model1Factory.eINSTANCE.createCategory();
+ company1.getCategories().add(category1);
+
+ CDOSavePoint savePoint1 = transaction1.createSavePoint();
+
+ // Modification for savePoint1
+ Company company2 = Model1Factory.eINSTANCE.createCompany();
+ resource1.getContents().add(company2);
+ company1.setCity("CITY1");
+
+ assertEquals(2, resource1.getContents().size());
+
+ // Rollback
+ transaction1.rollback(savePoint1, false);
+
+ if (commitBegin) transaction1.commit();
+
+ {
+ assertEquals(null, company1.getCity());
+ assertEquals(1, resource1.getContents().size());
+ company1.setCity("CITY1");
+ category2 = Model1Factory.eINSTANCE.createCategory();
+ company1.getCategories().add(category2);
+ }
+
+ CDOSavePoint savePoint2 = transaction1.createSavePoint();
+ {
+ company1.setCity("CITY2");
+ category3 = Model1Factory.eINSTANCE.createCategory();
+ company1.getCategories().add(category3);
+ }
+
+ transaction1.createSavePoint();
+ {
+ company1.setCity("CITY3");
+ assertEquals(3, company1.getCategories().size());
+ category4 = Model1Factory.eINSTANCE.createCategory();
+ company1.getCategories().add(category4);
+
+ }
+
+ transaction1.rollback(savePoint2, false);
+
+ assertEquals(true, transaction1.isDirty());
+
+ // Test NEW TO NEW
+ assertEquals(false, FSMUtil.isTransient(company1));
+
+ // Test NEW TO TRANSIENT (2 step back)
+ assertEquals(true, FSMUtil.isTransient(category3));
+ assertEquals(false, transaction1.getNewObjects().containsKey(((CDOObject)category3).cdoID()));
+
+ // Test NEW TO TRANSIENT (1 step back)
+ assertEquals(true, FSMUtil.isTransient(category4));
+ assertEquals(false, transaction1.getNewObjects().containsKey(((CDOObject)category4).cdoID()));
+
+ // Test NEW TO NEW
+ assertEquals(false, FSMUtil.isTransient(category2));
+ assertEquals(true, transaction1.getNewObjects().containsKey(((CDOObject)category2).cdoID()));
+
+ // Test rollback NEW
+ assertEquals("CITY1", company1.getCity());
+ assertEquals(2, company1.getCategories().size());
+ if (commitEnd)
+ {
+ transaction1.commit();
+
+ assertClean(company1, transaction1);
+ assertClean(category2, transaction1);
+
+ assertEquals("CITY1", company1.getCity());
+
+ assertEquals(2, company1.getCategories().size());
+
+ assertEquals(null, transaction1.getLastSavePoint().getPreviousSavePoint());
+ }
+ else
+ {
+ transaction1.rollback(false);
+ assertEquals(false, transaction1.isDirty());
+ assertEquals(null, transaction1.getLastSavePoint().getNextSavePoint());
+ assertEquals(null, transaction1.getLastSavePoint().getPreviousSavePoint());
+
+ assertEquals(commitBegin, !FSMUtil.isTransient(company1));
+
+ assertEquals(commitBegin, !FSMUtil.isTransient(resource1));
+
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/logic/HorizontalTestLogic.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/logic/HorizontalTestLogic.java
index 99ff77c432..f0175596cd 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/logic/HorizontalTestLogic.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/logic/HorizontalTestLogic.java
@@ -16,7 +16,6 @@ import org.eclipse.emf.cdo.server.internal.db.MappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.ToMany;
import org.eclipse.emf.cdo.server.internal.db.ToOne;
-
import java.util.HashMap;
import java.util.Map;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavePoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavePoint.java
index d7c69b28b6..113a99ba9f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavePoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavePoint.java
@@ -15,8 +15,10 @@ package org.eclipse.emf.cdo;
*/
public interface CDOSavePoint
{
- CDOTransaction getTransaction();
- CDOSavePoint getNextSavePoint();
- CDOSavePoint getPreviousSavePoint();
+ CDOTransaction getTransaction();
+
+ CDOSavePoint getNextSavePoint();
+
+ CDOSavePoint getPreviousSavePoint();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java
index 1360d9bb6e..f545aa4659 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java
@@ -52,11 +52,11 @@ public interface CDOTransaction extends CDOView
public void commit() throws TransactionException;
public void rollback(boolean remote);
-
+
public void rollback(CDOSavePoint savePoint, boolean remote);
-
+
public CDOSavePoint createSavePoint();
-
+
public CDOSavePoint getLastSavePoint();
public void addHandler(CDOTransactionHandler handler);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java
index 6c1dc045a1..eea24b159e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransactionHandler.java
@@ -22,8 +22,8 @@ import org.eclipse.emf.cdo.protocol.revision.delta.CDOFeatureDelta;
public interface CDOTransactionHandler
{
/**
- * Called by a <code>CDOTransaction</code> <b>before</b> an object is added. The implementor of this method is
- * allowed to throw an unchecked exception that will propagate up to the operation that is about to add the object.
+ * Called by a <code>CDOTransaction</code> <b>before</b> an object is added. The implementor of this method is allowed
+ * to throw an unchecked exception that will propagate up to the operation that is about to add the object.
*/
public void addingObject(CDOTransaction transaction, CDOObject object);
@@ -41,9 +41,9 @@ public interface CDOTransactionHandler
* transaction.
*/
public void committingTransaction(CDOTransaction transaction);
-
+
/**
- * Called by a <code>CDOTransaction</code> <b>after</b> it is being rolled back. If the implementor of this method
+ * Called by a <code>CDOTransaction</code> <b>after</b> it is being rolled back. If the implementor of this method
* throw an exception other listener would not be notify and the exception will be propagated.
*/
public void rollingbackTransaction(CDOTransaction transaction);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java
index a637e01b7d..12844850ee 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java
@@ -16,8 +16,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
/**
- * <!-- begin-user-doc --> A representation of the model object '<em><b>CDO Resource</b></em>'. <!-- end-user-doc
- * -->
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>CDO Resource</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are supported:
* <ul>
@@ -43,8 +42,8 @@ public interface CDOResource extends EresourceObject
/**
* Returns the value of the '<em><b>Resource Set</b></em>' attribute. <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Resource Set</em>' attribute isn't clear, there really should be more of a
- * description here...
+ * If the meaning of the '<em>Resource Set</em>' attribute isn't clear, there really should be more of a description
+ * here...
* </p>
* <!-- end-user-doc -->
*
@@ -70,8 +69,7 @@ public interface CDOResource extends EresourceObject
/**
* Returns the value of the '<em><b>URI</b></em>' attribute. <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>URI</em>' attribute isn't clear, there really should be more of a description
- * here...
+ * If the meaning of the '<em>URI</em>' attribute isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
*
@@ -98,8 +96,8 @@ public interface CDOResource extends EresourceObject
* Returns the value of the '<em><b>Contents</b></em>' containment reference list. The list contents are of type
* {@link org.eclipse.emf.ecore.EObject}. <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Contents</em>' containment reference list isn't clear, there really should be more
- * of a description here...
+ * If the meaning of the '<em>Contents</em>' containment reference list isn't clear, there really should be more of a
+ * description here...
* </p>
* <!-- end-user-doc -->
*
@@ -140,8 +138,7 @@ public interface CDOResource extends EresourceObject
/**
* Returns the value of the '<em><b>Loaded</b></em>' attribute. <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Loaded</em>' attribute isn't clear, there really should be more of a description
- * here...
+ * If the meaning of the '<em>Loaded</em>' attribute isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
*
@@ -154,8 +151,8 @@ public interface CDOResource extends EresourceObject
boolean isLoaded();
/**
- * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResource#isLoaded <em>Loaded</em>}' attribute.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResource#isLoaded <em>Loaded</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
*
* @param value
* the new value of the '<em>Loaded</em>' attribute.
@@ -181,8 +178,8 @@ public interface CDOResource extends EresourceObject
boolean isTrackingModification();
/**
- * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification <em>Tracking Modification</em>}'
- * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification
+ * <em>Tracking Modification</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @param value
* the new value of the '<em>Tracking Modification</em>' attribute.
@@ -195,8 +192,8 @@ public interface CDOResource extends EresourceObject
* Returns the value of the '<em><b>Errors</b></em>' attribute list. The list contents are of type
* {@link org.eclipse.emf.ecore.resource.Resource.Diagnostic}. <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Errors</em>' attribute list isn't clear, there really should be more of a
- * description here...
+ * If the meaning of the '<em>Errors</em>' attribute list isn't clear, there really should be more of a description
+ * here...
* </p>
* <!-- end-user-doc -->
*
@@ -211,8 +208,8 @@ public interface CDOResource extends EresourceObject
* Returns the value of the '<em><b>Warnings</b></em>' attribute list. The list contents are of type
* {@link org.eclipse.emf.ecore.resource.Resource.Diagnostic}. <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Warnings</em>' attribute list isn't clear, there really should be more of a
- * description here...
+ * If the meaning of the '<em>Warnings</em>' attribute list isn't clear, there really should be more of a description
+ * here...
* </p>
* <!-- end-user-doc -->
*
@@ -253,8 +250,7 @@ public interface CDOResource extends EresourceObject
/**
* Returns the value of the '<em><b>Path</b></em>' attribute. <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Path</em>' attribute isn't clear, there really should be more of a description
- * here...
+ * If the meaning of the '<em>Path</em>' attribute isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
*
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java
index 8d5487e046..b7f0011260 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java
@@ -112,8 +112,8 @@ public interface EresourcePackage extends EPackage
int CDO_RESOURCE__LOADED = 4;
/**
- * The feature id for the '<em><b>Tracking Modification</b></em>' attribute. <!-- begin-user-doc --> <!--
- * end-user-doc -->
+ * The feature id for the '<em><b>Tracking Modification</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
*
* @generated
* @ordered
@@ -129,8 +129,7 @@ public interface EresourcePackage extends EPackage
int CDO_RESOURCE__ERRORS = 6;
/**
- * The feature id for the '<em><b>Warnings</b></em>' attribute list. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
+ * The feature id for the '<em><b>Warnings</b></em>' attribute list. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
@@ -154,8 +153,8 @@ public interface EresourcePackage extends EPackage
int CDO_RESOURCE__PATH = 9;
/**
- * The number of structural features of the '<em>CDO Resource</em>' class. <!-- begin-user-doc --> <!--
- * end-user-doc -->
+ * The number of structural features of the '<em>CDO Resource</em>' class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
*
* @generated
* @ordered
@@ -200,8 +199,8 @@ public interface EresourcePackage extends EPackage
EClass getCDOResource();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getResourceSet <em>Resource Set</em>}'.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getResourceSet
+ * <em>Resource Set</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute '<em>Resource Set</em>'.
* @see org.eclipse.emf.cdo.eresource.CDOResource#getResourceSet()
@@ -222,8 +221,9 @@ public interface EresourcePackage extends EPackage
EAttribute getCDOResource_URI();
/**
- * Returns the meta object for the containment reference list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getContents <em>Contents</em>}'.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.eresource.CDOResource#getContents <em>Contents</em>}'. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
*
* @return the meta object for the containment reference list '<em>Contents</em>'.
* @see org.eclipse.emf.cdo.eresource.CDOResource#getContents()
@@ -233,8 +233,8 @@ public interface EresourcePackage extends EPackage
EReference getCDOResource_Contents();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isModified <em>Modified</em>}'.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isModified
+ * <em>Modified</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute '<em>Modified</em>'.
* @see org.eclipse.emf.cdo.eresource.CDOResource#isModified()
@@ -244,8 +244,8 @@ public interface EresourcePackage extends EPackage
EAttribute getCDOResource_Modified();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isLoaded <em>Loaded</em>}'.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isLoaded
+ * <em>Loaded</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute '<em>Loaded</em>'.
* @see org.eclipse.emf.cdo.eresource.CDOResource#isLoaded()
@@ -255,8 +255,8 @@ public interface EresourcePackage extends EPackage
EAttribute getCDOResource_Loaded();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification <em>Tracking Modification</em>}'.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification
+ * <em>Tracking Modification</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute '<em>Tracking Modification</em>'.
* @see org.eclipse.emf.cdo.eresource.CDOResource#isTrackingModification()
@@ -266,8 +266,8 @@ public interface EresourcePackage extends EPackage
EAttribute getCDOResource_TrackingModification();
/**
- * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getErrors <em>Errors</em>}'.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getErrors
+ * <em>Errors</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute list '<em>Errors</em>'.
* @see org.eclipse.emf.cdo.eresource.CDOResource#getErrors()
@@ -277,8 +277,8 @@ public interface EresourcePackage extends EPackage
EAttribute getCDOResource_Errors();
/**
- * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getWarnings <em>Warnings</em>}'.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.eresource.CDOResource#getWarnings
+ * <em>Warnings</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute list '<em>Warnings</em>'.
* @see org.eclipse.emf.cdo.eresource.CDOResource#getWarnings()
@@ -288,8 +288,8 @@ public interface EresourcePackage extends EPackage
EAttribute getCDOResource_Warnings();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getTimeStamp <em>Time Stamp</em>}'.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getTimeStamp
+ * <em>Time Stamp</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute '<em>Time Stamp</em>'.
* @see org.eclipse.emf.cdo.eresource.CDOResource#getTimeStamp()
@@ -332,8 +332,8 @@ public interface EresourcePackage extends EPackage
EDataType getURI();
/**
- * Returns the meta object for data type '{@link org.eclipse.emf.ecore.resource.Resource.Diagnostic <em>Diagnostic</em>}'.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Returns the meta object for data type '{@link org.eclipse.emf.ecore.resource.Resource.Diagnostic
+ * <em>Diagnostic</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for data type '<em>Diagnostic</em>'.
* @see org.eclipse.emf.ecore.resource.Resource.Diagnostic
@@ -365,8 +365,8 @@ public interface EresourcePackage extends EPackage
interface Literals
{
/**
- * The meta object literal for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl <em>CDO Resource</em>}'
- * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl <em>CDO Resource</em>}
+ * ' class. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl
* @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getCDOResource()
@@ -375,8 +375,8 @@ public interface EresourcePackage extends EPackage
EClass CDO_RESOURCE = eINSTANCE.getCDOResource();
/**
- * The meta object literal for the '<em><b>Resource Set</b></em>' attribute feature. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * The meta object literal for the '<em><b>Resource Set</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
*
* @generated
*/
@@ -415,24 +415,24 @@ public interface EresourcePackage extends EPackage
EAttribute CDO_RESOURCE__LOADED = eINSTANCE.getCDOResource_Loaded();
/**
- * The meta object literal for the '<em><b>Tracking Modification</b></em>' attribute feature. <!--
- * begin-user-doc --> <!-- end-user-doc -->
+ * The meta object literal for the '<em><b>Tracking Modification</b></em>' attribute feature. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
*
* @generated
*/
EAttribute CDO_RESOURCE__TRACKING_MODIFICATION = eINSTANCE.getCDOResource_TrackingModification();
/**
- * The meta object literal for the '<em><b>Errors</b></em>' attribute list feature. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * The meta object literal for the '<em><b>Errors</b></em>' attribute list feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
*
* @generated
*/
EAttribute CDO_RESOURCE__ERRORS = eINSTANCE.getCDOResource_Errors();
/**
- * The meta object literal for the '<em><b>Warnings</b></em>' attribute list feature. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * The meta object literal for the '<em><b>Warnings</b></em>' attribute list feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
*
* @generated
*/
@@ -455,8 +455,7 @@ public interface EresourcePackage extends EPackage
EAttribute CDO_RESOURCE__PATH = eINSTANCE.getCDOResource_Path();
/**
- * The meta object literal for the '<em>Resource Set</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
+ * The meta object literal for the '<em>Resource Set</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see org.eclipse.emf.ecore.resource.ResourceSet
* @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getResourceSet()
@@ -474,8 +473,7 @@ public interface EresourcePackage extends EPackage
EDataType URI = eINSTANCE.getURI();
/**
- * The meta object literal for the '<em>Diagnostic</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
+ * The meta object literal for the '<em>Diagnostic</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see org.eclipse.emf.ecore.resource.Resource.Diagnostic
* @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getDiagnostic()
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
index 7544edbf78..55c1c2a9be 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
@@ -15,15 +15,12 @@ import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.CDOTransaction;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
-import org.eclipse.emf.cdo.internal.protocol.id.CDOIDLongImpl;
-import org.eclipse.emf.cdo.internal.protocol.id.CDOIDTempObjectImpl;
import org.eclipse.emf.cdo.protocol.id.CDOID;
import org.eclipse.emf.cdo.protocol.id.CDOIDUtil;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.internal.cdo.CDOLegacyImpl;
import org.eclipse.emf.internal.cdo.CDOObjectImpl;
-import org.eclipse.emf.internal.cdo.CDOStateMachine;
import org.eclipse.emf.internal.cdo.CDOViewImpl;
import org.eclipse.emf.internal.cdo.InternalCDOObject;
import org.eclipse.emf.internal.cdo.bundle.OM;
@@ -31,7 +28,6 @@ import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.ImplementationError;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
@@ -49,9 +45,7 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.emf.ecore.xmi.UnresolvedReferenceException;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -62,8 +56,7 @@ import java.util.ListIterator;
import java.util.Map;
/**
- * <!-- begin-user-doc --> An implementation of the model object '<em><b>CDO Resource</b></em>'. <!-- end-user-doc
- * -->
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>CDO Resource</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
@@ -340,36 +333,32 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
*/
public EObject getEObject(String uriFragment)
{
- if (uriFragment == null)
- return null;
-
+ if (uriFragment == null) return null;
+
CDOID cdoID = CDOIDUtil.read(uriFragment, cdoView().getSession().getPackageManager().getCDOIDObjectFactory());
-
- if (cdoID.isNull())
- return null;
-
+
+ if (cdoID.isNull()) return null;
+
if (cdoID.isTemporary() && !cdoView().isObjectRegistered(cdoID))
throw new IllegalStateException("Temporary object : " + uriFragment + " is not available anymore.");
-
- if (cdoID.isObject())
- return cdoView().getObject(cdoID,true);
+
+ if (cdoID.isObject()) return cdoView().getObject(cdoID, true);
// If it doesn`t match to anything we return null like ResourceImpl.getEObject
return null;
}
/**
- *
* @ADDED
*/
public String getURIFragment(EObject object)
{
InternalCDOObject internalCDOObject = FSMUtil.adapt(object, this.cdoView());
-
+
StringBuffer idBuffer = new StringBuffer();
-
+
CDOIDUtil.write(idBuffer, internalCDOObject.cdoID());
-
+
return idBuffer.toString();
}
@@ -434,16 +423,11 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
*/
public void attached(EObject object)
{
- /*InternalCDOObject legacy = getLegacyWrapper(object);
- if (legacy.cdoState() != CDOState.CLEAN)
- {
- CDOStateMachine.INSTANCE.attach(legacy, this, view);
- // if (legacy.eContainer() == this)
- // {
- // legacy.eBasicSetContainer(null, 0, null);
- // legacy.eSetResource(this, null);
- // }
- }*/
+ /*
+ * InternalCDOObject legacy = getLegacyWrapper(object); if (legacy.cdoState() != CDOState.CLEAN) {
+ * CDOStateMachine.INSTANCE.attach(legacy, this, view); // if (legacy.eContainer() == this) // { //
+ * legacy.eBasicSetContainer(null, 0, null); // legacy.eSetResource(this, null); // } }
+ */
}
/**
@@ -452,9 +436,8 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
public void detached(EObject object)
{
/*
- InternalCDOObject legacy = getLegacyWrapper(object);
- CDOStateMachine.INSTANCE.detach(legacy);
- */
+ * InternalCDOObject legacy = getLegacyWrapper(object); CDOStateMachine.INSTANCE.detach(legacy);
+ */
}
/**
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java
index 1d2a89a679..026f3b217b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java
@@ -60,8 +60,8 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
private EDataType diagnosticEDataType = null;
/**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package package URI value.
+ * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry
+ * EPackage.Registry} by the package package URI value.
* <p>
* Note: the correct way to create the package is via the static factory method {@link #init init()}, which also
* performs initialization of the package, or returns the registered package, if one already exists. <!--
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java
index 65ee0e6692..84265bd643 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java
@@ -104,9 +104,9 @@ public class EresourceAdapterFactory extends AdapterFactoryImpl
}
/**
- * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.eresource.CDOResource <em>CDO Resource</em>}'.
- * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
- * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.eresource.CDOResource
+ * <em>CDO Resource</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
+ * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
*
* @return the new adapter.
* @see org.eclipse.emf.cdo.eresource.CDOResource
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java
index 2a0ac94b56..bd97da807d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java
@@ -50,8 +50,8 @@ public class EresourceSwitch<T>
}
/**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that
- * result. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
@@ -62,8 +62,8 @@ public class EresourceSwitch<T>
}
/**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that
- * result. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
@@ -82,8 +82,8 @@ public class EresourceSwitch<T>
}
/**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that
- * result. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
@@ -105,8 +105,8 @@ public class EresourceSwitch<T>
}
/**
- * Returns the result of interpreting the object as an instance of '<em>CDO Resource</em>'. <!-- begin-user-doc
- * --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ * Returns the result of interpreting the object as an instance of '<em>CDO Resource</em>'. <!-- begin-user-doc -->
+ * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
*
* @param object
* the target of the switch.
@@ -120,8 +120,8 @@ public class EresourceSwitch<T>
}
/**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc -->
- * This implementation returns null; returning a non-null result will terminate the switch, but this is the last case
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch, but this is the last case
* anyway. <!-- end-user-doc -->
*
* @param object
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOAutoAttacher.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOAutoAttacher.java
index 1423a7b855..e1d50da752 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOAutoAttacher.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOAutoAttacher.java
@@ -7,7 +7,8 @@
*
* Contributors:
* Simon McDuff - initial API and implementation
- **************************************************************************/package org.eclipse.emf.cdo.util;
+ **************************************************************************/
+package org.eclipse.emf.cdo.util;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOTransaction;
@@ -31,143 +32,140 @@ import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.resource.Resource;
import java.util.List;
+
/**
* @author Simon McDuff
*/
public class CDOAutoAttacher implements CDOTransactionHandler
-{
- CDOTransaction cdoTransaction;
-
-
-
- class CDOFeatureDeltaVisitorAutoAttach implements CDOFeatureDeltaVisitor
- {
-
- Resource resource;
- CDOFeatureDeltaVisitorAutoAttach(Resource resource)
- {
- this.resource = resource;
- }
- public void visit(CDOAddFeatureDelta featureChange)
- {
- persist(resource, featureChange.getValue());
- }
-
- public void visit(CDOClearFeatureDelta featureChange)
- {
-
- }
-
- public void visit(CDOListFeatureDelta featureChange)
- {
-
- }
-
- public void visit(CDOMoveFeatureDelta featureChange)
- {
-
- }
-
- public void visit(CDORemoveFeatureDelta featureChange)
- {
- }
-
- public void visit(CDOSetFeatureDelta featureChange)
- {
- persist(resource, featureChange.getValue());
- }
-
- public void visit(CDOUnsetFeatureDelta featureChange)
- {
- }
-
- public void visit(CDOContainerFeatureDelta delta)
- {
- }
-
- };
-
- public CDOAutoAttacher(CDOTransaction transaction)
- {
- this.cdoTransaction = transaction;
- transaction.addHandler(this);
- }
-
- protected void persist(Resource res, Object object)
- {
- if (object instanceof CDOResource)
- return;
-
- if (!(object instanceof InternalCDOObject))
- return;
-
- res.getContents().add((InternalCDOObject)object);
- }
-
- /**
- * @param eObject
- */
- private void handle(Resource resource, EObject eObject)
- {
- for (EReference reference : eObject.eClass().getEAllReferences())
- {
- if (reference.isMany())
- {
- List<EObject> list = (List<EObject>)eObject.eGet(reference);
- for (EObject element : list)
- {
- if (element.eResource() == null)
- {
- if (reference.isContainment())
- handle(resource, element);
- else
- persist(resource, element);
- }
- }
- }
- else
- {
- EObject element = (EObject)eObject.eGet(reference);
-
- if (element != null && element.eResource() == null)
- {
- // objectsAdded.add(element);
- if (reference.isContainment())
- handle(resource, element);
- else
- persist(resource, element);
- }
- }
- }
-
- }
-
- public void addingObject(CDOTransaction transaction, CDOObject object)
- {
- if (object instanceof CDOResource)
- return;
-
- // Persist the graph as well.
- handle(object.eResource(), object);
- }
-
- public void committingTransaction(CDOTransaction transaction)
- {
-
- }
-
- public void modifyingObject(CDOTransaction transaction, CDOObject object, CDOFeatureDelta featureChange)
- {
- if (object instanceof CDOResource)
- return;
-
- if (featureChange != null)
- {
- CDOFeatureDeltaVisitorAutoAttach featureChangeVisitor = new CDOFeatureDeltaVisitorAutoAttach( object.cdoResource());
- featureChange.accept(featureChangeVisitor);
- }
-
- }
+{
+ CDOTransaction cdoTransaction;
+
+ class CDOFeatureDeltaVisitorAutoAttach implements CDOFeatureDeltaVisitor
+ {
+
+ Resource resource;
+
+ CDOFeatureDeltaVisitorAutoAttach(Resource resource)
+ {
+ this.resource = resource;
+ }
+
+ public void visit(CDOAddFeatureDelta featureChange)
+ {
+ persist(resource, featureChange.getValue());
+ }
+
+ public void visit(CDOClearFeatureDelta featureChange)
+ {
+
+ }
+
+ public void visit(CDOListFeatureDelta featureChange)
+ {
+
+ }
+
+ public void visit(CDOMoveFeatureDelta featureChange)
+ {
+
+ }
+
+ public void visit(CDORemoveFeatureDelta featureChange)
+ {
+ }
+
+ public void visit(CDOSetFeatureDelta featureChange)
+ {
+ persist(resource, featureChange.getValue());
+ }
+
+ public void visit(CDOUnsetFeatureDelta featureChange)
+ {
+ }
+
+ public void visit(CDOContainerFeatureDelta delta)
+ {
+ }
+
+ };
+
+ public CDOAutoAttacher(CDOTransaction transaction)
+ {
+ this.cdoTransaction = transaction;
+ transaction.addHandler(this);
+ }
+
+ protected void persist(Resource res, Object object)
+ {
+ if (object instanceof CDOResource) return;
+
+ if (!(object instanceof InternalCDOObject)) return;
+
+ res.getContents().add((InternalCDOObject)object);
+ }
+
+ /**
+ * @param eObject
+ */
+ private void handle(Resource resource, EObject eObject)
+ {
+ for (EReference reference : eObject.eClass().getEAllReferences())
+ {
+ if (reference.isMany())
+ {
+ List<EObject> list = (List<EObject>)eObject.eGet(reference);
+ for (EObject element : list)
+ {
+ if (element.eResource() == null)
+ {
+ if (reference.isContainment())
+ handle(resource, element);
+ else
+ persist(resource, element);
+ }
+ }
+ }
+ else
+ {
+ EObject element = (EObject)eObject.eGet(reference);
+
+ if (element != null && element.eResource() == null)
+ {
+ // objectsAdded.add(element);
+ if (reference.isContainment())
+ handle(resource, element);
+ else
+ persist(resource, element);
+ }
+ }
+ }
+
+ }
+
+ public void addingObject(CDOTransaction transaction, CDOObject object)
+ {
+ if (object instanceof CDOResource) return;
+
+ // Persist the graph as well.
+ handle(object.eResource(), object);
+ }
+
+ public void committingTransaction(CDOTransaction transaction)
+ {
+
+ }
+
+ public void modifyingObject(CDOTransaction transaction, CDOObject object, CDOFeatureDelta featureChange)
+ {
+ if (object instanceof CDOResource) return;
+
+ if (featureChange != null)
+ {
+ CDOFeatureDeltaVisitorAutoAttach featureChangeVisitor = new CDOFeatureDeltaVisitorAutoAttach(object.cdoResource());
+ featureChange.accept(featureChangeVisitor);
+ }
+
+ }
public void rollingbackTransaction(CDOTransaction transaction)
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOPackageType.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOPackageType.java
index f02a6fd37f..51aad57b49 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOPackageType.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOPackageType.java
@@ -20,21 +20,21 @@ import org.eclipse.emf.internal.cdo.CDOStateMachine;
public enum CDOPackageType
{
/**
- * The type of <code>EPackages</code> that have been dedicatedly generated for CDO. Instances of
- * <code>EClasses</code> of these packages are represented by {@link CDOObjectImpl} to the {@link CDOStateMachine}.
+ * The type of <code>EPackages</code> that have been dedicatedly generated for CDO. Instances of <code>EClasses</code>
+ * of these packages are represented by {@link CDOObjectImpl} to the {@link CDOStateMachine}.
*/
NATIVE,
/**
- * The type of <code>EPackages</code> that have been normally generated for EMF. Instances of <code>EClasses</code>
- * of these packages are represented by {@link CDOAdapterImpl} to the {@link CDOStateMachine}.
+ * The type of <code>EPackages</code> that have been normally generated for EMF. Instances of <code>EClasses</code> of
+ * these packages are represented by {@link CDOAdapterImpl} to the {@link CDOStateMachine}.
*/
LEGACY,
/**
- * The type of <code>EPackages</code> that have been normally generated for EMF and later converted to CDO.
- * Instances of <code>EClasses</code> of these packages are represented by
- * {@link org.eclipse.emf.internal.cdo.CDOCallbackImpl} to the {@link CDOStateMachine}.
+ * The type of <code>EPackages</code> that have been normally generated for EMF and later converted to CDO. Instances
+ * of <code>EClasses</code> of these packages are represented by {@link org.eclipse.emf.internal.cdo.CDOCallbackImpl}
+ * to the {@link CDOStateMachine}.
*/
CONVERTED
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
index a1d06f9673..333ffd666d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
@@ -569,7 +569,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
{
// Delegate to CDOStore
getStore().setContainer(this, newContainer, newContainerFeatureID);
-
+
if (newContainer instanceof Resource.Internal)
{
eSetDirectResource((Resource.Internal)newContainer);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavePointImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavePointImpl.java
index c3f6b7343c..26f33cf0c3 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavePointImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavePointImpl.java
@@ -8,9 +8,9 @@
* Contributors:
* Simon McDuff - initial API and implementation
*
- **************************************************************************/
-package org.eclipse.emf.internal.cdo;
-
+ **************************************************************************/
+package org.eclipse.emf.internal.cdo;
+
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOSavePoint;
import org.eclipse.emf.cdo.CDOTransaction;
@@ -23,102 +23,100 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-
-/**
- * @author Simon McDuff
- */
-public class CDOSavePointImpl implements CDOSavePoint
-{
- private CDOTransactionImpl transaction = null;
-
- private Map<CDOID, CDOResource> newResources = new HashMap<CDOID, CDOResource>();
-
- private Map<CDOID, CDOObject> newObjects = new HashMap<CDOID, CDOObject>();
-
- private Map<CDOID, CDORevisionImpl> baseNewObjects = new HashMap<CDOID, CDORevisionImpl>();
-
- private Map<CDOID, CDOObject> dirtyObjects = new HashMap<CDOID, CDOObject>();
-
- private ConcurrentMap<CDOID, CDORevisionDelta> revisionDeltas = new ConcurrentHashMap<CDOID, CDORevisionDelta>();
-
- private CDOSavePointImpl previousSavePoint = null;
-
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOSavePointImpl implements CDOSavePoint
+{
+ private CDOTransactionImpl transaction = null;
+
+ private Map<CDOID, CDOResource> newResources = new HashMap<CDOID, CDOResource>();
+
+ private Map<CDOID, CDOObject> newObjects = new HashMap<CDOID, CDOObject>();
+
+ private Map<CDOID, CDORevisionImpl> baseNewObjects = new HashMap<CDOID, CDORevisionImpl>();
+
+ private Map<CDOID, CDOObject> dirtyObjects = new HashMap<CDOID, CDOObject>();
+
+ private ConcurrentMap<CDOID, CDORevisionDelta> revisionDeltas = new ConcurrentHashMap<CDOID, CDORevisionDelta>();
+
+ private CDOSavePointImpl previousSavePoint = null;
+
private CDOSavePointImpl nextSavePoint = null;
-
- private boolean isDirty = false;
-
- public CDOSavePointImpl(CDOTransactionImpl transaction, CDOSavePointImpl lastSavePoint)
- {
- this.transaction = transaction;
+
+ private boolean isDirty = false;
+
+ public CDOSavePointImpl(CDOTransactionImpl transaction, CDOSavePointImpl lastSavePoint)
+ {
+ this.transaction = transaction;
this.isDirty = transaction.isDirty();
- this.previousSavePoint = lastSavePoint;
- if (this.previousSavePoint != null)
- this.previousSavePoint.setNextSavePoint(this);
- }
-
- public void clear()
- {
- newResources.clear();
- newObjects.clear();
- dirtyObjects.clear();
- revisionDeltas.clear();
- baseNewObjects.clear();
- }
-
+ this.previousSavePoint = lastSavePoint;
+ if (this.previousSavePoint != null) this.previousSavePoint.setNextSavePoint(this);
+ }
+
+ public void clear()
+ {
+ newResources.clear();
+ newObjects.clear();
+ dirtyObjects.clear();
+ revisionDeltas.clear();
+ baseNewObjects.clear();
+ }
+
public boolean isDirty()
{
return isDirty;
}
- public Map<CDOID, CDOResource> getNewResources()
- {
- return newResources;
- }
-
- public Map<CDOID, CDOObject> getNewObjects()
- {
- return newObjects;
- }
-
- public Map<CDOID, CDOObject> getDirtyObjects()
- {
- return dirtyObjects;
- }
-
- public ConcurrentMap<CDOID, CDORevisionDelta> getRevisionDeltas()
- {
- return revisionDeltas;
- }
-
-
- public Map<CDOID, CDORevisionImpl> getBaseNewObjects()
- {
- return baseNewObjects;
- }
-
- public CDOSavePointImpl getPreviousSavePoint()
- {
- return previousSavePoint;
- }
-
- public CDOSavePointImpl getNextSavePoint()
- {
- return nextSavePoint;
- }
-
- public void setPreviousSavePoint(CDOSavePointImpl previousSavePoint)
- {
- this.previousSavePoint = previousSavePoint;
- }
-
- public void setNextSavePoint(CDOSavePointImpl nextSavePoint)
- {
- this.nextSavePoint = nextSavePoint;
- }
-
- public CDOTransaction getTransaction()
- {
- return transaction;
- }
-
-}
+ public Map<CDOID, CDOResource> getNewResources()
+ {
+ return newResources;
+ }
+
+ public Map<CDOID, CDOObject> getNewObjects()
+ {
+ return newObjects;
+ }
+
+ public Map<CDOID, CDOObject> getDirtyObjects()
+ {
+ return dirtyObjects;
+ }
+
+ public ConcurrentMap<CDOID, CDORevisionDelta> getRevisionDeltas()
+ {
+ return revisionDeltas;
+ }
+
+ public Map<CDOID, CDORevisionImpl> getBaseNewObjects()
+ {
+ return baseNewObjects;
+ }
+
+ public CDOSavePointImpl getPreviousSavePoint()
+ {
+ return previousSavePoint;
+ }
+
+ public CDOSavePointImpl getNextSavePoint()
+ {
+ return nextSavePoint;
+ }
+
+ public void setPreviousSavePoint(CDOSavePointImpl previousSavePoint)
+ {
+ this.previousSavePoint = previousSavePoint;
+ }
+
+ public void setNextSavePoint(CDOSavePointImpl nextSavePoint)
+ {
+ this.nextSavePoint = nextSavePoint;
+ }
+
+ public CDOTransaction getTransaction()
+ {
+ return transaction;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index 91047c7e19..40aa6a8128 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -165,12 +165,12 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession, CD
{
return cdoidObjectFactory.createCDOIDObject(in);
}
-
+
public CDOIDObject createCDOIDObject(String in)
{
return cdoidObjectFactory.createCDOIDObject(in);
}
-
+
public boolean isDisableLegacyObjects()
{
return disableLegacyObjects;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
index de9aa6013b..9e48cd4928 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
@@ -12,7 +12,6 @@
**************************************************************************/
package org.eclipse.emf.internal.cdo;
-import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDORevisionManager;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.CDOState;
@@ -504,7 +503,7 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
{
CDOViewImpl view = (CDOViewImpl)object.cdoView();
CDOTransactionImpl transaction = view.toTransaction();
- transaction.registerFeatureDelta(object, (CDOFeatureDelta)featureDelta);
+ transaction.registerFeatureDelta(object, (CDOFeatureDelta)featureDelta);
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index 7e0652a79c..b498c60cb9 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -264,14 +264,14 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
public void rollback(boolean remote)
{
rollback(firstSavePoint, remote);
-
+
cleanUp();
}
- private Set<CDOID> rollbackTo(CDOSavePoint savePoint, boolean remote)
+ private Set<CDOID> rollbackTo(CDOSavePoint savePoint, boolean remote)
{
- Set<CDOID> newObjectsDelta = new HashSet<CDOID>();
-
+ Set<CDOID> newObjectsDelta = new HashSet<CDOID>();
+
boolean isActiveSavePoint = false;
// Start from the last savepoint and come back up to the active
@@ -303,11 +303,11 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
for (CDOObject newObject : newObjects.values())
{
((InternalCDOObject)newObject).cdoInternalSetState(CDOState.TRANSIENT);
-
+
removeObject(newObject.cdoID());
// TODO Should call detach transition : not there yet
- // TODO How to remove it from Resource?
+ // TODO How to remove it from Resource?
// CDOStateMachine.INSTANCE.detach(newObject);
}
}
@@ -334,10 +334,10 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
}
if (savePoint == itrSavePoint) isActiveSavePoint = true;
}
-
+
return newObjectsDelta;
}
-
+
private void loadSavePoint(CDOSavePoint savePoint, Set<CDOID> newObjectsDelta)
{
Map<CDOID, CDOObject> dirtyObjects = getDirtyObjects();
@@ -346,7 +346,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
Map<CDOID, CDOResource> newResources = getNewResources();
Map<CDOID, CDORevisionImpl> newBaseRevision = getBaseNewObjects();
-
+
// Reload the objects (NEW) with their base.
for (CDOID newObject : newObjectsDelta)
{
@@ -384,7 +384,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
}
dirty = ((CDOSavePointImpl)savePoint).isDirty();
}
-
+
public void rollback(CDOSavePoint savePoint, boolean remote)
{
if (savePoint == null || savePoint.getTransaction() != this)
@@ -461,7 +461,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
}
lastSavePoint = new CDOSavePointImpl(this, lastSavePoint);
-
+
return lastSavePoint;
}
@@ -496,7 +496,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
public void registerFeatureDelta(InternalCDOObject object, CDOFeatureDelta featureDelta)
{
boolean needToSaveFeatureDelta = true;
-
+
if (object.cdoState() == CDOState.NEW)
{
// Register Delta for new objects only if objectA doesn't belong to this savepoint
@@ -506,35 +506,36 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
}
else
{
- Map<CDOID, ? extends CDOObject> map = object instanceof CDOResource ? this.getLastSavePoint()
- .getNewResources() : this.getLastSavePoint().getNewObjects();
-
- needToSaveFeatureDelta = !map.containsKey(object.cdoID());
+ Map<CDOID, ? extends CDOObject> map = object instanceof CDOResource ? this.getLastSavePoint().getNewResources()
+ : this.getLastSavePoint().getNewObjects();
+
+ needToSaveFeatureDelta = !map.containsKey(object.cdoID());
}
}
-
+
if (needToSaveFeatureDelta)
{
CDORevisionDelta revisionDelta = (CDORevisionDelta)lastSavePoint.getRevisionDeltas().get(object.cdoID());
-
+
if (revisionDelta == null)
{
revisionDelta = (CDORevisionDelta)CDORevisionDeltaUtil.create(object.cdoRevision());
lastSavePoint.getRevisionDeltas().put(object.cdoID(), revisionDelta);
}
-
+
((InternalCDORevisionDelta)revisionDelta).addFeatureDelta(featureDelta);
}
-
+
for (CDOTransactionHandler handler : getHandlers())
{
handler.modifyingObject(this, object, featureDelta);
}
}
-
+
protected void fireEventRegisterDelta(InternalCDOObject object, CDOFeatureDelta featureDelta)
{
}
+
public void registerRevisionDelta(CDORevisionDelta revisionDelta)
{
lastSavePoint.getRevisionDeltas().putIfAbsent(revisionDelta.getID(), revisionDelta);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index 2b4081bef5..86e3e13010 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -562,9 +562,9 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
/**
* Turns registered objects into proxies and synchronously delivers invalidation events to registered event listeners.
* <p>
- * <b>Implementation note:</b> This implementation guarantees that exceptions from listener code don't propagate up
- * to the caller of this method. Runtime exceptions from the implementation of the {@link CDOStateMachine} are
- * propagated to the caller of this method but this should not happen in the absence of implementation errors.
+ * <b>Implementation note:</b> This implementation guarantees that exceptions from listener code don't propagate up to
+ * the caller of this method. Runtime exceptions from the implementation of the {@link CDOStateMachine} are propagated
+ * to the caller of this method but this should not happen in the absence of implementation errors.
*
* @param timeStamp
* The time stamp of the server transaction if this event was sent as a result of a successfully committed

Back to the top