diff options
author | Eike Stepper | 2009-06-12 11:11:11 +0000 |
---|---|---|
committer | Eike Stepper | 2009-06-12 11:11:11 +0000 |
commit | 42a723e6891302508fd4a8fd021515651b27460c (patch) | |
tree | de2c386c0d31ef9b5f0c940ea93ac27a369ad946 | |
parent | a3025bd9036255f9155ce048e29b8031f11c51c2 (diff) | |
download | cdo-42a723e6891302508fd4a8fd021515651b27460c.tar.gz cdo-42a723e6891302508fd4a8fd021515651b27460c.tar.xz cdo-42a723e6891302508fd4a8fd021515651b27460c.zip |
[276845] Develop A CDORevisionCache that uses the file system
https://bugs.eclipse.org/bugs/show_bug.cgi?id=276845
8 files changed, 463 insertions, 560 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/db/CDOCommonDBUtil.java b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/db/CDOCommonDBUtil.java index f210e51873..04c3684345 100644 --- a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/db/CDOCommonDBUtil.java +++ b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/db/CDOCommonDBUtil.java @@ -14,13 +14,6 @@ package org.eclipse.emf.cdo.common.db; import org.eclipse.emf.cdo.common.internal.db.cache.DBRevisionCache; import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache; -import org.eclipse.net4j.db.DBException; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.text.MessageFormat; - /** * @author Eike Stepper * @since 2.0 @@ -33,64 +26,12 @@ public final class CDOCommonDBUtil /** * Creates and returns a new JDBC-based revision cache. + * <p> + * TODO Add all config parameters! */ public static CDORevisionCache createDBCache() { DBRevisionCache cache = new DBRevisionCache(); return cache; } - - public static void mandatoryInsertUpdate(PreparedStatement preparedStatement) throws SQLException - { - insertUpdate(preparedStatement); - if (preparedStatement.getUpdateCount() == 0) - { - rollback(preparedStatement.getConnection()); - throw new DBException(MessageFormat.format("No row inserted by statement \"{0}\"", preparedStatement)); - } - } - - public static void insertUpdate(PreparedStatement preparedStatement) throws SQLException - { - if (preparedStatement.execute()) - { - rollback(preparedStatement.getConnection()); - throw new DBException("No result set expected"); - } - - commit(preparedStatement.getConnection()); - } - - public static void rollback(Connection connection) throws SQLException - { - assertIsNotNull(connection); - connection.rollback(); - } - - public static void commit(Connection connection) throws SQLException - { - assertIsNotNull(connection); - connection.commit(); - } - - /** - * Asserts the given {@link Connection} is not <tt>null</tt>. - * - * @param connection - * the connection to check - * @return the connection - * @throws DBException - * if the given connection's <tt>null</tt> - */ - public static Connection assertIsNotNull(Connection connection) - { - if (connection == null) - { - throw new DBException("connection is null!"); - } - else - { - return connection; - } - } } diff --git a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/AbstractPreparedStatementFactory.java b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/AbstractPreparedStatementFactory.java index 08f149f8f8..41f4ccf4e3 100644 --- a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/AbstractPreparedStatementFactory.java +++ b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/AbstractPreparedStatementFactory.java @@ -12,7 +12,10 @@ package org.eclipse.emf.cdo.common.internal.db; import org.eclipse.emf.cdo.common.internal.db.bundle.OM; +import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; +import org.eclipse.net4j.db.DBUtil; +import org.eclipse.net4j.util.CheckUtil; import org.eclipse.net4j.util.om.trace.ContextTracer; import java.sql.Connection; @@ -22,51 +25,49 @@ import java.sql.SQLException; /** * @author Andre Dietisheim */ -public abstract class AbstractPreparedStatementFactory<T> implements IPreparedStatementFactory<T> +public abstract class AbstractPreparedStatementFactory implements IPreparedStatementFactory { private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, AbstractPreparedStatementFactory.class); private PreparedStatement preparedStatement; - protected PreparedStatement getPreparedStatement(Connection connection) throws SQLException + public AbstractPreparedStatementFactory() { - if (preparedStatement == null || preparedStatement.getConnection() == null - || preparedStatement.getConnection().isClosed() || !preparedStatement.getConnection().equals(connection)) - { - preparedStatement = createPreparedStatement(getSqlStatement(), connection); - } - return preparedStatement; } - public void close() + public PreparedStatement getPreparedStatement(InternalCDORevision revision, Connection connection) throws Exception { - if (preparedStatement != null) - { - try - { - preparedStatement.close(); - } - catch (SQLException ex) - { - TRACER.format("Exception occured while closing preparedStatement \"{0}\"", getSqlStatement()); - } - } + PreparedStatement preparedStatement = getPreparedStatement(connection); + setParameters(revision, preparedStatement); + TRACER.trace(getSQL()); + return preparedStatement; } - private PreparedStatement createPreparedStatement(String sql, Connection connection) throws SQLException + public void close() { - return connection.prepareStatement(sql); + DBUtil.close(preparedStatement); } - public PreparedStatement getPreparedStatement(T t, Connection connection) throws Exception + protected synchronized PreparedStatement getPreparedStatement(Connection connection) throws SQLException { - PreparedStatement preparedStatement = getPreparedStatement(connection); - doSetParameters(t, preparedStatement); - TRACER.trace(getSqlStatement()); + if (preparedStatement == null) + { + preparedStatement = createPreparedStatement(getSQL(), connection); + } + else + { + CheckUtil.checkArg(preparedStatement.getConnection() == connection, "Wrong connection"); + } + return preparedStatement; } - protected abstract String getSqlStatement(); + protected abstract String getSQL(); - protected abstract void doSetParameters(T t, PreparedStatement preparedStatement) throws Exception; + protected abstract void setParameters(InternalCDORevision revision, PreparedStatement statement) throws Exception; + + private PreparedStatement createPreparedStatement(String sql, Connection connection) throws SQLException + { + return connection.prepareStatement(sql); + } } diff --git a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/DBRevisionCacheUtil.java b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/DBRevisionCacheUtil.java index f91afacef2..f5a9e2b583 100644 --- a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/DBRevisionCacheUtil.java +++ b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/DBRevisionCacheUtil.java @@ -20,11 +20,48 @@ import org.eclipse.net4j.util.CheckUtil; import org.eclipse.emf.ecore.EStructuralFeature; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.MessageFormat; + /** * @author Andre Dietisheim */ public class DBRevisionCacheUtil { + public static void mandatoryInsertUpdate(PreparedStatement preparedStatement) throws SQLException + { + insertUpdate(preparedStatement); + if (preparedStatement.getUpdateCount() == 0) + { + rollback(preparedStatement.getConnection()); + throw new SQLException(MessageFormat.format("No row inserted by statement \"{0}\"", preparedStatement)); + } + } + + public static void insertUpdate(PreparedStatement preparedStatement) throws SQLException + { + if (preparedStatement.execute()) + { + rollback(preparedStatement.getConnection()); + throw new SQLException("No result set expected"); + } + + commit(preparedStatement.getConnection()); + } + + public static void rollback(Connection connection) throws SQLException + { + CheckUtil.checkArg(connection, "connection"); + connection.rollback(); + } + + public static void commit(Connection connection) throws SQLException + { + CheckUtil.checkArg(connection, "connection"); + connection.commit(); + } /** * Asserts the given {@link CDORevision} is <tt>null</tt>. @@ -36,11 +73,11 @@ public class DBRevisionCacheUtil * @throws DBException * if the given CDORevision's not <tt>null</tt> */ - public static void assertIsNull(CDORevision cdoRevision, String message) + public static void assertIsNull(CDORevision cdoRevision, String message) throws SQLException { if (cdoRevision != null) { - throw new DBException(message); + throw new SQLException(message); } } @@ -50,13 +87,14 @@ public class DBRevisionCacheUtil * @param revision * the revision * @return the resource node name + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=279817 */ // TODO: this should be refactored and put in a place, that's more generic // than this class. The same snippet's used in LRURevisionCache and // MemRevisionCache public static String getResourceNodeName(CDORevision revision) { - CheckUtil.checkArg(revision.isResourceNode(), "the revision is not a resource node!"); + CheckUtil.checkArg(revision.isResourceNode(), "The revision is not a resource node!"); EStructuralFeature feature = revision.getEClass().getEStructuralFeature( CDOModelConstants.RESOURCE_NODE_NAME_ATTRIBUTE); return (String)((InternalCDORevision)revision).getValue(feature); diff --git a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/IPreparedStatementFactory.java b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/IPreparedStatementFactory.java index e9d995912c..47fe35c87a 100644 --- a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/IPreparedStatementFactory.java +++ b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/IPreparedStatementFactory.java @@ -11,16 +11,17 @@ **************************************************************************/ package org.eclipse.emf.cdo.common.internal.db; +import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; + import java.sql.Connection; import java.sql.PreparedStatement; /** * @author Andre Dietisheim */ -public interface IPreparedStatementFactory<T> +public interface IPreparedStatementFactory { - PreparedStatement getPreparedStatement(T t, Connection connection) throws Exception; - - void close(); + public PreparedStatement getPreparedStatement(InternalCDORevision revision, Connection connection) throws Exception; + public void close(); } diff --git a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java index 97b609f1ee..e25d71705c 100644 --- a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java +++ b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java @@ -11,14 +11,12 @@ **************************************************************************/ package org.eclipse.emf.cdo.common.internal.db.cache; -import org.eclipse.emf.cdo.common.db.CDOCommonDBUtil; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory; import org.eclipse.emf.cdo.common.id.CDOIDProvider; import org.eclipse.emf.cdo.common.internal.db.AbstractPreparedStatementFactory; import org.eclipse.emf.cdo.common.internal.db.DBRevisionCacheUtil; import org.eclipse.emf.cdo.common.internal.db.IPreparedStatementFactory; -import org.eclipse.emf.cdo.common.internal.db.bundle.OM; import org.eclipse.emf.cdo.common.io.CDODataInput; import org.eclipse.emf.cdo.common.io.CDODataOutput; import org.eclipse.emf.cdo.common.model.CDOPackageRegistry; @@ -36,15 +34,13 @@ import org.eclipse.net4j.db.IDBAdapter; import org.eclipse.net4j.db.IDBConnectionProvider; import org.eclipse.net4j.db.IDBRowHandler; import org.eclipse.net4j.util.CheckUtil; +import org.eclipse.net4j.util.WrappedException; import org.eclipse.net4j.util.io.ExtendedDataInputStream; import org.eclipse.net4j.util.io.ExtendedDataOutputStream; import org.eclipse.net4j.util.lifecycle.Lifecycle; -import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.emf.ecore.EClass; -import javax.sql.DataSource; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -62,291 +58,119 @@ import java.util.List; */ public class DBRevisionCache extends Lifecycle implements CDORevisionCache { + private CDOIDObjectFactory idObjectFactory; + + private CDOIDProvider idProvider; - /** The Constant DB_REVISIONCACHE_NAME. */ - private static final String DB_REVISIONCACHE_NAME = "org.eclipse.emf.cdo.common.db.DBRevisionCache"; + private CDOListFactory listFactory; - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DBRevisionCache.class); + private CDOPackageRegistry packageRegistry; - /** The data source. */ - private DataSource dataSource; + private CDORevisionResolver revisionResolver; - /** The db adapter. */ private IDBAdapter dbAdapter; - /** The db connection provider. */ private IDBConnectionProvider dbConnectionProvider; - /** The cdo id provider. */ - private CDOIDProvider cdoIdProvider; - - /** The prepared statement used to insert new revisions. */ - private IPreparedStatementFactory<InternalCDORevision> insertRevisionStatementFactory; + /** + * The prepared statement used to insert new revisions. + */ + private IPreparedStatementFactory insertRevisionStatementFactory = new InsertRevisionStatementFactory(); /** * The prepared statement used to update the revised timestamp in the latest revision. */ - private IPreparedStatementFactory<InternalCDORevision> updateRevisedStatementFactory; + private IPreparedStatementFactory updateRevisedStatementFactory = new UpdateRevisedStatementFactory(); - /** The prepared statement used to delete a revision. */ - private IPreparedStatementFactory<InternalCDORevision> deleteRevisionStatementFactory; + /** + * The prepared statement used to delete a revision. + */ + private IPreparedStatementFactory deleteRevisionStatementFactory = new DeleteRevisionStatementFactory(); - /** The prepared statement used to delete all entries. */ - private IPreparedStatementFactory<InternalCDORevision> clearStatementFactory; + /** + * The prepared statement used to delete all entries. + */ + private IPreparedStatementFactory clearStatementFactory = new ClearStatementFactory(); - /** The database connection used in this cache. */ + /** + * The database connection used in this cache. + */ private Connection connection; - protected CDOIDObjectFactory cdoIdObjectFactory; - - private CDOListFactory cdoListFactory; - - private CDOPackageRegistry cdoPackageRegistry; - - private CDORevisionResolver cdoRevisionResolver; - - private class InsertRevisionStatementFactory extends AbstractPreparedStatementFactory<InternalCDORevision> + public DBRevisionCache() { - @Override - protected void doSetParameters(InternalCDORevision cdoRevision, PreparedStatement preparedStatement) - throws Exception - { - preparedStatement.setString(1, cdoRevision.getID().toURIFragment()); - preparedStatement.setInt(2, cdoRevision.getVersion()); - preparedStatement.setLong(3, cdoRevision.getCreated()); - preparedStatement.setLong(4, cdoRevision.getRevised()); - preparedStatement.setBytes(5, toBytes(cdoRevision)); - setResourceNodeValues(cdoRevision, preparedStatement); - } - - private void setResourceNodeValues(InternalCDORevision cdoRevision, PreparedStatement preparedStatement) - throws SQLException - { - if (cdoRevision.isResourceNode()) - { - preparedStatement.setString(6, DBRevisionCacheUtil.getResourceNodeName(cdoRevision)); - CDOID containerID = (CDOID)cdoRevision.getContainerID(); - preparedStatement.setString(7, containerID.toURIFragment()); - } - else - { - preparedStatement.setNull(6, Types.VARCHAR); - preparedStatement.setNull(7, Types.INTEGER); - } - } - - @Override - protected String getSqlStatement() - { - return "INSERT INTO " + DBRevisionCacheSchema.REVISIONS // - + " (" // - + DBRevisionCacheSchema.REVISIONS_ID // - + ", " + DBRevisionCacheSchema.REVISIONS_VERSION // - + ", " + DBRevisionCacheSchema.REVISIONS_CREATED // - + ", " + DBRevisionCacheSchema.REVISIONS_REVISED // - + ", " + DBRevisionCacheSchema.REVISIONS_CDOREVISION // - + ", " + DBRevisionCacheSchema.REVISIONS_RESOURCENODENAME // - + ", " + DBRevisionCacheSchema.REVISIONS_CONTAINERID // - + ") " // - + " VALUES (?, ?, ?, ?, ?, ? ,?)"; - } } - private class UpdateRevisedStatementFactory extends AbstractPreparedStatementFactory<InternalCDORevision> + public CDOIDObjectFactory getIDObjectFactory() { - - @Override - protected String getSqlStatement() - { - - return "UPDATE " + DBRevisionCacheSchema.REVISIONS // - + " SET " + DBRevisionCacheSchema.REVISIONS_REVISED + " = ?" // - + " WHERE " + DBRevisionCacheSchema.REVISIONS_ID + " = ?" // - + " AND " + DBRevisionCacheSchema.REVISIONS_VERSION + " = ?"; - } - - @Override - protected void doSetParameters(InternalCDORevision cdoRevision, PreparedStatement preparedStatement) - throws Exception - { - preparedStatement.setLong(1, cdoRevision.getCreated() - 1); - preparedStatement.setString(2, cdoRevision.getID().toURIFragment()); - preparedStatement.setInt(3, cdoRevision.getVersion() - 1); - } + return idObjectFactory; } - private class DeleteRevisionStatementFactory extends AbstractPreparedStatementFactory<InternalCDORevision> + public void setIDObjectFactory(CDOIDObjectFactory idObjectFactory) { - @Override - protected void doSetParameters(InternalCDORevision cdoRevision, PreparedStatement preparedStatement) - throws Exception - { - preparedStatement.setString(1, cdoRevision.getID().toURIFragment()); - preparedStatement.setInt(2, cdoRevision.getVersion()); - } + this.idObjectFactory = idObjectFactory; + } - @Override - protected String getSqlStatement() - { - return "DELETE FROM " + DBRevisionCacheSchema.REVISIONS // - + " WHERE " // - + " ID = ?" // - + " AND VERSION = ?"; - } + public CDOIDProvider getIdProvider() + { + return idProvider; } - private class ClearStatementFactory extends AbstractPreparedStatementFactory<InternalCDORevision> + public void setIdProvider(CDOIDProvider idProvider) { - @Override - protected String getSqlStatement() - { - return "DELETE FROM " // - + DBRevisionCacheSchema.REVISIONS; // - } + this.idProvider = idProvider; + } - @Override - protected void doSetParameters(InternalCDORevision t, PreparedStatement preparedStatement) throws Exception - { - } + public CDOListFactory getListFactory() + { + return listFactory; } - /** - * Do before activate. - * - * @throws Exception - * the exception - */ - @Override - protected void doBeforeActivate() throws Exception + public void setListFactory(CDOListFactory listFactory) { - super.doBeforeActivate(); - checkState(dataSource, "dataSource is null!"); //$NON-NLS-1$ - checkState(dbAdapter, "dbAdapter is null!"); //$NON-NLS-1$ - checkState(cdoIdProvider, "cdoIDProvider is null!"); //$NON-NLS-1$ - checkState(cdoIdObjectFactory, "cdoIdObjectFactory is null!"); //$NON-NLS-1$ - checkState(cdoListFactory, "cdoListFactory is null!"); //$NON-NLS-1$ - checkState(cdoPackageRegistry, "cdoPackageRegistry is null!"); //$NON-NLS-1$ - checkState(cdoRevisionResolver, "cdoRevisionResolver is null!"); //$NON-NLS-1$ + this.listFactory = listFactory; } - /** - * Do activate. - * - * @throws Exception - * the exception - */ - @Override - protected void doActivate() throws Exception + public CDOPackageRegistry getPackageRegistry() { - super.doActivate(); + return packageRegistry; + } - insertRevisionStatementFactory = new InsertRevisionStatementFactory(); - updateRevisedStatementFactory = new UpdateRevisedStatementFactory(); - deleteRevisionStatementFactory = new DeleteRevisionStatementFactory(); - clearStatementFactory = new ClearStatementFactory(); + public void setPackageRegistry(CDOPackageRegistry packageRegistry) + { + this.packageRegistry = packageRegistry; + } - dbConnectionProvider = createDBConnectionProvider(); - createTable(); + public CDORevisionResolver getRevisionResolver() + { + return revisionResolver; } - /** - * Do deactivate. - * - * @throws Exception - * the exception - */ - @Override - protected void doDeactivate() throws Exception + public void setRevisionResolver(CDORevisionResolver revisionResolver) { - try - { - updateRevisedStatementFactory.close(); - updateRevisedStatementFactory = null; - insertRevisionStatementFactory.close(); - insertRevisionStatementFactory = null; - deleteRevisionStatementFactory.close(); - deleteRevisionStatementFactory = null; - } - finally - { - DBUtil.close(connection); - connection = null; - } - super.doDeactivate(); + this.revisionResolver = revisionResolver; } - /** - * Creates the table. - * - * @throws SQLException - * the SQL exception - */ - private void createTable() throws SQLException + public IDBAdapter getDBAdapter() { - Connection connection = getConnection(); - DBRevisionCacheSchema.INSTANCE.create(dbAdapter, connection); - CDOCommonDBUtil.commit(connection); + return dbAdapter; } - /** - * Adds a given revision to this cache. It furthermore updates the revised timestamp of the latest (before inserting - * the new one) revision - * - * @param revision - * the revision to add to this cache - * @return true, if successful - */ - public boolean addRevision(InternalCDORevision revision) + public void setDBAdapter(IDBAdapter dbAdapter) { - try - { - CDOCommonDBUtil.mandatoryInsertUpdate(insertRevisionStatementFactory.getPreparedStatement(revision, - getConnection())); - if (revision.getVersion() > 1) - { - // update former latest revision - CDOCommonDBUtil.insertUpdate(updateRevisedStatementFactory.getPreparedStatement(revision, getConnection())); - } + this.dbAdapter = dbAdapter; + } - return true; - } - catch (DBException ex) - { - throw ex; - } - catch (Exception ex) - { - throw new DBException(ex); - } + public IDBConnectionProvider getDBConnectionProvider() + { + return dbConnectionProvider; } - /** - * Clear. - */ - public void clear() + public void setDBConnectionProvider(IDBConnectionProvider dbConnectionProvider) { - try - { - CDOCommonDBUtil.insertUpdate(clearStatementFactory.getPreparedStatement(null, getConnection())); - clearStatementFactory.getPreparedStatement(null, getConnection()).executeUpdate(); - } - catch (DBException ex) - { - throw ex; - } - catch (Exception ex) - { - throw new DBException(ex); - } + this.dbConnectionProvider = dbConnectionProvider; } - /** - * Gets the object type. - * - * @param id - * the id - * @return the object type - */ public EClass getObjectType(CDOID id) { return null; @@ -354,7 +178,7 @@ public class DBRevisionCache extends Lifecycle implements CDORevisionCache /** * Gets the {@link CDOID} of a resource within this cache. The resource is picked if it matches the given folderID, - * name and timestamp + * name and timestamp TODO Use prepared statement! * * @param folderID * the folder id @@ -366,30 +190,29 @@ public class DBRevisionCache extends Lifecycle implements CDORevisionCache */ public CDOID getResourceID(CDOID folderID, String name, long timeStamp) { - - StringBuilder sb = new StringBuilder(); - sb.append(DBRevisionCacheSchema.REVISIONS_ID).append(" = ")// - .append(folderID.toURIFragment()); // - sb.append(" AND "); - appendTimestampCondition(timeStamp, sb); - sb.append(" AND "); - sb.append(DBRevisionCacheSchema.REVISIONS_RESOURCENODENAME) // - .append(" = ").append("'").append(name).append("'"); - - InternalCDORevision cdoRevision = selectCDORevision(sb.toString()); - - if (cdoRevision != null) - { - return cdoRevision.getID(); - } - else + StringBuilder builder = new StringBuilder(); + builder.append(DBRevisionCacheSchema.REVISIONS_ID); + builder.append("="); + builder.append(folderID.toURIFragment()); + builder.append(" AND "); + appendTimestampCondition(builder, timeStamp); + builder.append(" AND "); + builder.append(DBRevisionCacheSchema.REVISIONS_RESOURCENODE_NAME); + builder.append("='"); + builder.append(name); + builder.append("'"); + + InternalCDORevision revision = selectRevision(builder.toString()); + if (revision == null) { return null; } + + return revision.getID(); } /** - * Gets the revision with the highest version for a given {@link CDOID}. + * Gets the revision with the highest version for a given {@link CDOID}. TODO Use prepared statement! * * @param id * the id @@ -397,17 +220,20 @@ public class DBRevisionCache extends Lifecycle implements CDORevisionCache */ public InternalCDORevision getRevision(CDOID id) { - StringBuilder sb = new StringBuilder(); - sb.append("id = ").append(id.toURIFragment()); - sb.append(" AND "); - sb.append(DBRevisionCacheSchema.REVISIONS_REVISED).append("=").append(CDORevision.UNSPECIFIED_DATE); - return selectCDORevision(sb.toString()); - + StringBuilder builder = new StringBuilder(); + builder.append(DBRevisionCacheSchema.REVISIONS_ID); + builder.append("="); + builder.append(id.toURIFragment()); + builder.append(" AND "); + builder.append(DBRevisionCacheSchema.REVISIONS_REVISED); + builder.append("="); + builder.append(CDORevision.UNSPECIFIED_DATE); + return selectRevision(builder.toString()); } /** * Gets an {@link InternalCDORevision} that matches the given timestamp (it is >= created timestamp AND <= revised - * timestamp of the revision). + * timestamp of the revision). TODO Use prepared statement! * * @param id * the id @@ -417,127 +243,93 @@ public class DBRevisionCache extends Lifecycle implements CDORevisionCache */ public InternalCDORevision getRevisionByTime(CDOID id, long timeStamp) { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(DBRevisionCacheSchema.REVISIONS_ID).append(" = ").append(id.toURIFragment()); - stringBuilder.append(" AND "); - appendTimestampCondition(timeStamp, stringBuilder); - - return selectCDORevision(stringBuilder.toString()); + StringBuilder builder = new StringBuilder(); + builder.append(DBRevisionCacheSchema.REVISIONS_ID); + builder.append("="); + builder.append(id.toURIFragment()); + builder.append(" AND "); + appendTimestampCondition(builder, timeStamp); + return selectRevision(builder.toString()); } - public static StringBuilder appendTimestampCondition(long timeStamp, StringBuilder stringBuilder) + /** + * TODO Use prepared statement! + */ + public InternalCDORevision getRevisionByVersion(CDOID id, int version) { - stringBuilder.append(DBRevisionCacheSchema.REVISIONS_CREATED); - stringBuilder.append(" <= "); - stringBuilder.append(timeStamp); - stringBuilder.append(" AND"); - stringBuilder.append(" ( "); - stringBuilder.append(DBRevisionCacheSchema.REVISIONS_REVISED); - stringBuilder.append(" >= "); - stringBuilder.append(timeStamp); - stringBuilder.append(" OR " + DBRevisionCacheSchema.REVISIONS_REVISED); - stringBuilder.append(" = " + CDORevision.UNSPECIFIED_DATE); - stringBuilder.append(" )"); - return stringBuilder; - } - - private InternalCDORevision selectCDORevision(String sql) - { - final InternalCDORevision[] cdoRevisionArray = new InternalCDORevision[1]; - IDBRowHandler rowHandler = new IDBRowHandler() - { - public boolean handle(int row, final Object... values) - { - try - { - DBRevisionCacheUtil.assertIsNull(cdoRevisionArray[0], - "database inconsistent: there's more than 1 revision with the same id and timestamp!"); - cdoRevisionArray[0] = toCDORevision(values[0], values[1]); - } - catch (IOException ex) - { - TRACER.format("error reading CDORevision from database \"{0}\"!", ex); - } - return true; - } - }; - - DBUtil.select(connection// - , rowHandler // - , sql // - , DBRevisionCacheSchema.REVISIONS_CDOREVISION // - , DBRevisionCacheSchema.REVISIONS_REVISED); - return cdoRevisionArray[0]; + StringBuilder builder = new StringBuilder(); + builder.append(DBRevisionCacheSchema.REVISIONS_ID); + builder.append("="); + builder.append(id.toURIFragment()); + builder.append(" AND "); + builder.append(DBRevisionCacheSchema.REVISIONS_REVISED); + builder.append("="); + builder.append(CDORevision.UNSPECIFIED_DATE); + return selectRevision(builder.toString()); } /** - * Gets the revision by version. + * Gets the latest revisions of all persisted model versions. * - * @param id - * the id - * @param version - * the version - * @return the revision by version + * @return the revisions */ - public InternalCDORevision getRevisionByVersion(CDOID id, int version) + public List<CDORevision> getRevisions() { - final InternalCDORevision[] cdoRevisionArray = new InternalCDORevision[1]; + final List<CDORevision> result = new ArrayList<CDORevision>(); IDBRowHandler rowHandler = new IDBRowHandler() { public boolean handle(int row, final Object... values) { try { - DBRevisionCacheUtil.assertIsNull(cdoRevisionArray[0], - "database inconsistent: there's more than 1 revision with the same version!"); - cdoRevisionArray[0] = toCDORevision(values[0], values[1]); + byte[] blob = (byte[])values[0]; + result.add(toRevision(blob)); + return true; } catch (IOException ex) { - TRACER.format("error reading CDORevision from database \"{0}\"!", ex); + throw WrappedException.wrap(ex); } - return true; } }; - String uriFragment = id.toURIFragment(); - DBUtil.select(getConnection() // + DBUtil.select(connection // , rowHandler // - , "id = " + uriFragment + " AND VERSION = " + version // - , DBRevisionCacheSchema.REVISIONS_CDOREVISION // - , DBRevisionCacheSchema.REVISIONS_REVISED); - return cdoRevisionArray[0]; + , DBRevisionCacheSchema.REVISIONS_REVISED + "=" + CDORevision.UNSPECIFIED_DATE // + , DBRevisionCacheSchema.REVISIONS_CDOREVISION); + return result; } /** - * Gets the latest revisions of all persisted model versions. + * Adds a given revision to this cache. It furthermore updates the revised timestamp of the latest (before inserting + * the new one) revision * - * @return the revisions + * @param revision + * the revision to add to this cache + * @return true, if successful */ - public List<CDORevision> getRevisions() + public boolean addRevision(InternalCDORevision revision) { - final List<CDORevision> cdoRevisionList = new ArrayList<CDORevision>(); - IDBRowHandler rowHandler = new IDBRowHandler() + try { - public boolean handle(int row, final Object... values) + PreparedStatement stmt = insertRevisionStatementFactory.getPreparedStatement(revision, connection); + DBRevisionCacheUtil.mandatoryInsertUpdate(stmt); + if (revision.getVersion() > 1) { - try - { - cdoRevisionList.add(toCDORevision((byte[])values[0])); - } - catch (IOException ex) - { - TRACER.format("error reading CDORevision from database \"{0}\"!", ex); - } - return true; + // Update former latest revision + DBRevisionCacheUtil.insertUpdate(updateRevisedStatementFactory.getPreparedStatement(revision, connection)); } - }; - DBUtil.select(getConnection() // - , rowHandler // - , DBRevisionCacheSchema.REVISIONS_REVISED + " = " + CDORevision.UNSPECIFIED_DATE // - , DBRevisionCacheSchema.REVISIONS_CDOREVISION); - return cdoRevisionList; + return true; + } + catch (DBException ex) + { + throw ex; + } + catch (Exception ex) + { + throw new DBException(ex); + } } /** @@ -554,13 +346,14 @@ public class DBRevisionCache extends Lifecycle implements CDORevisionCache { try { - InternalCDORevision cdoRevision = getRevisionByVersion(id, version); - if (cdoRevision != null) + InternalCDORevision revision = getRevisionByVersion(id, version); + if (revision != null) { - CDOCommonDBUtil.mandatoryInsertUpdate(deleteRevisionStatementFactory.getPreparedStatement(cdoRevision, - getConnection())); + PreparedStatement stmt = deleteRevisionStatementFactory.getPreparedStatement(revision, connection); + DBRevisionCacheUtil.mandatoryInsertUpdate(stmt); } - return cdoRevision; + + return revision; } catch (DBException ex) { @@ -572,44 +365,123 @@ public class DBRevisionCache extends Lifecycle implements CDORevisionCache } } - /** - * Creates a {@link IDBConnectionProvider} - * - * @return the {@link IDBConnectionProvider} - */ - private IDBConnectionProvider createDBConnectionProvider() + public void clear() { - return DBUtil.createConnectionProvider(dataSource); + try + { + PreparedStatement stmt = clearStatementFactory.getPreparedStatement(null, connection); + DBRevisionCacheUtil.insertUpdate(stmt); + stmt.executeUpdate(); + } + catch (DBException ex) + { + throw ex; + } + catch (Exception ex) + { + throw new DBException(ex); + } } - /** - * Gets the {@link Connection}. If a connection was already created in a earlyer call, this connection is reused, - * Otherwise a new one is created - * - * @return the connection - * @throws DBException - * if an error occured while trying to create a connection - */ - protected Connection getConnection() + @Override + protected void doBeforeActivate() throws Exception + { + super.doBeforeActivate(); + checkState(idObjectFactory, "idObjectFactory"); //$NON-NLS-1$ + checkState(idProvider, "idProvider"); //$NON-NLS-1$ + checkState(listFactory, "listFactory"); //$NON-NLS-1$ + checkState(packageRegistry, "packageRegistry"); //$NON-NLS-1$ + checkState(revisionResolver, "revisionResolver"); //$NON-NLS-1$ + checkState(dbAdapter, "dbAdapter"); //$NON-NLS-1$ + checkState(dbConnectionProvider, "dbConnectionProvider"); //$NON-NLS-1$ + } + + @Override + protected void doActivate() throws Exception + { + super.doActivate(); + connection = dbConnectionProvider.getConnection(); + connection.setAutoCommit(false); + createTable(); + } + + @Override + protected void doDeactivate() throws Exception { try { - if (connection == null || connection.isClosed()) - { - connection = CDOCommonDBUtil.assertIsNotNull(dbConnectionProvider.getConnection()); - connection.setAutoCommit(false); - } - return connection; + updateRevisedStatementFactory.close(); + updateRevisedStatementFactory = null; + + insertRevisionStatementFactory.close(); + insertRevisionStatementFactory = null; + deleteRevisionStatementFactory.close(); + deleteRevisionStatementFactory = null; } - catch (SQLException ex) + finally { - throw new DBException(ex); + DBUtil.close(connection); + connection = null; } + + super.doDeactivate(); + } + + private void createTable() throws SQLException + { + DBRevisionCacheSchema.INSTANCE.create(dbAdapter, connection); + DBRevisionCacheUtil.commit(connection); + } + + public static StringBuilder appendTimestampCondition(StringBuilder builder, long timeStamp) + { + builder.append(DBRevisionCacheSchema.REVISIONS_CREATED); + builder.append("<="); + builder.append(timeStamp); + builder.append(" AND"); + builder.append(" ("); + builder.append(DBRevisionCacheSchema.REVISIONS_REVISED); + builder.append(">="); + builder.append(timeStamp); + builder.append(" OR " + DBRevisionCacheSchema.REVISIONS_REVISED); + builder.append("=" + CDORevision.UNSPECIFIED_DATE); + builder.append(")"); + return builder; + } + + private InternalCDORevision selectRevision(String sql) + { + final InternalCDORevision[] result = new InternalCDORevision[1]; + IDBRowHandler rowHandler = new IDBRowHandler() + { + public boolean handle(int row, final Object... values) + { + try + { + CheckUtil.checkState(result[0], "Database inconsistent: There is more than 1 revision satisfying the query"); + byte[] revisionBlob = (byte[])values[0]; + long revisedTimestamp = (Long)values[1]; + result[0] = toRevision(revisionBlob, revisedTimestamp); + return true; + } + catch (IOException ex) + { + throw WrappedException.wrap(ex); + } + } + }; + + DBUtil.select(connection// + , rowHandler // + , sql // + , DBRevisionCacheSchema.REVISIONS_CDOREVISION // + , DBRevisionCacheSchema.REVISIONS_REVISED); + return result[0]; } /** - * Converts a given {@link CDORevision} to an array of bytes + * Converts a given {@link CDORevision revision} to an array of bytes. * * @param revision * the revision @@ -619,17 +491,17 @@ public class DBRevisionCache extends Lifecycle implements CDORevisionCache */ private byte[] toBytes(CDORevision revision) throws IOException { - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - CDODataOutput cdoDataOutput = new CDODataOutputImpl(ExtendedDataOutputStream.wrap(byteArrayOutputStream)) + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + CDODataOutput out = new CDODataOutputImpl(ExtendedDataOutputStream.wrap(baos)) { public CDOIDProvider getIDProvider() { - return cdoIdProvider; + return idProvider; } }; - cdoDataOutput.writeCDORevision(revision, CDORevision.UNCHUNKED); - return byteArrayOutputStream.toByteArray(); + out.writeCDORevision(revision, CDORevision.UNCHUNKED); + return baos.toByteArray(); } /** @@ -638,115 +510,160 @@ public class DBRevisionCache extends Lifecycle implements CDORevisionCache * latest revision gets a new revised timestamp. This timestamp's only updated in the database column 'revised', not * in the blob that holds the serialized instance. Therefore the revised timestamp has to be set separately * - * @param revisedTimestampObject + * @param revisedTimestamp * the value - * @param cdoInstanceData + * @param blob * the cdo instance data * @return the internal cdo revision * @throws IOException * Signals that an I/O exception has occurred. */ - private InternalCDORevision toCDORevision(Object cdoInstanceData, Object revisedTimestampObject) throws IOException + private InternalCDORevision toRevision(byte[] blob, long revisedTimestamp) throws IOException { - CheckUtil.checkArg(cdoInstanceData instanceof byte[], "cdoInstanceDataArray is not of type byte[]"); - InternalCDORevision cdoRevision = toCDORevision((byte[])cdoInstanceData); - CheckUtil.checkArg(revisedTimestampObject instanceof Long, "revisedTimestampObject ins not of type Long"); - // revised timestamp's updated in the revised column only (not in the - // blob) - cdoRevision.setRevised((Long)revisedTimestampObject); - return cdoRevision; + InternalCDORevision revision = toRevision(blob); + // Revised timestamp's updated in the revised column only (not in the blob) + revision.setRevised(revisedTimestamp); + return revision; } /** * Converts a given byteArray to a CDORevision * - * @param byteArray + * @param blob * the byte array * @return the cDO revision * @throws IOException * Signals that an I/O exception has occurred. */ - private InternalCDORevision toCDORevision(byte[] byteArray) throws IOException + private InternalCDORevision toRevision(byte[] blob) throws IOException { - CDODataInput cdoDataInput = new CDODataInputImpl(ExtendedDataInputStream.wrap(new ByteArrayInputStream(byteArray))) + CDODataInput in = new CDODataInputImpl(ExtendedDataInputStream.wrap(new ByteArrayInputStream(blob))) { @Override protected CDOIDObjectFactory getIDFactory() { - return cdoIdObjectFactory; + return idObjectFactory; } @Override protected CDOListFactory getListFactory() { - return cdoListFactory; + return listFactory; } @Override protected CDOPackageRegistry getPackageRegistry() { - return cdoPackageRegistry; + return packageRegistry; } @Override protected CDORevisionResolver getRevisionResolver() { - return cdoRevisionResolver; + return revisionResolver; } }; - return (InternalCDORevision)cdoDataInput.readCDORevision(); - } - /** - * Sets the cDOID provider. - * - * @param cdoIDProvider - * the new cDOID provider - */ - public void setCDOIDProvider(CDOIDProvider cdoIDProvider) - { - cdoIdProvider = cdoIDProvider; + return (InternalCDORevision)in.readCDORevision(); } - public void setCdoIdObjectFactory(CDOIDObjectFactory cdoIdObjectFactory) + private class InsertRevisionStatementFactory extends AbstractPreparedStatementFactory { - this.cdoIdObjectFactory = cdoIdObjectFactory; - } + @Override + protected String getSQL() + { + return "INSERT INTO " + DBRevisionCacheSchema.REVISIONS // + + " (" // + + DBRevisionCacheSchema.REVISIONS_ID // + + ", " + DBRevisionCacheSchema.REVISIONS_VERSION // + + ", " + DBRevisionCacheSchema.REVISIONS_CREATED // + + ", " + DBRevisionCacheSchema.REVISIONS_REVISED // + + ", " + DBRevisionCacheSchema.REVISIONS_CDOREVISION // + + ", " + DBRevisionCacheSchema.REVISIONS_RESOURCENODE_NAME // + + ", " + DBRevisionCacheSchema.REVISIONS_CONTAINERID // + + ") " // + + " VALUES (?, ?, ?, ?, ?, ? ,?)"; + } - public void setCdoListFactory(CDOListFactory cdoListFactory) - { - this.cdoListFactory = cdoListFactory; - } + @Override + protected void setParameters(InternalCDORevision revision, PreparedStatement preparedStatement) throws Exception + { + preparedStatement.setString(1, revision.getID().toURIFragment()); + preparedStatement.setInt(2, revision.getVersion()); + preparedStatement.setLong(3, revision.getCreated()); + preparedStatement.setLong(4, revision.getRevised()); + preparedStatement.setBytes(5, toBytes(revision)); + setResourceNodeValues(revision, preparedStatement); + } - public void setCdoPackageRegistry(CDOPackageRegistry cdoPackageRegistry) - { - this.cdoPackageRegistry = cdoPackageRegistry; + private void setResourceNodeValues(InternalCDORevision revision, PreparedStatement preparedStatement) + throws SQLException + { + if (revision.isResourceNode()) + { + preparedStatement.setString(6, DBRevisionCacheUtil.getResourceNodeName(revision)); + CDOID containerID = (CDOID)revision.getContainerID(); + preparedStatement.setString(7, containerID.toURIFragment()); + } + else + { + preparedStatement.setNull(6, Types.VARCHAR); + preparedStatement.setNull(7, Types.INTEGER); + } + } } - public void setCdoRevisionResolver(CDORevisionResolver cdoRevisionResolver) + private class UpdateRevisedStatementFactory extends AbstractPreparedStatementFactory { - this.cdoRevisionResolver = cdoRevisionResolver; + @Override + protected String getSQL() + { + return "UPDATE " + DBRevisionCacheSchema.REVISIONS // + + " SET " + DBRevisionCacheSchema.REVISIONS_REVISED + " = ?" // + + " WHERE " + DBRevisionCacheSchema.REVISIONS_ID + " = ?" // + + " AND " + DBRevisionCacheSchema.REVISIONS_VERSION + " = ?"; + } + + @Override + protected void setParameters(InternalCDORevision revision, PreparedStatement preparedStatement) throws Exception + { + preparedStatement.setLong(1, revision.getCreated() - 1); + preparedStatement.setString(2, revision.getID().toURIFragment()); + preparedStatement.setInt(3, revision.getVersion() - 1); + } } - /** - * Sets the data source. - * - * @param dataSource - * the new data source - */ - public void setDataSource(DataSource dataSource) + private class DeleteRevisionStatementFactory extends AbstractPreparedStatementFactory { - this.dataSource = dataSource; + @Override + protected String getSQL() + { + return "DELETE FROM " + DBRevisionCacheSchema.REVISIONS // + + " WHERE " // + + " ID = ?" // + + " AND VERSION = ?"; + } + + @Override + protected void setParameters(InternalCDORevision revision, PreparedStatement preparedStatement) throws Exception + { + preparedStatement.setString(1, revision.getID().toURIFragment()); + preparedStatement.setInt(2, revision.getVersion()); + } } - /** - * Sets the dB adapter. - * - * @param dbAdapter - * the new dB adapter - */ - public void setDBAdapter(IDBAdapter dbAdapter) + private class ClearStatementFactory extends AbstractPreparedStatementFactory { - this.dbAdapter = dbAdapter; + @Override + protected String getSQL() + { + return "DELETE FROM " // + + DBRevisionCacheSchema.REVISIONS; // + } + + @Override + protected void setParameters(InternalCDORevision revision, PreparedStatement preparedStatement) throws Exception + { + } } } diff --git a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCacheSchema.java b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCacheSchema.java index 36c5052439..a966197c0d 100644 --- a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCacheSchema.java +++ b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCacheSchema.java @@ -25,24 +25,17 @@ public class DBRevisionCacheSchema extends DBSchema public static final DBRevisionCacheSchema INSTANCE = new DBRevisionCacheSchema(); /** - * DBTable dbrevisioncache_revisions + * DBTable dbrevisioncache_revisions. + * <p> + * TODO Make name configurable! */ public static final IDBTable REVISIONS = INSTANCE.addTable("dbrevisioncache_revisions"); public static final IDBField REVISIONS_ID = // - REVISIONS.addField("id", DBType.BIGINT); - - public static final IDBIndex INDEX_REVISIONS_ID = // - REVISIONS.addIndex(IDBIndex.Type.NON_UNIQUE, REVISIONS_ID); + REVISIONS.addField("id", DBType.VARCHAR, 254); public static final IDBField REVISIONS_VERSION = // - REVISIONS.addField("version", DBType.BIGINT); - - public static final IDBIndex INDEX_REVISIONS_VERSION = // - REVISIONS.addIndex(IDBIndex.Type.NON_UNIQUE, REVISIONS_VERSION); - - public static final IDBIndex INDEX_REVISIONS_PK = // - REVISIONS.addIndex(IDBIndex.Type.PRIMARY_KEY, REVISIONS_ID, REVISIONS_VERSION); + REVISIONS.addField("version", DBType.INTEGER); public static final IDBField REVISIONS_CREATED = // REVISIONS.addField("created", DBType.BIGINT); @@ -51,23 +44,32 @@ public class DBRevisionCacheSchema extends DBSchema REVISIONS.addField("revised", DBType.BIGINT); public static final IDBField REVISIONS_CDOREVISION = // - REVISIONS.addField("cdorevision", DBType.BLOB); + REVISIONS.addField("revision", DBType.BLOB); - public static final IDBField REVISIONS_RESOURCENODENAME = // + public static final IDBField REVISIONS_RESOURCENODE_NAME = // REVISIONS.addField("resourcenode_name", DBType.VARCHAR, false); - public static final IDBIndex INDEX_REVISIONS_RESOURCENODENAME = // - REVISIONS.addIndex(IDBIndex.Type.NON_UNIQUE, REVISIONS_RESOURCENODENAME); - public static final IDBField REVISIONS_CONTAINERID = // REVISIONS.addField("container_id", DBType.BIGINT, false); + public static final IDBIndex INDEX_REVISIONS_RESOURCENODENAME = // + REVISIONS.addIndex(IDBIndex.Type.NON_UNIQUE, REVISIONS_RESOURCENODE_NAME); + + public static final IDBIndex INDEX_REVISIONS_ID = // + REVISIONS.addIndex(IDBIndex.Type.NON_UNIQUE, REVISIONS_ID); + + public static final IDBIndex INDEX_REVISIONS_VERSION = // + REVISIONS.addIndex(IDBIndex.Type.NON_UNIQUE, REVISIONS_VERSION); + + public static final IDBIndex INDEX_REVISIONS_PK = // + REVISIONS.addIndex(IDBIndex.Type.PRIMARY_KEY, REVISIONS_ID, REVISIONS_VERSION); + public static final IDBIndex INDEX_REVISIONS_CONTAINERID = // REVISIONS.addIndex(IDBIndex.Type.NON_UNIQUE, REVISIONS_CONTAINERID); private DBRevisionCacheSchema() { - super("dbRevisionCache"); + super("DBRevisionCache"); } static diff --git a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF index c04034f617..9a5c10e602 100644 --- a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF @@ -26,7 +26,11 @@ Export-Package: org.eclipse.emf.cdo.common;version="2.0.0", org.eclipse.emf.cdo.internal.common;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server", org.eclipse.emf.cdo.internal.common.bundle;version="2.0.0";x-internal:=true, org.eclipse.emf.cdo.internal.common.id;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server", - org.eclipse.emf.cdo.internal.common.io;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server", + org.eclipse.emf.cdo.internal.common.io;version="2.0.0"; + x-friends:="org.eclipse.emf.cdo.tests, + org.eclipse.emf.cdo, + org.eclipse.emf.cdo.server, + org.eclipse.emf.cdo.common.db", org.eclipse.emf.cdo.internal.common.messages;version="2.0.0";x-internal:=true, org.eclipse.emf.cdo.internal.common.model;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server", org.eclipse.emf.cdo.internal.common.protocol;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server", diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java index 5aafc3499b..2246a036cc 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java @@ -4,7 +4,7 @@ * 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 */ @@ -23,7 +23,6 @@ import java.util.List; /** * @author Eike Stepper - * @noimplement This interface is not intended to be implemented by clients. * @since 2.0 */ public interface CDORevisionCache extends INotifier.Introspection |