summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-05 16:04:32 (EDT)
committerEike Stepper2007-08-05 16:04:32 (EDT)
commite53c3d418dd145956d264ebd51f481aebf8fc9df (patch)
treea7f9805c967ca56ec11dc4775f02e112e5e3f9c9
parent4522f90cd0163d67fa32a4d393f2bd3ce5503937 (diff)
downloadcdo-e53c3d418dd145956d264ebd51f481aebf8fc9df.zip
cdo-e53c3d418dd145956d264ebd51f481aebf8fc9df.tar.gz
cdo-e53c3d418dd145956d264ebd51f481aebf8fc9df.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBStoreManager.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBTransaction.java60
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java60
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryPackageManager.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java81
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/AbstractQueryOperation.java33
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/AddPackageOperation.java41
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/LoadPackageOperation.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/NOOPStore.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/QueryObjectTypeOperation.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/Store.java32
11 files changed, 303 insertions, 168 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBStoreManager.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBStoreManager.java
deleted file mode 100644
index 8f480dd..0000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBStoreManager.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.emf.cdo.server.internal.db;
-
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.internal.db.DBStoreManager;
-
-import javax.sql.DataSource;
-
-import java.sql.Connection;
-
-/**
- * @author Eike Stepper
- */
-public class CDODBStoreManager extends DBStoreManager<CDODBTransaction>
-{
- public CDODBStoreManager(IDBAdapter dbAdapter, DataSource dataSource)
- {
- super(CDODBSchema.INSTANCE, dbAdapter, dataSource);
- }
-
- @Override
- protected CDODBTransaction createTransaction(Connection connection)
- {
- return new CDODBTransaction(this, connection);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBTransaction.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBTransaction.java
deleted file mode 100644
index dc7e5e1..0000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBTransaction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.emf.cdo.server.internal.db;
-
-import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
-import org.eclipse.emf.cdo.protocol.CDOID;
-import org.eclipse.emf.cdo.server.ITransaction;
-
-import org.eclipse.net4j.internal.db.DBStoreTransaction;
-import org.eclipse.net4j.util.transaction.IStoreManager;
-import org.eclipse.net4j.util.transaction.IStoreTransaction;
-
-import java.sql.Connection;
-
-/**
- * @author Eike Stepper
- */
-public class CDODBTransaction extends DBStoreTransaction implements ITransaction
-{
- public CDODBTransaction(IStoreManager<? extends IStoreTransaction> storeManager, Connection connection)
- {
- super(storeManager, connection);
- }
-
- public void registerResource(CDOID id, String path)
- {
- }
-
- public CDOID getResourceID(String path)
- {
- return null;
- }
-
- public String getResourcePath(CDOID id)
- {
- return null;
- }
-
- public void addRevision(CDORevisionImpl revision)
- {
- }
-
- public CDORevisionImpl getRevision(CDOID id)
- {
- return null;
- }
-
- public CDORevisionImpl getRevision(CDOID id, long timeStamp)
- {
- return null;
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index 7d8de06..433e2ab 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -10,27 +10,36 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.db;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
+import org.eclipse.emf.cdo.internal.server.RepositoryPackageManager;
import org.eclipse.emf.cdo.internal.server.RevisionManager;
+import org.eclipse.emf.cdo.internal.server.store.AddPackageOperation;
import org.eclipse.emf.cdo.internal.server.store.AddRevisionOperation;
import org.eclipse.emf.cdo.internal.server.store.LoadHistoricalRevisionOperation;
+import org.eclipse.emf.cdo.internal.server.store.LoadPackageOperation;
import org.eclipse.emf.cdo.internal.server.store.LoadResourceIDOperation;
import org.eclipse.emf.cdo.internal.server.store.LoadResourcePathOperation;
import org.eclipse.emf.cdo.internal.server.store.LoadRevisionOperation;
+import org.eclipse.emf.cdo.internal.server.store.QueryObjectTypeOperation;
import org.eclipse.emf.cdo.internal.server.store.RegisterResourceOperation;
import org.eclipse.emf.cdo.internal.server.store.Store;
import org.eclipse.emf.cdo.protocol.CDOID;
+import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBTransaction;
import org.eclipse.net4j.util.transaction.ITransaction;
import javax.sql.DataSource;
+import java.sql.Connection;
import java.util.Map;
/**
* @author Eike Stepper
*/
+@SuppressWarnings("unused")
public class DBStore extends Store
{
private static final String TYPE = "db";
@@ -49,6 +58,36 @@ public class DBStore extends Store
}
@Override
+ protected AddPackageOperation createAddPackageOperation(RepositoryPackageManager packageManager,
+ CDOPackageImpl cdoPackage)
+ {
+ return new AddPackageOperation(packageManager, cdoPackage)
+ {
+ @Override
+ protected void update(ITransaction transaction, CDOPackageImpl cdoPackage)
+ {
+ Connection connection = ((IDBTransaction)transaction).getConnection();
+ // TODO Implement method .createAddPackageOperation()
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+ };
+ }
+
+ @Override
+ protected LoadPackageOperation createLoadPackageOperation(CDOPackageImpl cdoPackage)
+ {
+ return new LoadPackageOperation(cdoPackage)
+ {
+ @Override
+ protected void queryAndFill(ITransaction transaction, CDOPackageImpl cdoPackage)
+ {
+ // TODO Implement method .createLoadPackageOperation()
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+ };
+ }
+
+ @Override
protected AddRevisionOperation createAddRevisionOperation(RevisionManager revisionManager, CDORevisionImpl revision)
{
return new AddRevisionOperation(revisionManager, revision)
@@ -56,6 +95,7 @@ public class DBStore extends Store
@Override
protected void update(ITransaction transaction, CDORevisionImpl revision)
{
+ Connection connection = ((IDBTransaction)transaction).getConnection();
// TODO Implement method .update()
throw new UnsupportedOperationException("Not yet implemented");
}
@@ -70,6 +110,7 @@ public class DBStore extends Store
@Override
protected CDORevisionImpl query(ITransaction transaction, CDOID id) throws Exception
{
+ Connection connection = ((IDBTransaction)transaction).getConnection();
// TODO Implement method .query()
throw new UnsupportedOperationException("Not yet implemented");
}
@@ -84,6 +125,7 @@ public class DBStore extends Store
@Override
protected CDORevisionImpl query(ITransaction transaction, CDOID id, long timeStamp) throws Exception
{
+ Connection connection = ((IDBTransaction)transaction).getConnection();
// TODO Implement method .query()
throw new UnsupportedOperationException("Not yet implemented");
}
@@ -99,6 +141,7 @@ public class DBStore extends Store
@Override
protected void update(ITransaction transaction, CDOID id, String path)
{
+ Connection connection = ((IDBTransaction)transaction).getConnection();
// TODO Implement method .update()
throw new UnsupportedOperationException("Not yet implemented");
}
@@ -113,6 +156,7 @@ public class DBStore extends Store
@Override
protected CDOID query(ITransaction transaction, String path) throws Exception
{
+ Connection connection = ((IDBTransaction)transaction).getConnection();
// TODO Implement method .query()
throw new UnsupportedOperationException("Not yet implemented");
}
@@ -127,6 +171,22 @@ public class DBStore extends Store
@Override
protected String query(ITransaction transaction, CDOID id) throws Exception
{
+ Connection connection = ((IDBTransaction)transaction).getConnection();
+ // TODO Implement method .query()
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+ };
+ }
+
+ @Override
+ protected QueryObjectTypeOperation createQueryObjectTypeOperation(CDOID id)
+ {
+ return new QueryObjectTypeOperation(id)
+ {
+ @Override
+ protected CDOClassRef query(ITransaction transaction, CDOID id) throws Exception
+ {
+ Connection connection = ((IDBTransaction)transaction).getConnection();
// TODO Implement method .query()
throw new UnsupportedOperationException("Not yet implemented");
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryPackageManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryPackageManager.java
index 39634e6..2e5265c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryPackageManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryPackageManager.java
@@ -43,14 +43,18 @@ public class RepositoryPackageManager extends CDOPackageManagerImpl
cdoPackage.setMetaIDRange(newRange);
}
+ repository.getStore().addPackage(this, cdoPackage);
+ }
+
+ public void addPackageToCache(CDOPackageImpl cdoPackage)
+ {
super.addPackage(cdoPackage);
}
@Override
protected void resolve(CDOPackageImpl cdoPackage)
{
- // TODO Implement method RepositoryPackageManager.resolve()
- throw new UnsupportedOperationException("Not yet implemented");
+ repository.getStore().loadPackage(cdoPackage);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
index 69abb60..c24cdd1 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
@@ -25,6 +25,7 @@ import org.eclipse.emf.cdo.protocol.CDOProtocolConstants;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+import org.eclipse.net4j.util.io.IORuntimeException;
import java.io.IOException;
import java.util.HashMap;
@@ -59,12 +60,51 @@ public class CommitTransactionIndication extends CDOServerIndication
}
@Override
- protected void indicating(ExtendedDataInputStream in) throws IOException
+ protected void indicating(final ExtendedDataInputStream in) throws IOException
{
- addNewPackages(in);
- newResources = readNewResources(in);
- newObjects = readNewObjects(in);
- dirtyObjects = readDirtyObjects(in);
+ timeStamp = System.currentTimeMillis();
+
+ transact(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ addNewPackages(in);
+ newResources = readNewResources(in);
+ newObjects = readNewObjects(in);
+ dirtyObjects = readDirtyObjects(in);
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+
+ addRevisions(newResources);
+ addRevisions(newObjects);
+ addRevisions(dirtyObjects);
+ }
+ });
+
+ }
+
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
+ {
+ out.writeLong(timeStamp);
+ if (newPackages != null)
+ {
+ for (CDOPackageImpl newPackage : newPackages)
+ {
+ CDOIDRangeImpl.write(out, newPackage.getMetaIDRange());
+ }
+ }
+
+ writeIDMappings(out);
+ if (dirtyObjects.length > 0)
+ {
+ getSessionManager().notifyInvalidation(timeStamp, dirtyObjects, getSession());
+ }
}
private void addNewPackages(ExtendedDataInputStream in) throws IOException
@@ -146,37 +186,6 @@ public class CommitTransactionIndication extends CDOServerIndication
return revisions;
}
- @Override
- protected void responding(ExtendedDataOutputStream out) throws IOException
- {
- timeStamp = System.currentTimeMillis();
- out.writeLong(timeStamp);
-
- transact(new Runnable()
- {
- public void run()
- {
- addRevisions(newResources);
- addRevisions(newObjects);
- addRevisions(dirtyObjects);
- }
- });
-
- if (newPackages != null)
- {
- for (CDOPackageImpl newPackage : newPackages)
- {
- CDOIDRangeImpl.write(out, newPackage.getMetaIDRange());
- }
- }
-
- writeIDMappings(out);
- if (dirtyObjects.length > 0)
- {
- getSessionManager().notifyInvalidation(timeStamp, dirtyObjects, getSession());
- }
- }
-
private void addRevisions(CDORevisionImpl[] revisions)
{
RevisionManager revisionManager = getRevisionManager();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/AbstractQueryOperation.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/AbstractQueryOperation.java
deleted file mode 100644
index b18936b..0000000
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/AbstractQueryOperation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.emf.cdo.internal.server.store;
-
-import org.eclipse.net4j.util.transaction.ITransaction;
-import org.eclipse.net4j.util.transaction.ITransactionalOperation;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractQueryOperation<T extends ITransaction, RESULT, PARAMETER> implements
- ITransactionalOperation<T, RESULT>
-{
- private PARAMETER parameter;
-
- public AbstractQueryOperation(PARAMETER parameter)
- {
- this.parameter = parameter;
- }
-
- public RESULT prepare(T transaction) throws Exception
- {
- return query(transaction, parameter);
- }
-
- public void onCommit(T transaction)
- {
- }
-
- public void onRollback(T transaction)
- {
- }
-
- protected abstract RESULT query(T transaction, PARAMETER parameter);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/AddPackageOperation.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/AddPackageOperation.java
new file mode 100644
index 0000000..bd844aa
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/AddPackageOperation.java
@@ -0,0 +1,41 @@
+package org.eclipse.emf.cdo.internal.server.store;
+
+import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
+import org.eclipse.emf.cdo.internal.server.RepositoryPackageManager;
+
+import org.eclipse.net4j.util.transaction.ITransaction;
+import org.eclipse.net4j.util.transaction.ITransactionalOperation;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AddPackageOperation<T extends ITransaction> implements ITransactionalOperation<T, Object>
+{
+ private RepositoryPackageManager packageManager;
+
+ private CDOPackageImpl cdoPackage;
+
+ public AddPackageOperation(RepositoryPackageManager packageManager, CDOPackageImpl cdoPackage)
+ {
+ this.packageManager = packageManager;
+ this.cdoPackage = cdoPackage;
+ }
+
+ public Object prepare(T transaction) throws Exception
+ {
+ update(transaction, cdoPackage);
+ packageManager.addPackageToCache(cdoPackage);
+ return null;
+ }
+
+ public void onCommit(T transaction)
+ {
+ }
+
+ public void onRollback(T transaction)
+ {
+ packageManager.removePackage(cdoPackage);
+ }
+
+ protected abstract void update(T transaction, CDOPackageImpl cdoPackage);
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/LoadPackageOperation.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/LoadPackageOperation.java
new file mode 100644
index 0000000..18c8b4a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/LoadPackageOperation.java
@@ -0,0 +1,35 @@
+package org.eclipse.emf.cdo.internal.server.store;
+
+import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
+
+import org.eclipse.net4j.util.transaction.ITransaction;
+import org.eclipse.net4j.util.transaction.ITransactionalOperation;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class LoadPackageOperation<T extends ITransaction> implements ITransactionalOperation<T, Object>
+{
+ private CDOPackageImpl cdoPackage;
+
+ public LoadPackageOperation(CDOPackageImpl cdoPackage)
+ {
+ this.cdoPackage = cdoPackage;
+ }
+
+ public Object prepare(T transaction) throws Exception
+ {
+ queryAndFill(transaction, cdoPackage);
+ return null;
+ }
+
+ public void onCommit(T transaction)
+ {
+ }
+
+ public void onRollback(T transaction)
+ {
+ }
+
+ protected abstract void queryAndFill(T transaction, CDOPackageImpl cdoPackage);
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/NOOPStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/NOOPStore.java
index 21fdc2a..213f9ac 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/NOOPStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/NOOPStore.java
@@ -10,9 +10,12 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.server.store;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
+import org.eclipse.emf.cdo.internal.server.RepositoryPackageManager;
import org.eclipse.emf.cdo.internal.server.RevisionManager;
import org.eclipse.emf.cdo.protocol.CDOID;
+import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
import org.eclipse.net4j.util.transaction.ITransaction;
import org.eclipse.net4j.util.transaction.TransactionUtil;
@@ -37,6 +40,35 @@ public class NOOPStore extends Store
}
@Override
+ protected AddPackageOperation createAddPackageOperation(RepositoryPackageManager packageManager,
+ CDOPackageImpl cdoPackage)
+ {
+ return new AddPackageOperation(packageManager, cdoPackage)
+ {
+ @Override
+ protected void update(ITransaction transaction, CDOPackageImpl cdoPackage)
+ {
+ // TODO Implement method .createAddPackageOperation()
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+ };
+ }
+
+ @Override
+ protected LoadPackageOperation createLoadPackageOperation(CDOPackageImpl cdoPackage)
+ {
+ return new LoadPackageOperation(cdoPackage)
+ {
+ @Override
+ protected void queryAndFill(ITransaction transaction, CDOPackageImpl cdoPackage)
+ {
+ // TODO Implement method .createLoadPackageOperation()
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+ };
+ }
+
+ @Override
protected AddRevisionOperation createAddRevisionOperation(RevisionManager revisionManager, CDORevisionImpl revision)
{
return new AddRevisionOperation(revisionManager, revision)
@@ -44,6 +76,8 @@ public class NOOPStore extends Store
@Override
protected void update(ITransaction transaction, CDORevisionImpl revision)
{
+ // TODO Implement method .update()
+ throw new UnsupportedOperationException("Not yet implemented");
}
};
}
@@ -85,6 +119,8 @@ public class NOOPStore extends Store
@Override
protected void update(ITransaction transaction, CDOID id, String path)
{
+ // TODO Implement method .createRegisterResourceOperation()
+ throw new UnsupportedOperationException("Not yet implemented");
}
};
}
@@ -116,4 +152,18 @@ public class NOOPStore extends Store
}
};
}
+
+ @Override
+ protected QueryObjectTypeOperation createQueryObjectTypeOperation(CDOID id)
+ {
+ return new QueryObjectTypeOperation(id)
+ {
+ @Override
+ protected CDOClassRef query(ITransaction transaction, CDOID id) throws Exception
+ {
+ // TODO Implement method .query()
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+ };
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/QueryObjectTypeOperation.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/QueryObjectTypeOperation.java
new file mode 100644
index 0000000..29bbf83
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/QueryObjectTypeOperation.java
@@ -0,0 +1,36 @@
+package org.eclipse.emf.cdo.internal.server.store;
+
+import org.eclipse.emf.cdo.protocol.CDOID;
+import org.eclipse.emf.cdo.protocol.model.CDOClassRef;
+
+import org.eclipse.net4j.util.transaction.ITransaction;
+import org.eclipse.net4j.util.transaction.ITransactionalOperation;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class QueryObjectTypeOperation<T extends ITransaction> implements
+ ITransactionalOperation<T, CDOClassRef>
+{
+ private CDOID id;
+
+ public QueryObjectTypeOperation(CDOID id)
+ {
+ this.id = id;
+ }
+
+ public CDOClassRef prepare(T transaction) throws Exception
+ {
+ return query(transaction, id);
+ }
+
+ public void onCommit(T transaction)
+ {
+ }
+
+ public void onRollback(T transaction)
+ {
+ }
+
+ protected abstract CDOClassRef query(T transaction, CDOID id) throws Exception;
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/Store.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/Store.java
index 23d4de5..b6c3819 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/Store.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/store/Store.java
@@ -11,8 +11,10 @@
package org.eclipse.emf.cdo.internal.server.store;
import org.eclipse.emf.cdo.internal.protocol.model.CDOClassRefImpl;
+import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.server.Repository;
+import org.eclipse.emf.cdo.internal.server.RepositoryPackageManager;
import org.eclipse.emf.cdo.internal.server.RevisionManager;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.protocol.CDOID;
@@ -89,6 +91,26 @@ public abstract class Store implements IStore
return (String)TX.execute(createLoadResourcePathOperation(id));
}
+ public void addPackage(RepositoryPackageManager packageManager, CDOPackageImpl cdoPackage)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Adding package: {0}", cdoPackage);
+ }
+
+ TX.execute(createAddPackageOperation(packageManager, cdoPackage));
+ }
+
+ public void loadPackage(CDOPackageImpl cdoPackage)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Loading package: {0}", cdoPackage);
+ }
+
+ TX.execute(createLoadPackageOperation(cdoPackage));
+ }
+
public void addRevision(RevisionManager revisionManager, CDORevisionImpl revision)
{
if (TRACER.isEnabled())
@@ -126,8 +148,7 @@ public abstract class Store implements IStore
TRACER.format("Querying object type: {0}", id);
}
- // TODO Implement method Store.queryObjectType()
- throw new UnsupportedOperationException("Not yet implemented");
+ return (CDOClassRefImpl)TX.execute(createQueryObjectTypeOperation(id));
}
protected abstract RegisterResourceOperation createRegisterResourceOperation(CDOID id, String path,
@@ -137,10 +158,17 @@ public abstract class Store implements IStore
protected abstract LoadResourcePathOperation createLoadResourcePathOperation(CDOID id);
+ protected abstract AddPackageOperation createAddPackageOperation(RepositoryPackageManager packageManager,
+ CDOPackageImpl cdoPackage);
+
+ protected abstract LoadPackageOperation createLoadPackageOperation(CDOPackageImpl cdoPackage);
+
protected abstract AddRevisionOperation createAddRevisionOperation(RevisionManager revisionManager,
CDORevisionImpl revision);
protected abstract LoadRevisionOperation createLoadRevisionOperation(CDOID id);
protected abstract LoadHistoricalRevisionOperation createLoadHistoricalRevisionOperation(CDOID id, long timeStamp);
+
+ protected abstract QueryObjectTypeOperation createQueryObjectTypeOperation(CDOID id);
}