diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common')
49 files changed, 3450 insertions, 3450 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractQueryResult.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractQueryResult.java index 0716feabf7..b445291abc 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractQueryResult.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractQueryResult.java @@ -1,104 +1,104 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.spi.common;
-
-import org.eclipse.emf.cdo.common.CDOCommonView;
-import org.eclipse.emf.cdo.common.util.BlockingCloseableIterator;
-import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
-import org.eclipse.emf.cdo.common.util.CDOQueryQueue;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public class AbstractQueryResult<T> implements BlockingCloseableIterator<T>
-{
- private int queryID;
-
- private CDOCommonView view;
-
- private CDOQueryInfo queryInfo;
-
- private CDOQueryQueue<Object> linkQueue = new CDOQueryQueue<Object>();
-
- private BlockingCloseableIterator<Object> queueItr = linkQueue.iterator();
-
- /**
- * @since 3.0
- */
- public AbstractQueryResult(CDOCommonView view, CDOQueryInfo queryInfo, int queryID)
- {
- this.queryID = queryID;
- this.view = view;
- this.queryInfo = queryInfo;
- }
-
- /**
- * @since 3.0
- */
- public CDOQueryInfo getQueryInfo()
- {
- return queryInfo;
- }
-
- public CDOQueryQueue<Object> getQueue()
- {
- return linkQueue;
- }
-
- public CDOCommonView getView()
- {
- return view;
- }
-
- public int getQueryID()
- {
- return queryID;
- }
-
- public void setQueryID(int queryID)
- {
- this.queryID = queryID;
- }
-
- @SuppressWarnings("unchecked")
- public T peek()
- {
- return (T)queueItr.peek();
- }
-
- public boolean hasNext()
- {
- return queueItr.hasNext();
- }
-
- @SuppressWarnings("unchecked")
- public T next()
- {
- return (T)queueItr.next();
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
-
- public void close()
- {
- queueItr.close();
- }
-
- public boolean isClosed()
- {
- return queueItr.isClosed();
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Simon McDuff - initial API and implementation + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.spi.common; + +import org.eclipse.emf.cdo.common.CDOCommonView; +import org.eclipse.emf.cdo.common.util.BlockingCloseableIterator; +import org.eclipse.emf.cdo.common.util.CDOQueryInfo; +import org.eclipse.emf.cdo.common.util.CDOQueryQueue; + +/** + * @author Simon McDuff + * @since 2.0 + */ +public class AbstractQueryResult<T> implements BlockingCloseableIterator<T> +{ + private int queryID; + + private CDOCommonView view; + + private CDOQueryInfo queryInfo; + + private CDOQueryQueue<Object> linkQueue = new CDOQueryQueue<Object>(); + + private BlockingCloseableIterator<Object> queueItr = linkQueue.iterator(); + + /** + * @since 3.0 + */ + public AbstractQueryResult(CDOCommonView view, CDOQueryInfo queryInfo, int queryID) + { + this.queryID = queryID; + this.view = view; + this.queryInfo = queryInfo; + } + + /** + * @since 3.0 + */ + public CDOQueryInfo getQueryInfo() + { + return queryInfo; + } + + public CDOQueryQueue<Object> getQueue() + { + return linkQueue; + } + + public CDOCommonView getView() + { + return view; + } + + public int getQueryID() + { + return queryID; + } + + public void setQueryID(int queryID) + { + this.queryID = queryID; + } + + @SuppressWarnings("unchecked") + public T peek() + { + return (T)queueItr.peek(); + } + + public boolean hasNext() + { + return queueItr.hasNext(); + } + + @SuppressWarnings("unchecked") + public T next() + { + return (T)queueItr.next(); + } + + public void remove() + { + throw new UnsupportedOperationException(); + } + + public void close() + { + queueItr.close(); + } + + public boolean isClosed() + { + return queueItr.isClosed(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOAuthenticationResult.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOAuthenticationResult.java index 4a513e7906..02fb08a08b 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOAuthenticationResult.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOAuthenticationResult.java @@ -1,60 +1,60 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * The result of an authentication operation. Carries a userID and a crypted token.
- *
- * @author Eike Stepper
- * @since 4.0
- */
-public final class CDOAuthenticationResult implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- private String userID;
-
- private byte[] cryptedToken;
-
- public CDOAuthenticationResult(String userID, byte[] cryptedToken)
- {
- this.userID = userID;
- this.cryptedToken = cryptedToken;
- }
-
- public CDOAuthenticationResult(ExtendedDataInput in) throws IOException
- {
- userID = in.readString();
- cryptedToken = in.readByteArray();
- }
-
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeString(userID);
- out.writeByteArray(cryptedToken);
- }
-
- public String getUserID()
- {
- return userID;
- }
-
- public byte[] getCryptedToken()
- {
- return cryptedToken;
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common; + +import org.eclipse.net4j.util.io.ExtendedDataInput; +import org.eclipse.net4j.util.io.ExtendedDataOutput; + +import java.io.IOException; +import java.io.Serializable; + +/** + * The result of an authentication operation. Carries a userID and a crypted token. + * + * @author Eike Stepper + * @since 4.0 + */ +public final class CDOAuthenticationResult implements Serializable +{ + private static final long serialVersionUID = 1L; + + private String userID; + + private byte[] cryptedToken; + + public CDOAuthenticationResult(String userID, byte[] cryptedToken) + { + this.userID = userID; + this.cryptedToken = cryptedToken; + } + + public CDOAuthenticationResult(ExtendedDataInput in) throws IOException + { + userID = in.readString(); + cryptedToken = in.readByteArray(); + } + + public void write(ExtendedDataOutput out) throws IOException + { + out.writeString(userID); + out.writeByteArray(cryptedToken); + } + + public String getUserID() + { + return userID; + } + + public byte[] getCryptedToken() + { + return cryptedToken; + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOLobStoreImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOLobStoreImpl.java index 0fffa37750..3f525b10c4 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOLobStoreImpl.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOLobStoreImpl.java @@ -1,197 +1,197 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common;
-
-import org.eclipse.emf.cdo.common.lob.CDOLobInfo;
-import org.eclipse.emf.cdo.common.lob.CDOLobStore;
-
-import org.eclipse.net4j.util.HexUtil;
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.io.DigestWriter;
-import org.eclipse.net4j.util.io.ExpectedFileInputStream;
-import org.eclipse.net4j.util.io.ExpectedFileReader;
-import org.eclipse.net4j.util.io.IORuntimeException;
-import org.eclipse.net4j.util.io.IOUtil;
-import org.eclipse.net4j.util.om.OMPlatform;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.security.DigestOutputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class CDOLobStoreImpl implements CDOLobStore
-{
- public static final CDOLobStoreImpl INSTANCE = new CDOLobStoreImpl();
-
- private File folder;
-
- private int tempID;
-
- public CDOLobStoreImpl(File folder)
- {
- this.folder = folder;
- if (folder.exists())
- {
- checkDirectory();
- }
- }
-
- public CDOLobStoreImpl()
- {
- this(getDefaultFolder());
- }
-
- public File getFolder()
- {
- if (!folder.exists())
- {
- folder.mkdirs();
- }
-
- checkDirectory();
- return folder;
- }
-
- public File getBinaryFile(byte[] id)
- {
- return new File(getFolder(), HexUtil.bytesToHex(id) + ".blob");
- }
-
- public InputStream getBinary(CDOLobInfo info) throws IOException
- {
- File file = getBinaryFile(info.getID());
- long expectedSize = info.getSize();
- return new ExpectedFileInputStream(file, expectedSize);
- }
-
- public CDOLobInfo putBinary(InputStream contents) throws IOException
- {
- File tempFile = getTempFile();
- MessageDigest digest = createDigest();
- digest.update("BINARY".getBytes());
-
- FileOutputStream fos = null;
- long size;
-
- try
- {
- fos = new FileOutputStream(tempFile);
- DigestOutputStream dos = new DigestOutputStream(fos, digest);
- size = IOUtil.copyBinary(contents, dos);
- }
- finally
- {
- IOUtil.close(fos);
- }
-
- byte[] id = digest.digest();
- makePermanent(tempFile, getBinaryFile(id));
- return new CDOLobInfo(id, size);
- }
-
- public File getCharacterFile(byte[] id)
- {
- return new File(getFolder(), HexUtil.bytesToHex(id) + ".clob");
- }
-
- public Reader getCharacter(CDOLobInfo info) throws IOException
- {
- File file = getCharacterFile(info.getID());
- long expectedSize = info.getSize();
- return new ExpectedFileReader(file, expectedSize);
-
- }
-
- public CDOLobInfo putCharacter(Reader contents) throws IOException
- {
- File tempFile = getTempFile();
- MessageDigest digest = createDigest();
- digest.update("CHARACTER".getBytes());
-
- FileWriter fw = null;
- long size;
-
- try
- {
- fw = new FileWriter(tempFile);
- DigestWriter dw = new DigestWriter(fw, digest);
- size = IOUtil.copyCharacter(contents, dw);
- }
- finally
- {
- IOUtil.close(fw);
- }
-
- byte[] id = digest.digest();
- makePermanent(tempFile, getCharacterFile(id));
- return new CDOLobInfo(id, size);
- }
-
- protected MessageDigest createDigest()
- {
- try
- {
- return MessageDigest.getInstance("SHA-1");
- }
- catch (NoSuchAlgorithmException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- protected synchronized File getTempFile()
- {
- for (;;)
- {
- ++tempID;
- File file = new File(getFolder(), "contents" + tempID + ".tmp");
- if (!file.exists())
- {
- return file;
- }
- }
- }
-
- private void makePermanent(File tempFile, File file)
- {
- if (file.exists())
- {
- tempFile.delete();
- }
- else
- {
- tempFile.renameTo(file);
- }
- }
-
- private void checkDirectory()
- {
- if (!folder.isDirectory())
- {
- throw new IORuntimeException("Not a folder: " + folder.getAbsolutePath());
- }
- }
-
- private static File getDefaultFolder()
- {
- String path = OMPlatform.INSTANCE.getProperty("java.io.tmpdir");
- return new File(new File(path), "cdo_lobs");
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common; + +import org.eclipse.emf.cdo.common.lob.CDOLobInfo; +import org.eclipse.emf.cdo.common.lob.CDOLobStore; + +import org.eclipse.net4j.util.HexUtil; +import org.eclipse.net4j.util.WrappedException; +import org.eclipse.net4j.util.io.DigestWriter; +import org.eclipse.net4j.util.io.ExpectedFileInputStream; +import org.eclipse.net4j.util.io.ExpectedFileReader; +import org.eclipse.net4j.util.io.IORuntimeException; +import org.eclipse.net4j.util.io.IOUtil; +import org.eclipse.net4j.util.om.OMPlatform; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.security.DigestOutputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * @author Eike Stepper + * @since 4.0 + */ +public class CDOLobStoreImpl implements CDOLobStore +{ + public static final CDOLobStoreImpl INSTANCE = new CDOLobStoreImpl(); + + private File folder; + + private int tempID; + + public CDOLobStoreImpl(File folder) + { + this.folder = folder; + if (folder.exists()) + { + checkDirectory(); + } + } + + public CDOLobStoreImpl() + { + this(getDefaultFolder()); + } + + public File getFolder() + { + if (!folder.exists()) + { + folder.mkdirs(); + } + + checkDirectory(); + return folder; + } + + public File getBinaryFile(byte[] id) + { + return new File(getFolder(), HexUtil.bytesToHex(id) + ".blob"); + } + + public InputStream getBinary(CDOLobInfo info) throws IOException + { + File file = getBinaryFile(info.getID()); + long expectedSize = info.getSize(); + return new ExpectedFileInputStream(file, expectedSize); + } + + public CDOLobInfo putBinary(InputStream contents) throws IOException + { + File tempFile = getTempFile(); + MessageDigest digest = createDigest(); + digest.update("BINARY".getBytes()); + + FileOutputStream fos = null; + long size; + + try + { + fos = new FileOutputStream(tempFile); + DigestOutputStream dos = new DigestOutputStream(fos, digest); + size = IOUtil.copyBinary(contents, dos); + } + finally + { + IOUtil.close(fos); + } + + byte[] id = digest.digest(); + makePermanent(tempFile, getBinaryFile(id)); + return new CDOLobInfo(id, size); + } + + public File getCharacterFile(byte[] id) + { + return new File(getFolder(), HexUtil.bytesToHex(id) + ".clob"); + } + + public Reader getCharacter(CDOLobInfo info) throws IOException + { + File file = getCharacterFile(info.getID()); + long expectedSize = info.getSize(); + return new ExpectedFileReader(file, expectedSize); + + } + + public CDOLobInfo putCharacter(Reader contents) throws IOException + { + File tempFile = getTempFile(); + MessageDigest digest = createDigest(); + digest.update("CHARACTER".getBytes()); + + FileWriter fw = null; + long size; + + try + { + fw = new FileWriter(tempFile); + DigestWriter dw = new DigestWriter(fw, digest); + size = IOUtil.copyCharacter(contents, dw); + } + finally + { + IOUtil.close(fw); + } + + byte[] id = digest.digest(); + makePermanent(tempFile, getCharacterFile(id)); + return new CDOLobInfo(id, size); + } + + protected MessageDigest createDigest() + { + try + { + return MessageDigest.getInstance("SHA-1"); + } + catch (NoSuchAlgorithmException ex) + { + throw WrappedException.wrap(ex); + } + } + + protected synchronized File getTempFile() + { + for (;;) + { + ++tempID; + File file = new File(getFolder(), "contents" + tempID + ".tmp"); + if (!file.exists()) + { + return file; + } + } + } + + private void makePermanent(File tempFile, File file) + { + if (file.exists()) + { + tempFile.delete(); + } + else + { + tempFile.renameTo(file); + } + } + + private void checkDirectory() + { + if (!folder.isDirectory()) + { + throw new IORuntimeException("Not a folder: " + folder.getAbsolutePath()); + } + } + + private static File getDefaultFolder() + { + String path = OMPlatform.INSTANCE.getProperty("java.io.tmpdir"); + return new File(new File(path), "cdo_lobs"); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDORawReplicationContext.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDORawReplicationContext.java index f5d5151253..108a8963f3 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDORawReplicationContext.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDORawReplicationContext.java @@ -1,29 +1,29 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public interface CDORawReplicationContext extends CDOReplicationInfo
-{
- /**
- * @since 4.0
- */
- public void replicateRaw(CDODataInput in, OMMonitor monitor) throws IOException;
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import java.io.IOException; + +/** + * @author Eike Stepper + * @since 3.0 + */ +public interface CDORawReplicationContext extends CDOReplicationInfo +{ + /** + * @since 4.0 + */ + public void replicateRaw(CDODataInput in, OMMonitor monitor) throws IOException; +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationContext.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationContext.java index 68f9b8550e..f726abe317 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationContext.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationContext.java @@ -1,25 +1,25 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager;
-
-/**
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOReplicationContext extends CDOReplicationInfo, CDOBranchHandler, CDOCommitInfoHandler,
- IDurableLockingManager.LockArea.Handler
-{
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common; + +import org.eclipse.emf.cdo.common.branch.CDOBranchHandler; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler; +import org.eclipse.emf.cdo.common.lock.IDurableLockingManager; + +/** + * @author Eike Stepper + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface CDOReplicationContext extends CDOReplicationInfo, CDOBranchHandler, CDOCommitInfoHandler, + IDurableLockingManager.LockArea.Handler +{ +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationInfo.java index d3126aeaa9..fbecebd869 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationInfo.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationInfo.java @@ -1,29 +1,29 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- * Caspar De Groot - maintenance
- */
-package org.eclipse.emf.cdo.spi.common;
-
-/**
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOReplicationInfo
-{
- public int getLastReplicatedBranchID();
-
- public long getLastReplicatedCommitTime();
-
- /**
- * @since 4.1
- */
- public String[] getLockAreaIDs();
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + * Caspar De Groot - maintenance + */ +package org.eclipse.emf.cdo.spi.common; + +/** + * @author Eike Stepper + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface CDOReplicationInfo +{ + public int getLastReplicatedBranchID(); + + public long getLastReplicatedCommitTime(); + + /** + * @since 4.1 + */ + public String[] getLockAreaIDs(); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/CDOBranchUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/CDOBranchUtil.java index dfc206b380..dcd1cec1f9 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/CDOBranchUtil.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/CDOBranchUtil.java @@ -1,124 +1,124 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchManagerImpl;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointRangeImpl;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public final class CDOBranchUtil
-{
- private CDOBranchUtil()
- {
- }
-
- public static InternalCDOBranchManager createBranchManager()
- {
- return new CDOBranchManagerImpl();
- }
-
- public static CDOBranchPointRange createRange(CDOBranchPoint startPoint, CDOBranchPoint endPoint)
- {
- return new CDOBranchPointRangeImpl(startPoint, endPoint);
- }
-
- public static CDOBranchPoint copyBranchPoint(CDOBranchPoint source)
- {
- return source.getBranch().getPoint(source.getTimeStamp());
- }
-
- public static CDOBranchVersion copyBranchVersion(CDOBranchVersion source)
- {
- return source.getBranch().getVersion(source.getVersion());
- }
-
- public static boolean isContainedBy(CDOBranchPoint contained, CDOBranchPoint container)
- {
- CDOBranch containerBranch = container.getBranch();
- if (ObjectUtil.equals(containerBranch, contained.getBranch()))
- {
- return CDOCommonUtil.compareTimeStamps(contained.getTimeStamp(), container.getTimeStamp()) <= 0;
- }
-
- if (containerBranch == null)
- {
- return false;
- }
-
- return isContainedBy(contained, containerBranch.getBase());
- }
-
- public static CDOBranchPoint getAncestor(CDOBranchPoint point1, CDOBranchPoint point2)
- {
- if (point1.getBranch() == null)
- {
- // Must be the main branch base
- return point1;
- }
-
- if (point2.getBranch() == null)
- {
- // Must be the main branch base
- return point2;
- }
-
- CDOBranchPoint[] path1 = getPath(point1);
- CDOBranchPoint[] path2 = getPath(point2);
- for (CDOBranchPoint pathPoint1 : path1)
- {
- for (CDOBranchPoint pathPoint2 : path2)
- {
- if (ObjectUtil.equals(pathPoint1.getBranch(), pathPoint2.getBranch()))
- {
- if (CDOCommonUtil.compareTimeStamps(pathPoint1.getTimeStamp(), pathPoint2.getTimeStamp()) < 0)
- {
- return pathPoint1;
- }
-
- return pathPoint2;
- }
- }
- }
-
- // Can not happen because any two branches meet on the main branch
- return null;
- }
-
- public static CDOBranchPoint[] getPath(CDOBranchPoint point)
- {
- List<CDOBranchPoint> result = new ArrayList<CDOBranchPoint>();
- getPath(point, result);
- return result.toArray(new CDOBranchPoint[result.size()]);
- }
-
- private static void getPath(CDOBranchPoint point, List<CDOBranchPoint> result)
- {
- CDOBranch branch = point.getBranch();
- if (branch != null)
- {
- result.add(point);
- getPath(branch.getBase(), result);
- }
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.branch; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange; +import org.eclipse.emf.cdo.common.branch.CDOBranchVersion; +import org.eclipse.emf.cdo.common.util.CDOCommonUtil; +import org.eclipse.emf.cdo.internal.common.branch.CDOBranchManagerImpl; +import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointRangeImpl; + +import org.eclipse.net4j.util.ObjectUtil; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Eike Stepper + * @since 3.0 + */ +public final class CDOBranchUtil +{ + private CDOBranchUtil() + { + } + + public static InternalCDOBranchManager createBranchManager() + { + return new CDOBranchManagerImpl(); + } + + public static CDOBranchPointRange createRange(CDOBranchPoint startPoint, CDOBranchPoint endPoint) + { + return new CDOBranchPointRangeImpl(startPoint, endPoint); + } + + public static CDOBranchPoint copyBranchPoint(CDOBranchPoint source) + { + return source.getBranch().getPoint(source.getTimeStamp()); + } + + public static CDOBranchVersion copyBranchVersion(CDOBranchVersion source) + { + return source.getBranch().getVersion(source.getVersion()); + } + + public static boolean isContainedBy(CDOBranchPoint contained, CDOBranchPoint container) + { + CDOBranch containerBranch = container.getBranch(); + if (ObjectUtil.equals(containerBranch, contained.getBranch())) + { + return CDOCommonUtil.compareTimeStamps(contained.getTimeStamp(), container.getTimeStamp()) <= 0; + } + + if (containerBranch == null) + { + return false; + } + + return isContainedBy(contained, containerBranch.getBase()); + } + + public static CDOBranchPoint getAncestor(CDOBranchPoint point1, CDOBranchPoint point2) + { + if (point1.getBranch() == null) + { + // Must be the main branch base + return point1; + } + + if (point2.getBranch() == null) + { + // Must be the main branch base + return point2; + } + + CDOBranchPoint[] path1 = getPath(point1); + CDOBranchPoint[] path2 = getPath(point2); + for (CDOBranchPoint pathPoint1 : path1) + { + for (CDOBranchPoint pathPoint2 : path2) + { + if (ObjectUtil.equals(pathPoint1.getBranch(), pathPoint2.getBranch())) + { + if (CDOCommonUtil.compareTimeStamps(pathPoint1.getTimeStamp(), pathPoint2.getTimeStamp()) < 0) + { + return pathPoint1; + } + + return pathPoint2; + } + } + } + + // Can not happen because any two branches meet on the main branch + return null; + } + + public static CDOBranchPoint[] getPath(CDOBranchPoint point) + { + List<CDOBranchPoint> result = new ArrayList<CDOBranchPoint>(); + getPath(point, result); + return result.toArray(new CDOBranchPoint[result.size()]); + } + + private static void getPath(CDOBranchPoint point, List<CDOBranchPoint> result) + { + CDOBranch branch = point.getBranch(); + if (branch != null) + { + result.add(point); + getPath(branch.getBase(), result); + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranch.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranch.java index 522addc62c..066e9d3cd7 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranch.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranch.java @@ -1,46 +1,46 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOBranch extends CDOBranch
-{
- public boolean isProxy();
-
- public InternalCDOBranchManager getBranchManager();
-
- public InternalCDOBranch[] getBranches();
-
- /**
- * @since 4.0
- */
- public InternalCDOBranch[] getBranches(boolean loadOnDemand);
-
- public InternalCDOBranch getBranch(String path);
-
- public InternalCDOBranch createBranch(String name, long timeStamp);
-
- public InternalCDOBranch createBranch(String name);
-
- public BranchInfo getBranchInfo();
-
- public void setBranchInfo(String name, InternalCDOBranch baseBranch, long baseTimeStamp);
-
- public void addChild(InternalCDOBranch branch);
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.branch; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo; + +/** + * @author Eike Stepper + * @since 3.0 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface InternalCDOBranch extends CDOBranch +{ + public boolean isProxy(); + + public InternalCDOBranchManager getBranchManager(); + + public InternalCDOBranch[] getBranches(); + + /** + * @since 4.0 + */ + public InternalCDOBranch[] getBranches(boolean loadOnDemand); + + public InternalCDOBranch getBranch(String path); + + public InternalCDOBranch createBranch(String name, long timeStamp); + + public InternalCDOBranch createBranch(String name); + + public BranchInfo getBranchInfo(); + + public void setBranchInfo(String name, InternalCDOBranch baseBranch, long baseTimeStamp); + + public void addChild(InternalCDOBranch branch); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranchManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranchManager.java index 04242a6648..667d3869f5 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranchManager.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranchManager.java @@ -1,190 +1,190 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
-
-import org.eclipse.net4j.util.collection.Pair;
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOBranchManager extends CDOBranchManager, ILifecycle
-{
- public BranchLoader getBranchLoader();
-
- public void setBranchLoader(BranchLoader branchLoader);
-
- public CDOTimeProvider getTimeProvider();
-
- public void setTimeProvider(CDOTimeProvider timeProvider);
-
- /**
- * @since 4.0
- */
- public void initMainBranch(boolean local, long timestamp);
-
- public InternalCDOBranch getMainBranch();
-
- public InternalCDOBranch getBranch(int branchID);
-
- public InternalCDOBranch getBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp);
-
- public InternalCDOBranch getBranch(int id, BranchInfo branchInfo);
-
- public InternalCDOBranch getBranch(String path);
-
- public InternalCDOBranch createBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp);
-
- public void handleBranchCreated(InternalCDOBranch branch);
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public interface BranchLoader
- {
- /**
- * Passed as the branchID in {@link #createBranch(int, BranchInfo)} causes a new non-local branch to be created.
- */
- public static final int NEW_BRANCH = Integer.MAX_VALUE;
-
- /**
- * Passed as the branchID in {@link #createBranch(int, BranchInfo)} causes a new local branch to be created.
- */
- public static final int NEW_LOCAL_BRANCH = Integer.MIN_VALUE;
-
- /**
- * Creates a new branch with the given id and branch info. If the id is equal to {@link #NEW_BRANCH} the implementor
- * of this method will determine a new positive unique branch id. If the id is equal to {@link #NEW_LOCAL_BRANCH}
- * the implementor of this method will determine a new negative unique branch id, so that the new branch becomes a
- * local branch. In either case the used branch id is returned to the caller.
- *
- * @since 4.0
- */
- public Pair<Integer, Long> createBranch(int branchID, BranchInfo branchInfo);
-
- public BranchInfo loadBranch(int branchID);
-
- public SubBranchInfo[] loadSubBranches(int branchID);
-
- public int loadBranches(int startID, int endID, CDOBranchHandler branchHandler);
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static final class BranchInfo
- {
- private String name;
-
- private int baseBranchID;
-
- private long baseTimeStamp;
-
- public BranchInfo(String name, int baseBranchID, long baseTimeStamp)
- {
- this.name = name;
- this.baseBranchID = baseBranchID;
- this.baseTimeStamp = baseTimeStamp;
- }
-
- public BranchInfo(CDODataInput in) throws IOException
- {
- name = in.readString();
- baseBranchID = in.readInt();
- baseTimeStamp = in.readLong();
- }
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeString(name);
- out.writeInt(baseBranchID);
- out.writeLong(baseTimeStamp);
- }
-
- public String getName()
- {
- return name;
- }
-
- public int getBaseBranchID()
- {
- return baseBranchID;
- }
-
- public long getBaseTimeStamp()
- {
- return baseTimeStamp;
- }
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static final class SubBranchInfo
- {
- private int id;
-
- private String name;
-
- private long baseTimeStamp;
-
- public SubBranchInfo(int id, String name, long baseTimeStamp)
- {
- this.id = id;
- this.name = name;
- this.baseTimeStamp = baseTimeStamp;
- }
-
- public SubBranchInfo(CDODataInput in) throws IOException
- {
- id = in.readInt();
- name = in.readString();
- baseTimeStamp = in.readLong();
- }
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeInt(id);
- out.writeString(name);
- out.writeLong(baseTimeStamp);
- }
-
- public int getID()
- {
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public long getBaseTimeStamp()
- {
- return baseTimeStamp;
- }
- }
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.branch; + +import org.eclipse.emf.cdo.common.branch.CDOBranchHandler; +import org.eclipse.emf.cdo.common.branch.CDOBranchManager; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.util.CDOTimeProvider; +import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo; + +import org.eclipse.net4j.util.collection.Pair; +import org.eclipse.net4j.util.lifecycle.ILifecycle; + +import java.io.IOException; + +/** + * @author Eike Stepper + * @since 3.0 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface InternalCDOBranchManager extends CDOBranchManager, ILifecycle +{ + public BranchLoader getBranchLoader(); + + public void setBranchLoader(BranchLoader branchLoader); + + public CDOTimeProvider getTimeProvider(); + + public void setTimeProvider(CDOTimeProvider timeProvider); + + /** + * @since 4.0 + */ + public void initMainBranch(boolean local, long timestamp); + + public InternalCDOBranch getMainBranch(); + + public InternalCDOBranch getBranch(int branchID); + + public InternalCDOBranch getBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp); + + public InternalCDOBranch getBranch(int id, BranchInfo branchInfo); + + public InternalCDOBranch getBranch(String path); + + public InternalCDOBranch createBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp); + + public void handleBranchCreated(InternalCDOBranch branch); + + /** + * @author Eike Stepper + * @since 3.0 + */ + public interface BranchLoader + { + /** + * Passed as the branchID in {@link #createBranch(int, BranchInfo)} causes a new non-local branch to be created. + */ + public static final int NEW_BRANCH = Integer.MAX_VALUE; + + /** + * Passed as the branchID in {@link #createBranch(int, BranchInfo)} causes a new local branch to be created. + */ + public static final int NEW_LOCAL_BRANCH = Integer.MIN_VALUE; + + /** + * Creates a new branch with the given id and branch info. If the id is equal to {@link #NEW_BRANCH} the implementor + * of this method will determine a new positive unique branch id. If the id is equal to {@link #NEW_LOCAL_BRANCH} + * the implementor of this method will determine a new negative unique branch id, so that the new branch becomes a + * local branch. In either case the used branch id is returned to the caller. + * + * @since 4.0 + */ + public Pair<Integer, Long> createBranch(int branchID, BranchInfo branchInfo); + + public BranchInfo loadBranch(int branchID); + + public SubBranchInfo[] loadSubBranches(int branchID); + + public int loadBranches(int startID, int endID, CDOBranchHandler branchHandler); + + /** + * @author Eike Stepper + * @since 3.0 + */ + public static final class BranchInfo + { + private String name; + + private int baseBranchID; + + private long baseTimeStamp; + + public BranchInfo(String name, int baseBranchID, long baseTimeStamp) + { + this.name = name; + this.baseBranchID = baseBranchID; + this.baseTimeStamp = baseTimeStamp; + } + + public BranchInfo(CDODataInput in) throws IOException + { + name = in.readString(); + baseBranchID = in.readInt(); + baseTimeStamp = in.readLong(); + } + + public void write(CDODataOutput out) throws IOException + { + out.writeString(name); + out.writeInt(baseBranchID); + out.writeLong(baseTimeStamp); + } + + public String getName() + { + return name; + } + + public int getBaseBranchID() + { + return baseBranchID; + } + + public long getBaseTimeStamp() + { + return baseTimeStamp; + } + } + + /** + * @author Eike Stepper + * @since 3.0 + */ + public static final class SubBranchInfo + { + private int id; + + private String name; + + private long baseTimeStamp; + + public SubBranchInfo(int id, String name, long baseTimeStamp) + { + this.id = id; + this.name = name; + this.baseTimeStamp = baseTimeStamp; + } + + public SubBranchInfo(CDODataInput in) throws IOException + { + id = in.readInt(); + name = in.readString(); + baseTimeStamp = in.readLong(); + } + + public void write(CDODataOutput out) throws IOException + { + out.writeInt(id); + out.writeString(name); + out.writeLong(baseTimeStamp); + } + + public int getID() + { + return id; + } + + public String getName() + { + return name; + } + + public long getBaseTimeStamp() + { + return baseTimeStamp; + } + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java index 471bebd78c..90a7b475e1 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java @@ -1,15 +1,15 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- */
-
-/**
- * Common service provider interfaces and useful base implementations for dealing with branches.
- */
-package org.eclipse.emf.cdo.spi.common.branch;
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + */ + +/** + * Common service provider interfaces and useful base implementations for dealing with branches. + */ +package org.eclipse.emf.cdo.spi.common.branch; diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeKindCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeKindCache.java index 52d49f3c05..c0270669d9 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeKindCache.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeKindCache.java @@ -1,65 +1,65 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.commit;
-
-import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
-import org.eclipse.emf.cdo.common.commit.CDOChangeKindProvider;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class CDOChangeKindCache extends HashMap<CDOID, CDOChangeKind> implements CDOChangeKindProvider
-{
- private static final long serialVersionUID = 1L;
-
- public CDOChangeKindCache(CDOChangeSetData changeSetData)
- {
- List<CDOIDAndVersion> newObjects = changeSetData.getNewObjects();
- if (newObjects != null)
- {
- for (CDOIDAndVersion key : newObjects)
- {
- put(key.getID(), CDOChangeKind.NEW);
- }
- }
-
- List<CDORevisionKey> changedObjects = changeSetData.getChangedObjects();
- if (changedObjects != null)
- {
- for (CDOIDAndVersion key : changedObjects)
- {
- put(key.getID(), CDOChangeKind.CHANGED);
- }
- }
-
- List<CDOIDAndVersion> detachedObjects = changeSetData.getDetachedObjects();
- if (detachedObjects != null)
- {
- for (CDOIDAndVersion key : detachedObjects)
- {
- put(key.getID(), CDOChangeKind.DETACHED);
- }
- }
- }
-
- public CDOChangeKind getChangeKind(CDOID id)
- {
- return get(id);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.commit; + +import org.eclipse.emf.cdo.common.commit.CDOChangeKind; +import org.eclipse.emf.cdo.common.commit.CDOChangeKindProvider; +import org.eclipse.emf.cdo.common.commit.CDOChangeSetData; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; + +import java.util.HashMap; +import java.util.List; + +/** + * @author Eike Stepper + * @since 4.0 + */ +public class CDOChangeKindCache extends HashMap<CDOID, CDOChangeKind> implements CDOChangeKindProvider +{ + private static final long serialVersionUID = 1L; + + public CDOChangeKindCache(CDOChangeSetData changeSetData) + { + List<CDOIDAndVersion> newObjects = changeSetData.getNewObjects(); + if (newObjects != null) + { + for (CDOIDAndVersion key : newObjects) + { + put(key.getID(), CDOChangeKind.NEW); + } + } + + List<CDORevisionKey> changedObjects = changeSetData.getChangedObjects(); + if (changedObjects != null) + { + for (CDOIDAndVersion key : changedObjects) + { + put(key.getID(), CDOChangeKind.CHANGED); + } + } + + List<CDOIDAndVersion> detachedObjects = changeSetData.getDetachedObjects(); + if (detachedObjects != null) + { + for (CDOIDAndVersion key : detachedObjects) + { + put(key.getID(), CDOChangeKind.DETACHED); + } + } + } + + public CDOChangeKind getChangeKind(CDOID id) + { + return get(id); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetDataRevisionProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetDataRevisionProvider.java index 6c20d5d2f5..769e323140 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetDataRevisionProvider.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetDataRevisionProvider.java @@ -1,160 +1,160 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.commit;
-
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetDataProvider;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaProvider;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class CDOChangeSetDataRevisionProvider implements CDORevisionProvider, CDOChangeSetDataProvider
-{
- private static final CDOIDAndVersion DETACHED = new CDOIDAndVersion()
- {
- public CDOID getID()
- {
- return CDOID.NULL;
- }
-
- public int getVersion()
- {
- return Integer.MIN_VALUE;
- }
-
- @Override
- public String toString()
- {
- return "DETACHED";
- }
- };
-
- private CDORevisionProvider delegate;
-
- private CDOChangeSetData changeSetData;
-
- private CDORevisionProvider revisionCallback;
-
- private CDORevisionDeltaProvider revisionDeltaCallback;
-
- private Map<CDOID, CDOIDAndVersion> cachedRevisions;
-
- public CDOChangeSetDataRevisionProvider(CDORevisionProvider delegate, CDOChangeSetData changeSetData,
- CDORevisionProvider revisionCallback, CDORevisionDeltaProvider revisionDeltaCallback)
- {
- this.delegate = delegate;
- this.changeSetData = changeSetData;
- this.revisionCallback = revisionCallback;
- this.revisionDeltaCallback = revisionDeltaCallback;
- }
-
- public CDOChangeSetDataRevisionProvider(CDORevisionProvider delegate, CDOChangeSetData changeSetData)
- {
- this(delegate, changeSetData, null, null);
- }
-
- public CDOChangeSetData getChangeSetData()
- {
- return changeSetData;
- }
-
- public synchronized CDORevision getRevision(CDOID id)
- {
- if (cachedRevisions == null)
- {
- cachedRevisions = cacheRevisions();
- }
-
- CDOIDAndVersion key = cachedRevisions.get(id);
- if (key == DETACHED)
- {
- return null;
- }
-
- if (key instanceof CDORevision) // New object (eager)
- {
- return (CDORevision)key;
- }
-
- if (key instanceof CDORevisionDelta) // Changed object (eager)
- {
- CDORevisionDelta revisionDelta = (CDORevisionDelta)key;
- return applyDelta(revisionDelta);
- }
-
- if (key instanceof CDORevisionKey) // Changed object (lazy)
- {
- CDORevisionDelta revisionDelta = revisionDeltaCallback.getRevisionDelta(id);
- return applyDelta(revisionDelta);
- }
-
- if (key != null) // New object (lazy)
- {
- CDORevision revision = revisionCallback.getRevision(id);
- cachedRevisions.put(id, revision);
- return revision;
- }
-
- return delegate.getRevision(id);
- }
-
- private Map<CDOID, CDOIDAndVersion> cacheRevisions()
- {
- Map<CDOID, CDOIDAndVersion> cache = new HashMap<CDOID, CDOIDAndVersion>();
-
- for (CDOIDAndVersion key : changeSetData.getNewObjects())
- {
- if (revisionCallback == null && !(key instanceof CDORevision))
- {
- throw new IllegalStateException("No callback installed to lazily obtain revision " + key);
- }
-
- cache.put(key.getID(), key);
- }
-
- for (CDORevisionKey key : changeSetData.getChangedObjects())
- {
- if (revisionDeltaCallback == null && !(key instanceof CDORevisionDelta))
- {
- throw new IllegalStateException("No callback installed to lazily obtain revision delta " + key);
- }
-
- cache.put(key.getID(), key);
- }
-
- for (CDOIDAndVersion key : changeSetData.getDetachedObjects())
- {
- cache.put(key.getID(), DETACHED);
- }
-
- return cache;
- }
-
- private CDORevision applyDelta(CDORevisionDelta revisionDelta)
- {
- CDOID id = revisionDelta.getID();
- CDORevision changedObject = delegate.getRevision(id).copy();
- revisionDelta.apply(changedObject);
- cachedRevisions.put(id, changedObject);
- return changedObject;
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.commit; + +import org.eclipse.emf.cdo.common.commit.CDOChangeSetData; +import org.eclipse.emf.cdo.common.commit.CDOChangeSetDataProvider; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; +import org.eclipse.emf.cdo.common.revision.CDORevisionProvider; +import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaProvider; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Eike Stepper + * @since 4.0 + */ +public class CDOChangeSetDataRevisionProvider implements CDORevisionProvider, CDOChangeSetDataProvider +{ + private static final CDOIDAndVersion DETACHED = new CDOIDAndVersion() + { + public CDOID getID() + { + return CDOID.NULL; + } + + public int getVersion() + { + return Integer.MIN_VALUE; + } + + @Override + public String toString() + { + return "DETACHED"; + } + }; + + private CDORevisionProvider delegate; + + private CDOChangeSetData changeSetData; + + private CDORevisionProvider revisionCallback; + + private CDORevisionDeltaProvider revisionDeltaCallback; + + private Map<CDOID, CDOIDAndVersion> cachedRevisions; + + public CDOChangeSetDataRevisionProvider(CDORevisionProvider delegate, CDOChangeSetData changeSetData, + CDORevisionProvider revisionCallback, CDORevisionDeltaProvider revisionDeltaCallback) + { + this.delegate = delegate; + this.changeSetData = changeSetData; + this.revisionCallback = revisionCallback; + this.revisionDeltaCallback = revisionDeltaCallback; + } + + public CDOChangeSetDataRevisionProvider(CDORevisionProvider delegate, CDOChangeSetData changeSetData) + { + this(delegate, changeSetData, null, null); + } + + public CDOChangeSetData getChangeSetData() + { + return changeSetData; + } + + public synchronized CDORevision getRevision(CDOID id) + { + if (cachedRevisions == null) + { + cachedRevisions = cacheRevisions(); + } + + CDOIDAndVersion key = cachedRevisions.get(id); + if (key == DETACHED) + { + return null; + } + + if (key instanceof CDORevision) // New object (eager) + { + return (CDORevision)key; + } + + if (key instanceof CDORevisionDelta) // Changed object (eager) + { + CDORevisionDelta revisionDelta = (CDORevisionDelta)key; + return applyDelta(revisionDelta); + } + + if (key instanceof CDORevisionKey) // Changed object (lazy) + { + CDORevisionDelta revisionDelta = revisionDeltaCallback.getRevisionDelta(id); + return applyDelta(revisionDelta); + } + + if (key != null) // New object (lazy) + { + CDORevision revision = revisionCallback.getRevision(id); + cachedRevisions.put(id, revision); + return revision; + } + + return delegate.getRevision(id); + } + + private Map<CDOID, CDOIDAndVersion> cacheRevisions() + { + Map<CDOID, CDOIDAndVersion> cache = new HashMap<CDOID, CDOIDAndVersion>(); + + for (CDOIDAndVersion key : changeSetData.getNewObjects()) + { + if (revisionCallback == null && !(key instanceof CDORevision)) + { + throw new IllegalStateException("No callback installed to lazily obtain revision " + key); + } + + cache.put(key.getID(), key); + } + + for (CDORevisionKey key : changeSetData.getChangedObjects()) + { + if (revisionDeltaCallback == null && !(key instanceof CDORevisionDelta)) + { + throw new IllegalStateException("No callback installed to lazily obtain revision delta " + key); + } + + cache.put(key.getID(), key); + } + + for (CDOIDAndVersion key : changeSetData.getDetachedObjects()) + { + cache.put(key.getID(), DETACHED); + } + + return cache; + } + + private CDORevision applyDelta(CDORevisionDelta revisionDelta) + { + CDOID id = revisionDelta.getID(); + CDORevision changedObject = delegate.getRevision(id).copy(); + revisionDelta.apply(changedObject); + cachedRevisions.put(id, changedObject); + return changedObject; + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetSegment.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetSegment.java index c35dac97a6..1ce8678d3a 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetSegment.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetSegment.java @@ -1,87 +1,87 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointImpl;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import java.text.MessageFormat;
-import java.util.LinkedList;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public class CDOChangeSetSegment implements CDOBranchPoint
-{
- private CDOBranchPoint branchPoint;
-
- private long endTime;
-
- public CDOChangeSetSegment(CDOBranch branch, long timeStamp, long endTime)
- {
- branchPoint = new CDOBranchPointImpl(branch, timeStamp);
- this.endTime = endTime;
- }
-
- public CDOBranch getBranch()
- {
- return branchPoint.getBranch();
- }
-
- public long getTimeStamp()
- {
- return branchPoint.getTimeStamp();
- }
-
- public long getEndTime()
- {
- return endTime;
- }
-
- public CDOBranchPoint getEndPoint()
- {
- return getBranch().getPoint(endTime);
- }
-
- public boolean isOpenEnded()
- {
- return endTime == CDOBranchPoint.UNSPECIFIED_DATE;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("Segment[{0}, {1}, {2}]", getBranch(), getTimeStamp(), endTime); //$NON-NLS-1$
- }
-
- public static CDOChangeSetSegment[] createFrom(CDOBranchPoint startPoint, CDOBranchPoint endPoint)
- {
- LinkedList<CDOChangeSetSegment> result = new LinkedList<CDOChangeSetSegment>();
- CDOBranch startBranch = startPoint.getBranch();
- CDOBranch endBranch = endPoint.getBranch();
-
- while (!ObjectUtil.equals(startBranch, endBranch))
- {
- CDOBranchPoint base = endBranch.getBase();
- result.addFirst(new CDOChangeSetSegment(endBranch, base.getTimeStamp(), endPoint.getTimeStamp()));
- endPoint = base;
- endBranch = base.getBranch();
- }
-
- result.addFirst(new CDOChangeSetSegment(startBranch, startPoint.getTimeStamp(), endPoint.getTimeStamp()));
- return result.toArray(new CDOChangeSetSegment[result.size()]);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.commit; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointImpl; + +import org.eclipse.net4j.util.ObjectUtil; + +import java.text.MessageFormat; +import java.util.LinkedList; + +/** + * @author Eike Stepper + * @since 3.0 + * @noextend This interface is not intended to be extended by clients. + */ +public class CDOChangeSetSegment implements CDOBranchPoint +{ + private CDOBranchPoint branchPoint; + + private long endTime; + + public CDOChangeSetSegment(CDOBranch branch, long timeStamp, long endTime) + { + branchPoint = new CDOBranchPointImpl(branch, timeStamp); + this.endTime = endTime; + } + + public CDOBranch getBranch() + { + return branchPoint.getBranch(); + } + + public long getTimeStamp() + { + return branchPoint.getTimeStamp(); + } + + public long getEndTime() + { + return endTime; + } + + public CDOBranchPoint getEndPoint() + { + return getBranch().getPoint(endTime); + } + + public boolean isOpenEnded() + { + return endTime == CDOBranchPoint.UNSPECIFIED_DATE; + } + + @Override + public String toString() + { + return MessageFormat.format("Segment[{0}, {1}, {2}]", getBranch(), getTimeStamp(), endTime); //$NON-NLS-1$ + } + + public static CDOChangeSetSegment[] createFrom(CDOBranchPoint startPoint, CDOBranchPoint endPoint) + { + LinkedList<CDOChangeSetSegment> result = new LinkedList<CDOChangeSetSegment>(); + CDOBranch startBranch = startPoint.getBranch(); + CDOBranch endBranch = endPoint.getBranch(); + + while (!ObjectUtil.equals(startBranch, endBranch)) + { + CDOBranchPoint base = endBranch.getBase(); + result.addFirst(new CDOChangeSetSegment(endBranch, base.getTimeStamp(), endPoint.getTimeStamp())); + endPoint = base; + endBranch = base.getBranch(); + } + + result.addFirst(new CDOChangeSetSegment(startBranch, startPoint.getTimeStamp(), endPoint.getTimeStamp())); + return result.toArray(new CDOChangeSetSegment[result.size()]); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java index 76378f2d4a..5233c7f009 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java @@ -1,102 +1,102 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.commit;
-
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.internal.common.commit.CDOCommitInfoManagerImpl;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.PrintStream;
-import java.text.MessageFormat;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public final class CDOCommitInfoUtil
-{
- private CDOCommitInfoUtil()
- {
- }
-
- public static InternalCDOCommitInfoManager createCommitInfoManager()
- {
- return new CDOCommitInfoManagerImpl();
- }
-
- /**
- * @since 4.0
- */
- public static void dump(PrintStream out, CDOChangeSetData changeSetData)
- {
- for (CDOIDAndVersion key : changeSetData.getNewObjects())
- {
- out.println(" + " + key);
- if (key instanceof InternalCDORevision)
- {
- InternalCDORevision revision = (InternalCDORevision)key;
- for (EStructuralFeature feature : revision.getClassInfo().getAllPersistentFeatures())
- {
- Object value = revision.getValue(feature);
- dumpFeature(out, feature, value);
- }
- }
- }
-
- for (CDORevisionKey key : changeSetData.getChangedObjects())
- {
- CDORevisionDelta delta = (CDORevisionDelta)key;
-
- String name = delta.getEClass().getName();
- CDOID id = delta.getID();
- int branch = delta.getBranch().getID();
- int version = delta.getVersion();
-
- out.println(MessageFormat.format(" * {0}@{1}:{2}v{3}", name, id, branch, version));
- dumpFeatureDeltas(out, delta.getFeatureDeltas());
- }
-
- for (CDOIDAndVersion key : changeSetData.getDetachedObjects())
- {
- out.println(" - " + key);
- }
- }
-
- private static void dumpFeatureDeltas(PrintStream out, List<CDOFeatureDelta> featureDeltas)
- {
- for (CDOFeatureDelta featureDelta : featureDeltas)
- {
- if (featureDelta instanceof CDOListFeatureDelta)
- {
- CDOListFeatureDelta list = (CDOListFeatureDelta)featureDelta;
- dumpFeatureDeltas(out, list.getListChanges());
- }
- else
- {
- dumpFeature(out, featureDelta.getFeature(), featureDelta);
- }
- }
- }
-
- private static void dumpFeature(PrintStream out, EStructuralFeature feature, Object value)
- {
- out.println(" " + feature.getName() + " = " + value);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.commit; + +import org.eclipse.emf.cdo.common.commit.CDOChangeSetData; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; +import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; +import org.eclipse.emf.cdo.internal.common.commit.CDOCommitInfoManagerImpl; +import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import java.io.PrintStream; +import java.text.MessageFormat; +import java.util.List; + +/** + * @author Eike Stepper + * @since 3.0 + */ +public final class CDOCommitInfoUtil +{ + private CDOCommitInfoUtil() + { + } + + public static InternalCDOCommitInfoManager createCommitInfoManager() + { + return new CDOCommitInfoManagerImpl(); + } + + /** + * @since 4.0 + */ + public static void dump(PrintStream out, CDOChangeSetData changeSetData) + { + for (CDOIDAndVersion key : changeSetData.getNewObjects()) + { + out.println(" + " + key); + if (key instanceof InternalCDORevision) + { + InternalCDORevision revision = (InternalCDORevision)key; + for (EStructuralFeature feature : revision.getClassInfo().getAllPersistentFeatures()) + { + Object value = revision.getValue(feature); + dumpFeature(out, feature, value); + } + } + } + + for (CDORevisionKey key : changeSetData.getChangedObjects()) + { + CDORevisionDelta delta = (CDORevisionDelta)key; + + String name = delta.getEClass().getName(); + CDOID id = delta.getID(); + int branch = delta.getBranch().getID(); + int version = delta.getVersion(); + + out.println(MessageFormat.format(" * {0}@{1}:{2}v{3}", name, id, branch, version)); + dumpFeatureDeltas(out, delta.getFeatureDeltas()); + } + + for (CDOIDAndVersion key : changeSetData.getDetachedObjects()) + { + out.println(" - " + key); + } + } + + private static void dumpFeatureDeltas(PrintStream out, List<CDOFeatureDelta> featureDeltas) + { + for (CDOFeatureDelta featureDelta : featureDeltas) + { + if (featureDelta instanceof CDOListFeatureDelta) + { + CDOListFeatureDelta list = (CDOListFeatureDelta)featureDelta; + dumpFeatureDeltas(out, list.getListChanges()); + } + else + { + dumpFeature(out, featureDelta.getFeature(), featureDelta); + } + } + } + + private static void dumpFeature(PrintStream out, EStructuralFeature feature, Object value) + { + out.println(" " + feature.getName() + " = " + value); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDORevisionAvailabilityInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDORevisionAvailabilityInfo.java index d98c8d359b..f66332029d 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDORevisionAvailabilityInfo.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDORevisionAvailabilityInfo.java @@ -1,73 +1,73 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public final class CDORevisionAvailabilityInfo implements CDORevisionProvider
-{
- private CDOBranchPoint branchPoint;
-
- private Map<CDOID, CDORevisionKey> availableRevisions = new HashMap<CDOID, CDORevisionKey>();
-
- public CDORevisionAvailabilityInfo(CDOBranchPoint branchPoint)
- {
- this.branchPoint = branchPoint;
- }
-
- public CDOBranchPoint getBranchPoint()
- {
- return branchPoint;
- }
-
- public Map<CDOID, CDORevisionKey> getAvailableRevisions()
- {
- return availableRevisions;
- }
-
- public void addRevision(CDORevisionKey key)
- {
- availableRevisions.put(key.getID(), key);
- }
-
- public void removeRevision(CDOID id)
- {
- availableRevisions.remove(id);
- }
-
- public boolean containsRevision(CDOID id)
- {
- return availableRevisions.containsKey(id);
- }
-
- public CDORevision getRevision(CDOID id)
- {
- return (CDORevision)availableRevisions.get(id);
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("CDORevisionAvailabilityInfo[{0} -> {1} ]", branchPoint, availableRevisions.values());
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.commit; + +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; +import org.eclipse.emf.cdo.common.revision.CDORevisionProvider; + +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Eike Stepper + * @since 3.0 + */ +public final class CDORevisionAvailabilityInfo implements CDORevisionProvider +{ + private CDOBranchPoint branchPoint; + + private Map<CDOID, CDORevisionKey> availableRevisions = new HashMap<CDOID, CDORevisionKey>(); + + public CDORevisionAvailabilityInfo(CDOBranchPoint branchPoint) + { + this.branchPoint = branchPoint; + } + + public CDOBranchPoint getBranchPoint() + { + return branchPoint; + } + + public Map<CDOID, CDORevisionKey> getAvailableRevisions() + { + return availableRevisions; + } + + public void addRevision(CDORevisionKey key) + { + availableRevisions.put(key.getID(), key); + } + + public void removeRevision(CDOID id) + { + availableRevisions.remove(id); + } + + public boolean containsRevision(CDOID id) + { + return availableRevisions.containsKey(id); + } + + public CDORevision getRevision(CDOID id) + { + return (CDORevision)availableRevisions.get(id); + } + + @Override + public String toString() + { + return MessageFormat.format("CDORevisionAvailabilityInfo[{0} -> {1} ]", branchPoint, availableRevisions.values()); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/InternalCDOCommitInfoManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/InternalCDOCommitInfoManager.java index a1039d380f..671696f301 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/InternalCDOCommitInfoManager.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/InternalCDOCommitInfoManager.java @@ -1,48 +1,48 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
-
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOCommitInfoManager extends CDOCommitInfoManager, ILifecycle
-{
- public CommitInfoLoader getCommitInfoLoader();
-
- public void setCommitInfoLoader(CommitInfoLoader commitInfoLoader);
-
- /**
- * @since 4.0
- */
- public CDOCommitInfo createCommitInfo(CDOBranch branch, long timeStamp, long previousTimeStamp, String userID,
- String comment, CDOCommitData commitData);
-
- /**
- * @author Eike Stepper
- */
- public interface CommitInfoLoader
- {
- public void loadCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler);
-
- public CDOCommitData loadCommitData(long timeStamp);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.commit; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.commit.CDOCommitData; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfo; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager; + +import org.eclipse.net4j.util.lifecycle.ILifecycle; + +/** + * @author Eike Stepper + * @since 3.0 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface InternalCDOCommitInfoManager extends CDOCommitInfoManager, ILifecycle +{ + public CommitInfoLoader getCommitInfoLoader(); + + public void setCommitInfoLoader(CommitInfoLoader commitInfoLoader); + + /** + * @since 4.0 + */ + public CDOCommitInfo createCommitInfo(CDOBranch branch, long timeStamp, long previousTimeStamp, String userID, + String comment, CDOCommitData commitData); + + /** + * @author Eike Stepper + */ + public interface CommitInfoLoader + { + public void loadCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler); + + public CDOCommitData loadCommitData(long timeStamp); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java index 9b8e34f2ed..821116b903 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java @@ -1,15 +1,15 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- */
-
-/**
- * Common service provider interfaces and useful base implementations for dealing with commits and change sets.
- */
-package org.eclipse.emf.cdo.spi.common.commit;
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + */ + +/** + * Common service provider interfaces and useful base implementations for dealing with commits and change sets. + */ +package org.eclipse.emf.cdo.spi.common.commit; diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java index a45f7cf7c3..fb381790da 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java @@ -1,68 +1,68 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- * Simon McDuff - bug 213402
- */
-package org.eclipse.emf.cdo.spi.common.id;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOID implements CDOID
-{
- private static final long serialVersionUID = 1L;
-
- public AbstractCDOID()
- {
- }
-
- @Override
- public String toString()
- {
- return toURIFragment();
- }
-
- public final int compareTo(CDOID o)
- {
- try
- {
- return doCompareTo(o);
- }
- catch (ClassCastException ex)
- {
- return getType().compareTo(o.getType());
- }
- }
-
- protected abstract int doCompareTo(CDOID o) throws ClassCastException;
-
- /**
- * <b>Note:</b> {@link CDOID#toURIFragment()} and {@link AbstractCDOID#read(String)} need to match.
- */
- public abstract void read(String fragmentPart);
-
- /**
- * TODO: Change the parameter to CDODataInput to prevent casting in IDs with classifier.
- */
- public abstract void read(ExtendedDataInput in) throws IOException;
-
- /**
- * TODO: Change the parameter to CDODataInput to prevent casting in IDs with classifier.
- */
- public abstract void write(ExtendedDataOutput out) throws IOException;
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + * Simon McDuff - bug 213402 + */ +package org.eclipse.emf.cdo.spi.common.id; + +import org.eclipse.emf.cdo.common.id.CDOID; + +import org.eclipse.net4j.util.io.ExtendedDataInput; +import org.eclipse.net4j.util.io.ExtendedDataOutput; + +import java.io.IOException; + +/** + * @author Eike Stepper + * @since 2.0 + * @noextend This interface is not intended to be extended by clients. + */ +public abstract class AbstractCDOID implements CDOID +{ + private static final long serialVersionUID = 1L; + + public AbstractCDOID() + { + } + + @Override + public String toString() + { + return toURIFragment(); + } + + public final int compareTo(CDOID o) + { + try + { + return doCompareTo(o); + } + catch (ClassCastException ex) + { + return getType().compareTo(o.getType()); + } + } + + protected abstract int doCompareTo(CDOID o) throws ClassCastException; + + /** + * <b>Note:</b> {@link CDOID#toURIFragment()} and {@link AbstractCDOID#read(String)} need to match. + */ + public abstract void read(String fragmentPart); + + /** + * TODO: Change the parameter to CDODataInput to prevent casting in IDs with classifier. + */ + public abstract void read(ExtendedDataInput in) throws IOException; + + /** + * TODO: Change the parameter to CDODataInput to prevent casting in IDs with classifier. + */ + public abstract void write(ExtendedDataOutput out) throws IOException; +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java index 51e2fb92c7..b469323e34 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java @@ -1,95 +1,95 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.id;
-
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-/**
- * @author Eike Stepper
- * @since 4.1
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOIDByteArray extends AbstractCDOID
-{
- public static final String NULL_VALUE = null;
-
- private static final long serialVersionUID = 1L;
-
- private byte[] value;
-
- public AbstractCDOIDByteArray()
- {
- }
-
- public AbstractCDOIDByteArray(byte[] value)
- {
- CheckUtil.checkArg(value != null && value.length == 16, "Illegal UUID value");
- this.value = value;
- }
-
- public byte[] getByteArrayValue()
- {
- return value;
- }
-
- public String toURIFragment()
- {
- return CDOIDUtil.encodeUUID(value);
- }
-
- @Override
- public void read(String fragmentPart)
- {
- value = CDOIDUtil.decodeUUID(fragmentPart);
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- value = in.readByteArray();
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeByteArray(value);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- AbstractCDOIDByteArray that = (AbstractCDOIDByteArray)obj;
- return Arrays.equals(value, that.value);
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getClass().hashCode() ^ Arrays.hashCode(value);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.id; + +import org.eclipse.emf.cdo.common.id.CDOIDUtil; + +import org.eclipse.net4j.util.CheckUtil; +import org.eclipse.net4j.util.io.ExtendedDataInput; +import org.eclipse.net4j.util.io.ExtendedDataOutput; + +import java.io.IOException; +import java.util.Arrays; + +/** + * @author Eike Stepper + * @since 4.1 + * @noextend This interface is not intended to be extended by clients. + */ +public abstract class AbstractCDOIDByteArray extends AbstractCDOID +{ + public static final String NULL_VALUE = null; + + private static final long serialVersionUID = 1L; + + private byte[] value; + + public AbstractCDOIDByteArray() + { + } + + public AbstractCDOIDByteArray(byte[] value) + { + CheckUtil.checkArg(value != null && value.length == 16, "Illegal UUID value"); + this.value = value; + } + + public byte[] getByteArrayValue() + { + return value; + } + + public String toURIFragment() + { + return CDOIDUtil.encodeUUID(value); + } + + @Override + public void read(String fragmentPart) + { + value = CDOIDUtil.decodeUUID(fragmentPart); + } + + @Override + public void read(ExtendedDataInput in) throws IOException + { + value = in.readByteArray(); + } + + @Override + public void write(ExtendedDataOutput out) throws IOException + { + out.writeByteArray(value); + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) + { + return true; + } + + if (obj != null && obj.getClass() == getClass()) + { + AbstractCDOIDByteArray that = (AbstractCDOIDByteArray)obj; + return Arrays.equals(value, that.value); + } + + return false; + } + + @Override + public int hashCode() + { + return getClass().hashCode() ^ Arrays.hashCode(value); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java index 790243fd78..6c8275ae5e 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java @@ -1,109 +1,109 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- * Simon McDuff - bug 226778
- */
-package org.eclipse.emf.cdo.spi.common.id;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOIDInteger extends AbstractCDOID
-{
- private static final long serialVersionUID = 1L;
-
- private int value;
-
- public AbstractCDOIDInteger()
- {
- }
-
- public AbstractCDOIDInteger(int value)
- {
- if (value == 0)
- {
- throw new IllegalArgumentException("value == 0"); //$NON-NLS-1$
- }
-
- this.value = value;
- }
-
- public int getIntValue()
- {
- return value;
- }
-
- public String toURIFragment()
- {
- return String.valueOf(value);
- }
-
- @Override
- public void read(String fragmentPart)
- {
- value = Integer.valueOf(fragmentPart);
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- value = in.readInt();
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeInt(value);
- }
-
- public int compareTo(AbstractCDOIDInteger that)
- {
- if (value < that.value)
- {
- return -1;
- }
-
- if (value > that.value)
- {
- return 1;
- }
-
- return 0;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- AbstractCDOIDInteger that = (AbstractCDOIDInteger)obj;
- return value == that.value;
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getClass().hashCode() ^ value;
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + * Simon McDuff - bug 226778 + */ +package org.eclipse.emf.cdo.spi.common.id; + +import org.eclipse.net4j.util.io.ExtendedDataInput; +import org.eclipse.net4j.util.io.ExtendedDataOutput; + +import java.io.IOException; + +/** + * @author Eike Stepper + * @since 2.0 + * @noextend This interface is not intended to be extended by clients. + */ +public abstract class AbstractCDOIDInteger extends AbstractCDOID +{ + private static final long serialVersionUID = 1L; + + private int value; + + public AbstractCDOIDInteger() + { + } + + public AbstractCDOIDInteger(int value) + { + if (value == 0) + { + throw new IllegalArgumentException("value == 0"); //$NON-NLS-1$ + } + + this.value = value; + } + + public int getIntValue() + { + return value; + } + + public String toURIFragment() + { + return String.valueOf(value); + } + + @Override + public void read(String fragmentPart) + { + value = Integer.valueOf(fragmentPart); + } + + @Override + public void read(ExtendedDataInput in) throws IOException + { + value = in.readInt(); + } + + @Override + public void write(ExtendedDataOutput out) throws IOException + { + out.writeInt(value); + } + + public int compareTo(AbstractCDOIDInteger that) + { + if (value < that.value) + { + return -1; + } + + if (value > that.value) + { + return 1; + } + + return 0; + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) + { + return true; + } + + if (obj != null && obj.getClass() == getClass()) + { + AbstractCDOIDInteger that = (AbstractCDOIDInteger)obj; + return value == that.value; + } + + return false; + } + + @Override + public int hashCode() + { + return getClass().hashCode() ^ value; + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java index 60c0bbccaf..e7ad42d52c 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java @@ -1,103 +1,103 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- * Simon McDuff - bug 226778
- */
-package org.eclipse.emf.cdo.spi.common.id;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOIDLong extends AbstractCDOID
-{
- public static final long NULL_VALUE = 0L;
-
- private static final long serialVersionUID = 1L;
-
- private long value;
-
- public AbstractCDOIDLong()
- {
- }
-
- public AbstractCDOIDLong(long value)
- {
- if (value == NULL_VALUE)
- {
- throw new IllegalArgumentException("value == NULL_VALUE"); //$NON-NLS-1$
- }
-
- this.value = value;
- }
-
- public long getLongValue()
- {
- return value;
- }
-
- public String toURIFragment()
- {
- return String.valueOf(value);
- }
-
- @Override
- public void read(String fragmentPart)
- {
- value = Long.valueOf(fragmentPart);
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- value = in.readLong();
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeLong(value);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- AbstractCDOIDLong that = (AbstractCDOIDLong)obj;
- return value == that.value;
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getClass().hashCode() ^ ObjectUtil.hashCode(value);
- }
-
- @Override
- public String toString()
- {
- return String.valueOf(value);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + * Simon McDuff - bug 226778 + */ +package org.eclipse.emf.cdo.spi.common.id; + +import org.eclipse.net4j.util.ObjectUtil; +import org.eclipse.net4j.util.io.ExtendedDataInput; +import org.eclipse.net4j.util.io.ExtendedDataOutput; + +import java.io.IOException; + +/** + * @author Eike Stepper + * @since 2.0 + * @noextend This interface is not intended to be extended by clients. + */ +public abstract class AbstractCDOIDLong extends AbstractCDOID +{ + public static final long NULL_VALUE = 0L; + + private static final long serialVersionUID = 1L; + + private long value; + + public AbstractCDOIDLong() + { + } + + public AbstractCDOIDLong(long value) + { + if (value == NULL_VALUE) + { + throw new IllegalArgumentException("value == NULL_VALUE"); //$NON-NLS-1$ + } + + this.value = value; + } + + public long getLongValue() + { + return value; + } + + public String toURIFragment() + { + return String.valueOf(value); + } + + @Override + public void read(String fragmentPart) + { + value = Long.valueOf(fragmentPart); + } + + @Override + public void read(ExtendedDataInput in) throws IOException + { + value = in.readLong(); + } + + @Override + public void write(ExtendedDataOutput out) throws IOException + { + out.writeLong(value); + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) + { + return true; + } + + if (obj != null && obj.getClass() == getClass()) + { + AbstractCDOIDLong that = (AbstractCDOIDLong)obj; + return value == that.value; + } + + return false; + } + + @Override + public int hashCode() + { + return getClass().hashCode() ^ ObjectUtil.hashCode(value); + } + + @Override + public String toString() + { + return String.valueOf(value); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDString.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDString.java index b9ded5ab2e..e863c8b20f 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDString.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDString.java @@ -1,101 +1,101 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Taal - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.spi.common.id;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Martin Taal
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOIDString extends AbstractCDOID
-{
- /**
- * @since 4.0
- */
- public static final String NULL_VALUE = null;
-
- private static final long serialVersionUID = 1L;
-
- private String value;
-
- public AbstractCDOIDString()
- {
- }
-
- public AbstractCDOIDString(String value)
- {
- this.value = value;
- }
-
- public String getStringValue()
- {
- return value;
- }
-
- public String toURIFragment()
- {
- return value;
- }
-
- @Override
- public void read(String fragmentPart)
- {
- value = fragmentPart;
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- value = in.readString();
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeString(value);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- AbstractCDOIDString that = (AbstractCDOIDString)obj;
- return value.equals(that.value);
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getClass().hashCode() ^ ObjectUtil.hashCode(value);
- }
-
- @Override
- public String toString()
- {
- return value;
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Martin Taal - initial API and implementation + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.spi.common.id; + +import org.eclipse.net4j.util.ObjectUtil; +import org.eclipse.net4j.util.io.ExtendedDataInput; +import org.eclipse.net4j.util.io.ExtendedDataOutput; + +import java.io.IOException; + +/** + * @author Martin Taal + * @since 3.0 + * @noextend This interface is not intended to be extended by clients. + */ +public abstract class AbstractCDOIDString extends AbstractCDOID +{ + /** + * @since 4.0 + */ + public static final String NULL_VALUE = null; + + private static final long serialVersionUID = 1L; + + private String value; + + public AbstractCDOIDString() + { + } + + public AbstractCDOIDString(String value) + { + this.value = value; + } + + public String getStringValue() + { + return value; + } + + public String toURIFragment() + { + return value; + } + + @Override + public void read(String fragmentPart) + { + value = fragmentPart; + } + + @Override + public void read(ExtendedDataInput in) throws IOException + { + value = in.readString(); + } + + @Override + public void write(ExtendedDataOutput out) throws IOException + { + out.writeString(value); + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) + { + return true; + } + + if (obj != null && obj.getClass() == getClass()) + { + AbstractCDOIDString that = (AbstractCDOIDString)obj; + return value.equals(that.value); + } + + return false; + } + + @Override + public int hashCode() + { + return getClass().hashCode() ^ ObjectUtil.hashCode(value); + } + + @Override + public String toString() + { + return value; + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/InternalCDOIDObject.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/InternalCDOIDObject.java index 47071b8b6d..d8dec20471 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/InternalCDOIDObject.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/InternalCDOIDObject.java @@ -1,24 +1,24 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.id;
-
-import org.eclipse.emf.cdo.common.id.CDOIDObject;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOIDObject extends CDOIDObject
-{
- public ObjectType getSubType();
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.id; + +import org.eclipse.emf.cdo.common.id.CDOIDObject; + +/** + * @author Eike Stepper + * @since 3.0 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface InternalCDOIDObject extends CDOIDObject +{ + public ObjectType getSubType(); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java index 548c925814..e43cebe508 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java @@ -1,15 +1,15 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- */
-
-/**
- * Common service provider interfaces and useful base implementations for dealing with object and revision IDs.
- */
-package org.eclipse.emf.cdo.spi.common.id;
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + */ + +/** + * Common service provider interfaces and useful base implementations for dealing with object and revision IDs. + */ +package org.eclipse.emf.cdo.spi.common.id; diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java index 841f520093..c4f4c2f363 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java @@ -1,31 +1,31 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.spi.common.lock;
-
-import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-
-/**
- * @author Caspar De Groot
- * @since 4.1
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOLockState extends CDOLockState
-{
- public void addReadLockOwner(CDOLockOwner lockOwner);
-
- public boolean removeReadLockOwner(CDOLockOwner lockOwner);
-
- public void setWriteLockOwner(CDOLockOwner lockOwner);
-
- public void setWriteOptionOwner(CDOLockOwner lockOwner);
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Caspar De Groot - initial API and implementation + */ +package org.eclipse.emf.cdo.spi.common.lock; + +import org.eclipse.emf.cdo.common.lock.CDOLockOwner; +import org.eclipse.emf.cdo.common.lock.CDOLockState; + +/** + * @author Caspar De Groot + * @since 4.1 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface InternalCDOLockState extends CDOLockState +{ + public void addReadLockOwner(CDOLockOwner lockOwner); + + public boolean removeReadLockOwner(CDOLockOwner lockOwner); + + public void setWriteLockOwner(CDOLockOwner lockOwner); + + public void setWriteOptionOwner(CDOLockOwner lockOwner); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java index c4dbb6f6ea..cdb2748735 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java @@ -1,15 +1,15 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- */
-
-/**
- * Common service provider interfaces and useful base implementations for dealing with object locks.
- */
-package org.eclipse.emf.cdo.spi.common.lock;
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + */ + +/** + * Common service provider interfaces and useful base implementations for dealing with object locks. + */ +package org.eclipse.emf.cdo.spi.common.lock; diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/DelegatingCDOPackageRegistry.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/DelegatingCDOPackageRegistry.java index e1552684bc..7c9bd827c4 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/DelegatingCDOPackageRegistry.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/DelegatingCDOPackageRegistry.java @@ -1,174 +1,174 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.model;
-
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.emf.ecore.EPackage;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-@Deprecated
-public abstract class DelegatingCDOPackageRegistry extends Lifecycle implements InternalCDOPackageRegistry
-{
- public DelegatingCDOPackageRegistry()
- {
- }
-
- protected abstract InternalCDOPackageRegistry getDelegate();
-
- public Object basicPut(String nsURI, Object value)
- {
- return getDelegate().basicPut(nsURI, value);
- }
-
- public void clear()
- {
- getDelegate().clear();
- }
-
- public boolean containsKey(Object key)
- {
- return getDelegate().containsKey(key);
- }
-
- public boolean containsValue(Object value)
- {
- return getDelegate().containsValue(value);
- }
-
- public Set<java.util.Map.Entry<String, Object>> entrySet()
- {
- return getDelegate().entrySet();
- }
-
- public Object get(Object key)
- {
- return getDelegate().get(key);
- }
-
- public EFactory getEFactory(String nsURI)
- {
- return getDelegate().getEFactory(nsURI);
- }
-
- public EPackage getEPackage(String nsURI)
- {
- return getDelegate().getEPackage(nsURI);
- }
-
- public EPackage[] getEPackages()
- {
- return getDelegate().getEPackages();
- }
-
- public InternalCDOPackageInfo getPackageInfo(EPackage ePackage)
- {
- return getDelegate().getPackageInfo(ePackage);
- }
-
- public InternalCDOPackageInfo[] getPackageInfos()
- {
- return getDelegate().getPackageInfos();
- }
-
- public PackageLoader getPackageLoader()
- {
- return getDelegate().getPackageLoader();
- }
-
- public PackageProcessor getPackageProcessor()
- {
- return getDelegate().getPackageProcessor();
- }
-
- public InternalCDOPackageUnit getPackageUnit(EPackage ePackage)
- {
- return getDelegate().getPackageUnit(ePackage);
- }
-
- public InternalCDOPackageUnit[] getPackageUnits()
- {
- return getDelegate().getPackageUnits();
- }
-
- public boolean isEmpty()
- {
- return getDelegate().isEmpty();
- }
-
- public boolean isReplacingDescriptors()
- {
- return getDelegate().isReplacingDescriptors();
- }
-
- public Set<String> keySet()
- {
- return getDelegate().keySet();
- }
-
- public Object put(String key, Object value)
- {
- return getDelegate().put(key, value);
- }
-
- public void putAll(Map<? extends String, ? extends Object> t)
- {
- getDelegate().putAll(t);
- }
-
- public Object putEPackage(EPackage ePackage)
- {
- return getDelegate().putEPackage(ePackage);
- }
-
- public void putPackageUnit(InternalCDOPackageUnit packageUnit)
- {
- getDelegate().putPackageUnit(packageUnit);
- }
-
- public Object remove(Object key)
- {
- return getDelegate().remove(key);
- }
-
- public void setPackageLoader(PackageLoader packageLoader)
- {
- getDelegate().setPackageLoader(packageLoader);
- }
-
- public void setPackageProcessor(PackageProcessor packageProcessor)
- {
- getDelegate().setPackageProcessor(packageProcessor);
- }
-
- public void setReplacingDescriptors(boolean replacingDescriptors)
- {
- getDelegate().setReplacingDescriptors(replacingDescriptors);
- }
-
- public int size()
- {
- return getDelegate().size();
- }
-
- public Collection<Object> values()
- {
- return getDelegate().values();
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.model; + +import org.eclipse.net4j.util.lifecycle.Lifecycle; + +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EPackage; + +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +/** + * @author Eike Stepper + * @since 4.0 + */ +@Deprecated +public abstract class DelegatingCDOPackageRegistry extends Lifecycle implements InternalCDOPackageRegistry +{ + public DelegatingCDOPackageRegistry() + { + } + + protected abstract InternalCDOPackageRegistry getDelegate(); + + public Object basicPut(String nsURI, Object value) + { + return getDelegate().basicPut(nsURI, value); + } + + public void clear() + { + getDelegate().clear(); + } + + public boolean containsKey(Object key) + { + return getDelegate().containsKey(key); + } + + public boolean containsValue(Object value) + { + return getDelegate().containsValue(value); + } + + public Set<java.util.Map.Entry<String, Object>> entrySet() + { + return getDelegate().entrySet(); + } + + public Object get(Object key) + { + return getDelegate().get(key); + } + + public EFactory getEFactory(String nsURI) + { + return getDelegate().getEFactory(nsURI); + } + + public EPackage getEPackage(String nsURI) + { + return getDelegate().getEPackage(nsURI); + } + + public EPackage[] getEPackages() + { + return getDelegate().getEPackages(); + } + + public InternalCDOPackageInfo getPackageInfo(EPackage ePackage) + { + return getDelegate().getPackageInfo(ePackage); + } + + public InternalCDOPackageInfo[] getPackageInfos() + { + return getDelegate().getPackageInfos(); + } + + public PackageLoader getPackageLoader() + { + return getDelegate().getPackageLoader(); + } + + public PackageProcessor getPackageProcessor() + { + return getDelegate().getPackageProcessor(); + } + + public InternalCDOPackageUnit getPackageUnit(EPackage ePackage) + { + return getDelegate().getPackageUnit(ePackage); + } + + public InternalCDOPackageUnit[] getPackageUnits() + { + return getDelegate().getPackageUnits(); + } + + public boolean isEmpty() + { + return getDelegate().isEmpty(); + } + + public boolean isReplacingDescriptors() + { + return getDelegate().isReplacingDescriptors(); + } + + public Set<String> keySet() + { + return getDelegate().keySet(); + } + + public Object put(String key, Object value) + { + return getDelegate().put(key, value); + } + + public void putAll(Map<? extends String, ? extends Object> t) + { + getDelegate().putAll(t); + } + + public Object putEPackage(EPackage ePackage) + { + return getDelegate().putEPackage(ePackage); + } + + public void putPackageUnit(InternalCDOPackageUnit packageUnit) + { + getDelegate().putPackageUnit(packageUnit); + } + + public Object remove(Object key) + { + return getDelegate().remove(key); + } + + public void setPackageLoader(PackageLoader packageLoader) + { + getDelegate().setPackageLoader(packageLoader); + } + + public void setPackageProcessor(PackageProcessor packageProcessor) + { + getDelegate().setPackageProcessor(packageProcessor); + } + + public void setReplacingDescriptors(boolean replacingDescriptors) + { + getDelegate().setReplacingDescriptors(replacingDescriptors); + } + + public int size() + { + return getDelegate().size(); + } + + public Collection<Object> values() + { + return getDelegate().values(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java index 20a56a7435..b69af6a1f0 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java @@ -1,46 +1,46 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.model;
-
-import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-
-import org.eclipse.emf.common.notify.Adapter;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOPackageInfo extends CDOPackageInfo, Adapter.Internal
-{
- public InternalCDOPackageUnit getPackageUnit();
-
- public void setPackageUnit(InternalCDOPackageUnit packageUnit);
-
- public void setPackageURI(String packageURI);
-
- public void setParentURI(String parentURI);
-
- /**
- * @since 3.0
- */
- public void write(CDODataOutput out) throws IOException;
-
- /**
- * @since 3.0
- */
- public void read(CDODataInput in) throws IOException;
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.model; + +import org.eclipse.emf.cdo.common.model.CDOPackageInfo; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; + +import org.eclipse.emf.common.notify.Adapter; + +import java.io.IOException; + +/** + * @author Eike Stepper + * @since 2.0 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface InternalCDOPackageInfo extends CDOPackageInfo, Adapter.Internal +{ + public InternalCDOPackageUnit getPackageUnit(); + + public void setPackageUnit(InternalCDOPackageUnit packageUnit); + + public void setPackageURI(String packageURI); + + public void setParentURI(String parentURI); + + /** + * @since 3.0 + */ + public void write(CDODataOutput out) throws IOException; + + /** + * @since 3.0 + */ + public void read(CDODataInput in) throws IOException; +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageRegistry.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageRegistry.java index 82a441eece..2e7b161b39 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageRegistry.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageRegistry.java @@ -1,105 +1,105 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.model;
-
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit.State;
-
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-import org.eclipse.emf.ecore.EPackage;
-
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOPackageRegistry extends CDOPackageRegistry, ILifecycle
-{
- public void setReplacingDescriptors(boolean replacingDescriptors);
-
- public PackageProcessor getPackageProcessor();
-
- public void setPackageProcessor(PackageProcessor packageProcessor);
-
- public PackageLoader getPackageLoader();
-
- public void setPackageLoader(PackageLoader packageLoader);
-
- public Object basicPut(String nsURI, Object value);
-
- public void putPackageUnit(InternalCDOPackageUnit packageUnit);
-
- /**
- * @since 4.0
- */
- public void putPackageUnits(InternalCDOPackageUnit[] packageUnits, State state);
-
- /**
- * @since 4.0
- */
- public InternalCDOPackageUnit createPackageUnit();
-
- /**
- * @since 3.0
- */
- public InternalCDOPackageUnit getPackageUnit(String id);
-
- public InternalCDOPackageUnit getPackageUnit(EPackage ePackage);
-
- public InternalCDOPackageUnit[] getPackageUnits();
-
- /**
- * @since 4.0
- */
- public InternalCDOPackageUnit[] getPackageUnits(boolean withSystemPackages);
-
- /**
- * @since 3.0
- */
- public InternalCDOPackageUnit[] getPackageUnits(long startTime, long endTime);
-
- public InternalCDOPackageInfo getPackageInfo(EPackage ePackage);
-
- public InternalCDOPackageInfo[] getPackageInfos();
-
- public EPackage[] getEPackages();
-
- /**
- * @since 3.0
- */
- public Set<String> getAllKeys();
-
- /**
- * @since 3.0
- */
- public Object getWithDelegation(String nsURI, boolean resolve);
-
- /**
- * @author Eike Stepper
- */
- public interface PackageProcessor
- {
- public Object processPackage(Object value);
- }
-
- /**
- * @author Eike Stepper
- */
- public interface PackageLoader
- {
- public EPackage[] loadPackages(CDOPackageUnit packageUnit);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.model; + +import org.eclipse.emf.cdo.common.model.CDOPackageRegistry; +import org.eclipse.emf.cdo.common.model.CDOPackageUnit; +import org.eclipse.emf.cdo.common.model.CDOPackageUnit.State; + +import org.eclipse.net4j.util.lifecycle.ILifecycle; + +import org.eclipse.emf.ecore.EPackage; + +import java.util.Set; + +/** + * @author Eike Stepper + * @since 2.0 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface InternalCDOPackageRegistry extends CDOPackageRegistry, ILifecycle +{ + public void setReplacingDescriptors(boolean replacingDescriptors); + + public PackageProcessor getPackageProcessor(); + + public void setPackageProcessor(PackageProcessor packageProcessor); + + public PackageLoader getPackageLoader(); + + public void setPackageLoader(PackageLoader packageLoader); + + public Object basicPut(String nsURI, Object value); + + public void putPackageUnit(InternalCDOPackageUnit packageUnit); + + /** + * @since 4.0 + */ + public void putPackageUnits(InternalCDOPackageUnit[] packageUnits, State state); + + /** + * @since 4.0 + */ + public InternalCDOPackageUnit createPackageUnit(); + + /** + * @since 3.0 + */ + public InternalCDOPackageUnit getPackageUnit(String id); + + public InternalCDOPackageUnit getPackageUnit(EPackage ePackage); + + public InternalCDOPackageUnit[] getPackageUnits(); + + /** + * @since 4.0 + */ + public InternalCDOPackageUnit[] getPackageUnits(boolean withSystemPackages); + + /** + * @since 3.0 + */ + public InternalCDOPackageUnit[] getPackageUnits(long startTime, long endTime); + + public InternalCDOPackageInfo getPackageInfo(EPackage ePackage); + + public InternalCDOPackageInfo[] getPackageInfos(); + + public EPackage[] getEPackages(); + + /** + * @since 3.0 + */ + public Set<String> getAllKeys(); + + /** + * @since 3.0 + */ + public Object getWithDelegation(String nsURI, boolean resolve); + + /** + * @author Eike Stepper + */ + public interface PackageProcessor + { + public Object processPackage(Object value); + } + + /** + * @author Eike Stepper + */ + public interface PackageLoader + { + public EPackage[] loadPackages(CDOPackageUnit packageUnit); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java index 1232fc6a5a..46b32a859f 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java @@ -1,72 +1,72 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.model;
-
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry.PackageLoader;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOPackageUnit extends CDOPackageUnit
-{
- public InternalCDOPackageRegistry getPackageRegistry();
-
- public void setPackageRegistry(InternalCDOPackageRegistry packageRegistry);
-
- public void setState(State state);
-
- public void setOriginalType(Type originalType);
-
- public void setTimeStamp(long timeStamp);
-
- public InternalCDOPackageInfo getTopLevelPackageInfo();
-
- public InternalCDOPackageInfo getPackageInfo(String packageURI);
-
- public InternalCDOPackageInfo[] getPackageInfos();
-
- public void setPackageInfos(InternalCDOPackageInfo[] packageInfos);
-
- /**
- * @since 4.0
- */
- public void load(boolean resolve);
-
- /**
- * @since 4.0
- */
- public void load(PackageLoader packageLoader, boolean resolve);
-
- /**
- * @since 3.0
- */
- public void write(CDODataOutput out, boolean withPackages) throws IOException;
-
- /**
- * @since 3.0
- */
- public void read(CDODataInput in, ResourceSet resourceSet) throws IOException;
-
- public void init(EPackage ePackage);
-
- public void dispose();
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.model; + +import org.eclipse.emf.cdo.common.model.CDOPackageUnit; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry.PackageLoader; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import java.io.IOException; + +/** + * @author Eike Stepper + * @since 2.0 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface InternalCDOPackageUnit extends CDOPackageUnit +{ + public InternalCDOPackageRegistry getPackageRegistry(); + + public void setPackageRegistry(InternalCDOPackageRegistry packageRegistry); + + public void setState(State state); + + public void setOriginalType(Type originalType); + + public void setTimeStamp(long timeStamp); + + public InternalCDOPackageInfo getTopLevelPackageInfo(); + + public InternalCDOPackageInfo getPackageInfo(String packageURI); + + public InternalCDOPackageInfo[] getPackageInfos(); + + public void setPackageInfos(InternalCDOPackageInfo[] packageInfos); + + /** + * @since 4.0 + */ + public void load(boolean resolve); + + /** + * @since 4.0 + */ + public void load(PackageLoader packageLoader, boolean resolve); + + /** + * @since 3.0 + */ + public void write(CDODataOutput out, boolean withPackages) throws IOException; + + /** + * @since 3.0 + */ + public void read(CDODataInput in, ResourceSet resourceSet) throws IOException; + + public void init(EPackage ePackage); + + public void dispose(); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java index 6508609913..3d23e9f19a 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java @@ -1,15 +1,15 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- */
-
-/**
- * Common service provider interfaces and useful base implementations for dealing with models and types
- */
-package org.eclipse.emf.cdo.spi.common.model;
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + */ + +/** + * Common service provider interfaces and useful base implementations for dealing with models and types + */ +package org.eclipse.emf.cdo.spi.common.model; diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java index 8494f69797..f2a2f3419f 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java @@ -1,15 +1,15 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- */
-
-/**
- * Common service provider interfaces and useful base implementations.
- */
-package org.eclipse.emf.cdo.spi.common;
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + */ + +/** + * Common service provider interfaces and useful base implementations. + */ +package org.eclipse.emf.cdo.spi.common; diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java index e1e6f96338..0c4ee62d4b 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java @@ -1,98 +1,98 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-
-/**
- * @author Simon McDuff
- * @since 3.0
- */
-public class CDOFeatureDeltaVisitorImpl implements CDOFeatureDeltaVisitor
-{
- public CDOFeatureDeltaVisitorImpl()
- {
- }
-
- public void visit(CDOAddFeatureDelta delta)
- {
- }
-
- public void visit(CDOClearFeatureDelta delta)
- {
- }
-
- public void visit(CDOContainerFeatureDelta delta)
- {
- }
-
- public void visit(CDOListFeatureDelta deltas)
- {
- for (CDOFeatureDelta delta : deltas.getListChanges())
- {
- try
- {
- delta.accept(this);
- }
- catch (StopVisitException ex)
- {
- return;
- }
- }
- }
-
- public void visit(CDOMoveFeatureDelta delta)
- {
- }
-
- public void visit(CDORemoveFeatureDelta delta)
- {
- }
-
- public void visit(CDOSetFeatureDelta delta)
- {
- }
-
- public void visit(CDOUnsetFeatureDelta delta)
- {
- }
-
- /**
- * @since 4.0
- */
- protected void stopVisit()
- {
- throw new StopVisitException();
- }
-
- /**
- * @author Eike Stepper
- * @since 4.0
- */
- private static final class StopVisitException extends RuntimeException
- {
- private static final long serialVersionUID = 1L;
-
- public StopVisitException()
- {
- }
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Simon McDuff - initial API and implementation + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.spi.common.revision; + +import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor; +import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta; + +/** + * @author Simon McDuff + * @since 3.0 + */ +public class CDOFeatureDeltaVisitorImpl implements CDOFeatureDeltaVisitor +{ + public CDOFeatureDeltaVisitorImpl() + { + } + + public void visit(CDOAddFeatureDelta delta) + { + } + + public void visit(CDOClearFeatureDelta delta) + { + } + + public void visit(CDOContainerFeatureDelta delta) + { + } + + public void visit(CDOListFeatureDelta deltas) + { + for (CDOFeatureDelta delta : deltas.getListChanges()) + { + try + { + delta.accept(this); + } + catch (StopVisitException ex) + { + return; + } + } + } + + public void visit(CDOMoveFeatureDelta delta) + { + } + + public void visit(CDORemoveFeatureDelta delta) + { + } + + public void visit(CDOSetFeatureDelta delta) + { + } + + public void visit(CDOUnsetFeatureDelta delta) + { + } + + /** + * @since 4.0 + */ + protected void stopVisit() + { + throw new StopVisitException(); + } + + /** + * @author Eike Stepper + * @since 4.0 + */ + private static final class StopVisitException extends RuntimeException + { + private static final long serialVersionUID = 1L; + + public StopVisitException() + { + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java index e09c0ff74d..4677aec477 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java @@ -1,25 +1,25 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Martin Taal - derived from CDOFeatureMapEntryImpl
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-/**
- * @since 3.0
- * @author Martin Taal
- */
-public interface CDOFeatureMapEntry extends FeatureMap.Entry
-{
- void setEStructuralFeature(EStructuralFeature feature);
-
- void setValue(Object value);
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Martin Taal - derived from CDOFeatureMapEntryImpl + */ +package org.eclipse.emf.cdo.spi.common.revision; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.FeatureMap; + +/** + * @since 3.0 + * @author Martin Taal + */ +public interface CDOFeatureMapEntry extends FeatureMap.Entry +{ + void setEStructuralFeature(EStructuralFeature feature); + + void setValue(Object value); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java index 3f18ffa4af..4a5ca49d02 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java @@ -1,63 +1,63 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Simon McDuff - initial API and implementation
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.util.Map;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public class CDOIDMapper implements CDOReferenceAdjuster
-{
- private Map<CDOID, CDOID> idMappings;
-
- private boolean allowUnmappedTempIDs;
-
- public CDOIDMapper(Map<CDOID, CDOID> idMappings)
- {
- this.idMappings = idMappings;
- }
-
- public Map<CDOID, CDOID> getIDMappings()
- {
- return idMappings;
- }
-
- /**
- * @since 3.0
- */
- public boolean isAllowUnmappedTempIDs()
- {
- return allowUnmappedTempIDs;
- }
-
- /**
- * @since 3.0
- */
- public void setAllowUnmappedTempIDs(boolean allowUnmappedTempIDs)
- {
- this.allowUnmappedTempIDs = allowUnmappedTempIDs;
- }
-
- /**
- * @since 4.0
- */
- public Object adjustReference(Object value, EStructuralFeature feature, int index)
- {
- return CDORevisionUtil.remapID(value, idMappings, allowUnmappedTempIDs);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Simon McDuff - initial API and implementation + */ +package org.eclipse.emf.cdo.spi.common.revision; + +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDORevisionUtil; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import java.util.Map; + +/** + * @author Simon McDuff + * @since 2.0 + */ +public class CDOIDMapper implements CDOReferenceAdjuster +{ + private Map<CDOID, CDOID> idMappings; + + private boolean allowUnmappedTempIDs; + + public CDOIDMapper(Map<CDOID, CDOID> idMappings) + { + this.idMappings = idMappings; + } + + public Map<CDOID, CDOID> getIDMappings() + { + return idMappings; + } + + /** + * @since 3.0 + */ + public boolean isAllowUnmappedTempIDs() + { + return allowUnmappedTempIDs; + } + + /** + * @since 3.0 + */ + public void setAllowUnmappedTempIDs(boolean allowUnmappedTempIDs) + { + this.allowUnmappedTempIDs = allowUnmappedTempIDs; + } + + /** + * @since 4.0 + */ + public Object adjustReference(Object value, EStructuralFeature feature, int index) + { + return CDORevisionUtil.remapID(value, idMappings, allowUnmappedTempIDs); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjustable.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjustable.java index a206671ff3..edb26661d9 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjustable.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjustable.java @@ -1,21 +1,21 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-/**
- * @author Simon McDuff
- * @since 4.0
- */
-public interface CDOReferenceAdjustable
-{
- public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster);
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Simon McDuff - initial API and implementation + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.spi.common.revision; + +/** + * @author Simon McDuff + * @since 4.0 + */ +public interface CDOReferenceAdjustable +{ + public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjuster.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjuster.java index 3b9673d107..7d840eb460 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjuster.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjuster.java @@ -1,34 +1,34 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * @author Simon McDuff
- * @since 4.0
- */
-public interface CDOReferenceAdjuster
-{
- /**
- * Adjusts the internal structure of an object (e.g: {@link CDORevision}). This is mainly used after committing a
- * transaction. {@link CDORevision} must replace {@link CDOIDTemp} for non-temporary {@link CDOID} with a mapped ID.
- * Only the internal structure knows how to do these modifications. This is important to consider using different
- * implementation of {@link CDOList}.
- */
- public Object adjustReference(Object id, EStructuralFeature feature, int index);
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Simon McDuff - initial API and implementation + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.spi.common.revision; + +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.id.CDOIDTemp; +import org.eclipse.emf.cdo.common.revision.CDOList; +import org.eclipse.emf.cdo.common.revision.CDORevision; + +import org.eclipse.emf.ecore.EStructuralFeature; + +/** + * @author Simon McDuff + * @since 4.0 + */ +public interface CDOReferenceAdjuster +{ + /** + * Adjusts the internal structure of an object (e.g: {@link CDORevision}). This is mainly used after committing a + * transaction. {@link CDORevision} must replace {@link CDOIDTemp} for non-temporary {@link CDOID} with a mapped ID. + * Only the internal structure knows how to do these modifications. This is important to consider using different + * implementation of {@link CDOList}. + */ + public Object adjustReference(Object id, EStructuralFeature feature, int index); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java index 5d2934404f..4a0c11baa2 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java @@ -1,86 +1,86 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- * Simon McDuff - bug 213402
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public class CDORevisionMerger extends CDOFeatureDeltaVisitorImpl
-{
- private InternalCDORevision revision;
-
- public CDORevisionMerger()
- {
- }
-
- public synchronized void merge(InternalCDORevision revision, CDORevisionDelta delta)
- {
- this.revision = revision;
- delta.accept(this);
- revision = null;
- }
-
- @Override
- public void visit(CDOMoveFeatureDelta delta)
- {
- revision.move(delta.getFeature(), delta.getNewPosition(), delta.getOldPosition());
- }
-
- @Override
- public void visit(CDOAddFeatureDelta delta)
- {
- revision.add(delta.getFeature(), delta.getIndex(), delta.getValue());
- }
-
- @Override
- public void visit(CDORemoveFeatureDelta delta)
- {
- revision.remove(delta.getFeature(), delta.getIndex());
- }
-
- @Override
- public void visit(CDOSetFeatureDelta delta)
- {
- revision.set(delta.getFeature(), delta.getIndex(), delta.getValue());
- }
-
- @Override
- public void visit(CDOUnsetFeatureDelta delta)
- {
- revision.unset(delta.getFeature());
- }
-
- @Override
- public void visit(CDOClearFeatureDelta delta)
- {
- revision.clear(delta.getFeature());
- }
-
- @Override
- public void visit(CDOContainerFeatureDelta delta)
- {
- revision.setResourceID(delta.getResourceID());
- revision.setContainerID(delta.getContainerID());
- revision.setContainingFeatureID(delta.getContainerFeatureID());
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Simon McDuff - initial API and implementation + * Eike Stepper - maintenance + * Simon McDuff - bug 213402 + */ +package org.eclipse.emf.cdo.spi.common.revision; + +import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta; + +/** + * @author Simon McDuff + * @since 2.0 + */ +public class CDORevisionMerger extends CDOFeatureDeltaVisitorImpl +{ + private InternalCDORevision revision; + + public CDORevisionMerger() + { + } + + public synchronized void merge(InternalCDORevision revision, CDORevisionDelta delta) + { + this.revision = revision; + delta.accept(this); + revision = null; + } + + @Override + public void visit(CDOMoveFeatureDelta delta) + { + revision.move(delta.getFeature(), delta.getNewPosition(), delta.getOldPosition()); + } + + @Override + public void visit(CDOAddFeatureDelta delta) + { + revision.add(delta.getFeature(), delta.getIndex(), delta.getValue()); + } + + @Override + public void visit(CDORemoveFeatureDelta delta) + { + revision.remove(delta.getFeature(), delta.getIndex()); + } + + @Override + public void visit(CDOSetFeatureDelta delta) + { + revision.set(delta.getFeature(), delta.getIndex(), delta.getValue()); + } + + @Override + public void visit(CDOUnsetFeatureDelta delta) + { + revision.unset(delta.getFeature()); + } + + @Override + public void visit(CDOClearFeatureDelta delta) + { + revision.clear(delta.getFeature()); + } + + @Override + public void visit(CDOContainerFeatureDelta delta) + { + revision.setResourceID(delta.getResourceID()); + revision.setContainerID(delta.getContainerID()); + revision.setContainingFeatureID(delta.getContainerFeatureID()); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java index 6e36ce3ecd..186d4f0d04 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java @@ -1,193 +1,193 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public abstract class DelegatingCDORevisionManager extends Lifecycle implements InternalCDORevisionManager
-{
- public DelegatingCDORevisionManager()
- {
- }
-
- public InternalCDORevisionCache getCache()
- {
- return getDelegate().getCache();
- }
-
- /**
- * @since 4.0
- */
- public void setCache(CDORevisionCache cache)
- {
- getDelegate().setCache(cache);
- }
-
- public void setFactory(CDORevisionFactory factory)
- {
- getDelegate().setFactory(factory);
- }
-
- public CDORevisionFactory getFactory()
- {
- return getDelegate().getFactory();
- }
-
- public RevisionLoader getRevisionLoader()
- {
- return getDelegate().getRevisionLoader();
- }
-
- public void setRevisionLoader(RevisionLoader revisionLoader)
- {
- getDelegate().setRevisionLoader(revisionLoader);
- }
-
- public RevisionLocker getRevisionLocker()
- {
- return getDelegate().getRevisionLocker();
- }
-
- public void setRevisionLocker(RevisionLocker revisionLocker)
- {
- getDelegate().setRevisionLocker(revisionLocker);
- }
-
- /**
- * @since 4.0
- */
- public boolean isSupportingAudits()
- {
- return getDelegate().isSupportingAudits();
- }
-
- /**
- * @since 4.0
- */
- public void setSupportingAudits(boolean on)
- {
- getDelegate().setSupportingAudits(on);
- }
-
- public boolean isSupportingBranches()
- {
- return getDelegate().isSupportingBranches();
- }
-
- public void setSupportingBranches(boolean on)
- {
- getDelegate().setSupportingBranches(on);
- }
-
- /**
- * @since 4.0
- */
- public void addRevision(CDORevision revision)
- {
- getDelegate().addRevision(revision);
- }
-
- public boolean containsRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- return getDelegate().containsRevision(id, branchPoint);
- }
-
- public boolean containsRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- return getDelegate().containsRevisionByVersion(id, branchVersion);
- }
-
- public EClass getObjectType(CDOID id)
- {
- return getDelegate().getObjectType(id);
- }
-
- public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
- boolean loadOnDemand)
- {
- return getDelegate().getRevisionByVersion(id, branchVersion, referenceChunk, loadOnDemand);
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand)
- {
- return getDelegate().getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand);
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand, SyntheticCDORevision[] synthetics)
- {
- return getDelegate().getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics);
- }
-
- public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
- int prefetchDepth, boolean loadOnDemand)
- {
- return getDelegate().getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand);
- }
-
- public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
- int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics)
- {
- return getDelegate().getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics);
- }
-
- public void reviseLatest(CDOID id, CDOBranch branch)
- {
- getDelegate().reviseLatest(id, branch);
- }
-
- public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
- {
- getDelegate().reviseVersion(id, branchVersion, timeStamp);
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- if (isDelegatingLifecycle())
- {
- getDelegate().activate();
- }
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- if (isDelegatingLifecycle())
- {
- getDelegate().deactivate();
- }
- }
-
- protected boolean isDelegatingLifecycle()
- {
- return true;
- }
-
- protected abstract InternalCDORevisionManager getDelegate();
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.revision; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.branch.CDOBranchVersion; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionCache; +import org.eclipse.emf.cdo.common.revision.CDORevisionFactory; + +import org.eclipse.net4j.util.lifecycle.Lifecycle; + +import org.eclipse.emf.ecore.EClass; + +import java.util.List; + +/** + * @author Eike Stepper + * @since 3.0 + */ +public abstract class DelegatingCDORevisionManager extends Lifecycle implements InternalCDORevisionManager +{ + public DelegatingCDORevisionManager() + { + } + + public InternalCDORevisionCache getCache() + { + return getDelegate().getCache(); + } + + /** + * @since 4.0 + */ + public void setCache(CDORevisionCache cache) + { + getDelegate().setCache(cache); + } + + public void setFactory(CDORevisionFactory factory) + { + getDelegate().setFactory(factory); + } + + public CDORevisionFactory getFactory() + { + return getDelegate().getFactory(); + } + + public RevisionLoader getRevisionLoader() + { + return getDelegate().getRevisionLoader(); + } + + public void setRevisionLoader(RevisionLoader revisionLoader) + { + getDelegate().setRevisionLoader(revisionLoader); + } + + public RevisionLocker getRevisionLocker() + { + return getDelegate().getRevisionLocker(); + } + + public void setRevisionLocker(RevisionLocker revisionLocker) + { + getDelegate().setRevisionLocker(revisionLocker); + } + + /** + * @since 4.0 + */ + public boolean isSupportingAudits() + { + return getDelegate().isSupportingAudits(); + } + + /** + * @since 4.0 + */ + public void setSupportingAudits(boolean on) + { + getDelegate().setSupportingAudits(on); + } + + public boolean isSupportingBranches() + { + return getDelegate().isSupportingBranches(); + } + + public void setSupportingBranches(boolean on) + { + getDelegate().setSupportingBranches(on); + } + + /** + * @since 4.0 + */ + public void addRevision(CDORevision revision) + { + getDelegate().addRevision(revision); + } + + public boolean containsRevision(CDOID id, CDOBranchPoint branchPoint) + { + return getDelegate().containsRevision(id, branchPoint); + } + + public boolean containsRevisionByVersion(CDOID id, CDOBranchVersion branchVersion) + { + return getDelegate().containsRevisionByVersion(id, branchVersion); + } + + public EClass getObjectType(CDOID id) + { + return getDelegate().getObjectType(id); + } + + public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk, + boolean loadOnDemand) + { + return getDelegate().getRevisionByVersion(id, branchVersion, referenceChunk, loadOnDemand); + } + + public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, + boolean loadOnDemand) + { + return getDelegate().getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand); + } + + public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, + boolean loadOnDemand, SyntheticCDORevision[] synthetics) + { + return getDelegate().getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics); + } + + public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk, + int prefetchDepth, boolean loadOnDemand) + { + return getDelegate().getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand); + } + + public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk, + int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics) + { + return getDelegate().getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics); + } + + public void reviseLatest(CDOID id, CDOBranch branch) + { + getDelegate().reviseLatest(id, branch); + } + + public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp) + { + getDelegate().reviseVersion(id, branchVersion, timeStamp); + } + + @Override + protected void doActivate() throws Exception + { + if (isDelegatingLifecycle()) + { + getDelegate().activate(); + } + } + + @Override + protected void doDeactivate() throws Exception + { + if (isDelegatingLifecycle()) + { + getDelegate().deactivate(); + } + } + + protected boolean isDelegatingLifecycle() + { + return true; + } + + protected abstract InternalCDORevisionManager getDelegate(); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java index b940ae58a8..885df9b98d 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java @@ -1,69 +1,69 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.emf.ecore.EClass;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public class DetachedCDORevision extends SyntheticCDORevision
-{
- private int version;
-
- private long timeStamp;
-
- private long revised;
-
- public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp)
- {
- this(eClass, id, branch, version, timeStamp, UNSPECIFIED_DATE);
- }
-
- /**
- * @since 4.0
- */
- public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp, long revised)
- {
- super(eClass, id, branch);
- this.version = version;
- this.timeStamp = timeStamp;
- this.revised = revised;
- }
-
- @Override
- public final int getVersion()
- {
- return version;
- }
-
- @Override
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- @Override
- public long getRevised()
- {
- return revised;
- }
-
- @Override
- public void setRevised(long revised)
- {
- this.revised = revised;
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.revision; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.id.CDOID; + +import org.eclipse.emf.ecore.EClass; + +/** + * @author Eike Stepper + * @since 3.0 + */ +public class DetachedCDORevision extends SyntheticCDORevision +{ + private int version; + + private long timeStamp; + + private long revised; + + public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp) + { + this(eClass, id, branch, version, timeStamp, UNSPECIFIED_DATE); + } + + /** + * @since 4.0 + */ + public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp, long revised) + { + super(eClass, id, branch); + this.version = version; + this.timeStamp = timeStamp; + this.revised = revised; + } + + @Override + public final int getVersion() + { + return version; + } + + @Override + public long getTimeStamp() + { + return timeStamp; + } + + @Override + public long getRevised() + { + return revised; + } + + @Override + public void setRevised(long revised) + { + this.revised = revised; + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java index 81cc54549b..0565f45bad 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java @@ -1,57 +1,57 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-
-/**
- * @author Simon McDuff
- * @since 3.0
- */
-public interface InternalCDOFeatureDelta extends CDOFeatureDelta
-{
- /**
- * @author Eike Stepper
- */
- public interface WithIndex
- {
- public void adjustAfterAddition(int index);
-
- public void adjustAfterRemoval(int index);
- }
-
- /**
- * @author Eike Stepper
- */
- public interface ListIndexAffecting
- {
- /**
- * Expects the number of indices in the first element of the indices array.
- */
- public void affectIndices(ListTargetAdding source[], int[] indices);
- }
-
- /**
- * @author Eike Stepper
- */
- public interface ListTargetAdding
- {
- /**
- * @since 4.0
- */
- public Object getValue();
-
- public int getIndex();
-
- public void clear();
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Simon McDuff - initial API and implementation + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.spi.common.revision; + +import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta; + +/** + * @author Simon McDuff + * @since 3.0 + */ +public interface InternalCDOFeatureDelta extends CDOFeatureDelta +{ + /** + * @author Eike Stepper + */ + public interface WithIndex + { + public void adjustAfterAddition(int index); + + public void adjustAfterRemoval(int index); + } + + /** + * @author Eike Stepper + */ + public interface ListIndexAffecting + { + /** + * Expects the number of indices in the first element of the indices array. + */ + public void affectIndices(ListTargetAdding source[], int[] indices); + } + + /** + * @author Eike Stepper + */ + public interface ListTargetAdding + { + /** + * @since 4.0 + */ + public Object getValue(); + + public int getIndex(); + + public void clear(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java index 9960d1fbe1..031717e62f 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java @@ -1,49 +1,49 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public interface InternalCDOList extends CDOList
-{
- public static final Object UNINITIALIZED = CDORevisionUtil.UNINITIALIZED;
-
- /**
- * Adjusts references according to the passed adjuster and resynchronizes indexes.
- *
- * @since 4.0
- */
- public boolean adjustReferences(CDOReferenceAdjuster adjuster, EStructuralFeature feature);
-
- /**
- * Clones the list.
- */
- public InternalCDOList clone(EClassifier classifier);
-
- /**
- * @since 4.0
- */
- public void freeze();
-
- /**
- * @since 4.0
- */
- public void setWithoutFrozenCheck(int i, Object value);
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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: + * Simon McDuff - initial API and implementation + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.spi.common.revision; + +import org.eclipse.emf.cdo.common.revision.CDOList; +import org.eclipse.emf.cdo.common.revision.CDORevisionUtil; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EStructuralFeature; + +/** + * @author Simon McDuff + * @since 2.0 + */ +public interface InternalCDOList extends CDOList +{ + public static final Object UNINITIALIZED = CDORevisionUtil.UNINITIALIZED; + + /** + * Adjusts references according to the passed adjuster and resynchronizes indexes. + * + * @since 4.0 + */ + public boolean adjustReferences(CDOReferenceAdjuster adjuster, EStructuralFeature feature); + + /** + * Clones the list. + */ + public InternalCDOList clone(EClassifier classifier); + + /** + * @since 4.0 + */ + public void freeze(); + + /** + * @since 4.0 + */ + public void setWithoutFrozenCheck(int i, Object value); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java index e753650b93..7297d86c8b 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java @@ -1,37 +1,37 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOAllRevisionsProvider;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public interface InternalCDORevisionCache extends CDORevisionCache, CDOAllRevisionsProvider, ILifecycle
-{
- public InternalCDORevisionCache instantiate(CDORevision revision);
-
- public CDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion);
-
- public void clear();
-
- public List<CDORevision> getRevisions(CDOBranchPoint branchPoint);
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.revision; + +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.branch.CDOBranchVersion; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDOAllRevisionsProvider; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionCache; + +import org.eclipse.net4j.util.lifecycle.ILifecycle; + +import java.util.List; + +/** + * @author Eike Stepper + * @since 3.0 + */ +public interface InternalCDORevisionCache extends CDORevisionCache, CDOAllRevisionsProvider, ILifecycle +{ + public InternalCDORevisionCache instantiate(CDORevision revision); + + public CDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion); + + public void clear(); + + public List<CDORevision> getRevisions(CDOBranchPoint branchPoint); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionDelta.java index ca4cdb0268..27abcbec7d 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionDelta.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionDelta.java @@ -1,51 +1,51 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
- * @since 2.0
- */
-public interface InternalCDORevisionDelta extends CDORevisionDelta, CDOReferenceAdjustable
-{
- /**
- * @since 3.0
- */
- public Map<EStructuralFeature, CDOFeatureDelta> getFeatureDeltaMap();
-
- public void addFeatureDelta(CDOFeatureDelta delta);
-
- /**
- * @since 3.0
- */
- public void setBranch(CDOBranch branch);
-
- /**
- * @since 3.0
- */
- public void setVersion(int version);
-
- /**
- * @since 4.0
- */
- public void setTarget(CDORevisable target);
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.revision; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.revision.CDORevisable; +import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta; +import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import java.util.Map; + +/** + * @author Eike Stepper + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + * @since 2.0 + */ +public interface InternalCDORevisionDelta extends CDORevisionDelta, CDOReferenceAdjustable +{ + /** + * @since 3.0 + */ + public Map<EStructuralFeature, CDOFeatureDelta> getFeatureDeltaMap(); + + public void addFeatureDelta(CDOFeatureDelta delta); + + /** + * @since 3.0 + */ + public void setBranch(CDOBranch branch); + + /** + * @since 3.0 + */ + public void setVersion(int version); + + /** + * @since 4.0 + */ + public void setTarget(CDORevisable target); +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java index 98d9dcf73f..79b85aab76 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java @@ -1,107 +1,107 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public interface InternalCDORevisionManager extends CDORevisionManager, CDORevisionCacheAdder, ILifecycle
-{
- /**
- * @since 4.0
- */
- public boolean isSupportingAudits();
-
- /**
- * @since 4.0
- */
- public void setSupportingAudits(boolean on);
-
- public boolean isSupportingBranches();
-
- public void setSupportingBranches(boolean on);
-
- public RevisionLoader getRevisionLoader();
-
- public void setRevisionLoader(RevisionLoader revisionLoader);
-
- public RevisionLocker getRevisionLocker();
-
- public void setRevisionLocker(RevisionLocker revisionLocker);
-
- public CDORevisionFactory getFactory();
-
- public void setFactory(CDORevisionFactory factory);
-
- public InternalCDORevisionCache getCache();
-
- /**
- * @since 4.0
- */
- public void setCache(CDORevisionCache cache);
-
- /**
- * Called on client via postCommit when there is no version of detached objects available.
- */
- public void reviseLatest(CDOID id, CDOBranch branch);
-
- public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp);
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand, SyntheticCDORevision[] synthetics);
-
- public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
- int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics);
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand);
-
- public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
- boolean loadOnDemand);
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public interface RevisionLoader
- {
- public List<InternalCDORevision> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint,
- int referenceChunk, int prefetchDepth);
-
- public InternalCDORevision loadRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk);
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public interface RevisionLocker
- {
- public void acquireAtomicRequestLock(Object key);
-
- public void releaseAtomicRequestLock(Object key);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.revision; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.branch.CDOBranchVersion; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionCache; +import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder; +import org.eclipse.emf.cdo.common.revision.CDORevisionFactory; +import org.eclipse.emf.cdo.common.revision.CDORevisionManager; + +import org.eclipse.net4j.util.lifecycle.ILifecycle; + +import java.util.List; + +/** + * @author Eike Stepper + * @since 3.0 + */ +public interface InternalCDORevisionManager extends CDORevisionManager, CDORevisionCacheAdder, ILifecycle +{ + /** + * @since 4.0 + */ + public boolean isSupportingAudits(); + + /** + * @since 4.0 + */ + public void setSupportingAudits(boolean on); + + public boolean isSupportingBranches(); + + public void setSupportingBranches(boolean on); + + public RevisionLoader getRevisionLoader(); + + public void setRevisionLoader(RevisionLoader revisionLoader); + + public RevisionLocker getRevisionLocker(); + + public void setRevisionLocker(RevisionLocker revisionLocker); + + public CDORevisionFactory getFactory(); + + public void setFactory(CDORevisionFactory factory); + + public InternalCDORevisionCache getCache(); + + /** + * @since 4.0 + */ + public void setCache(CDORevisionCache cache); + + /** + * Called on client via postCommit when there is no version of detached objects available. + */ + public void reviseLatest(CDOID id, CDOBranch branch); + + public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp); + + public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, + boolean loadOnDemand, SyntheticCDORevision[] synthetics); + + public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk, + int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics); + + public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, + boolean loadOnDemand); + + public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk, + boolean loadOnDemand); + + /** + * @author Eike Stepper + * @since 3.0 + */ + public interface RevisionLoader + { + public List<InternalCDORevision> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint, + int referenceChunk, int prefetchDepth); + + public InternalCDORevision loadRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk); + } + + /** + * @author Eike Stepper + * @since 3.0 + */ + public interface RevisionLocker + { + public void acquireAtomicRequestLock(Object key); + + public void releaseAtomicRequestLock(Object key); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/ManagedRevisionProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/ManagedRevisionProvider.java index 6fd1f59d71..1686321010 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/ManagedRevisionProvider.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/ManagedRevisionProvider.java @@ -1,49 +1,49 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class ManagedRevisionProvider implements CDORevisionProvider
-{
- private CDORevisionManager revisionManager;
-
- private CDOBranchPoint branchPoint;
-
- public ManagedRevisionProvider(CDORevisionManager revisionManager, CDOBranchPoint branchPoint)
- {
- this.branchPoint = branchPoint;
- this.revisionManager = revisionManager;
- }
-
- public CDORevisionManager getRevisionManager()
- {
- return revisionManager;
- }
-
- public CDOBranchPoint getBranchPoint()
- {
- return branchPoint;
- }
-
- public CDORevision getRevision(CDOID id)
- {
- return revisionManager.getRevision(id, branchPoint, CDORevision.UNCHUNKED, CDORevision.DEPTH_NONE, true);
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.revision; + +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionManager; +import org.eclipse.emf.cdo.common.revision.CDORevisionProvider; + +/** + * @author Eike Stepper + * @since 4.0 + */ +public class ManagedRevisionProvider implements CDORevisionProvider +{ + private CDORevisionManager revisionManager; + + private CDOBranchPoint branchPoint; + + public ManagedRevisionProvider(CDORevisionManager revisionManager, CDOBranchPoint branchPoint) + { + this.branchPoint = branchPoint; + this.revisionManager = revisionManager; + } + + public CDORevisionManager getRevisionManager() + { + return revisionManager; + } + + public CDOBranchPoint getBranchPoint() + { + return branchPoint; + } + + public CDORevision getRevision(CDOID id) + { + return revisionManager.getRevision(id, branchPoint, CDORevision.UNCHUNKED, CDORevision.DEPTH_NONE, true); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/PointerCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/PointerCDORevision.java index 1cab3a0ecb..68a7164d63 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/PointerCDORevision.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/PointerCDORevision.java @@ -1,69 +1,69 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.emf.ecore.EClass;
-
-/**
- * A {@link SyntheticCDORevision synthetic} revision that represents the initial period of an object in a
- * {@link CDOBranch branch} when the object is still associated with a revision from one of the baseline branches. It
- * always has {@link #getVersion() version} {@link CDOBranchVersion#UNSPECIFIED_VERSION zero} and can only appear in
- * branches below the {@link CDOBranch#isMainBranch() main} branch.
- *
- * @author Eike Stepper
- * @since 3.0
- */
-public class PointerCDORevision extends SyntheticCDORevision
-{
- private long revised = UNSPECIFIED_DATE;
-
- private CDOBranchVersion target;
-
- public PointerCDORevision(EClass eClass, CDOID id, CDOBranch branch, long revised, CDOBranchVersion target)
- {
- super(eClass, id, branch);
- this.revised = revised;
- this.target = target;
- }
-
- @Override
- public final int getVersion()
- {
- return UNSPECIFIED_VERSION;
- }
-
- @Override
- public long getTimeStamp()
- {
- return getBranch().getBase().getTimeStamp();
- }
-
- @Override
- public long getRevised()
- {
- return revised;
- }
-
- @Override
- public void setRevised(long revised)
- {
- this.revised = revised;
- }
-
- public CDOBranchVersion getTarget()
- {
- return target;
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.revision; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.branch.CDOBranchVersion; +import org.eclipse.emf.cdo.common.id.CDOID; + +import org.eclipse.emf.ecore.EClass; + +/** + * A {@link SyntheticCDORevision synthetic} revision that represents the initial period of an object in a + * {@link CDOBranch branch} when the object is still associated with a revision from one of the baseline branches. It + * always has {@link #getVersion() version} {@link CDOBranchVersion#UNSPECIFIED_VERSION zero} and can only appear in + * branches below the {@link CDOBranch#isMainBranch() main} branch. + * + * @author Eike Stepper + * @since 3.0 + */ +public class PointerCDORevision extends SyntheticCDORevision +{ + private long revised = UNSPECIFIED_DATE; + + private CDOBranchVersion target; + + public PointerCDORevision(EClass eClass, CDOID id, CDOBranch branch, long revised, CDOBranchVersion target) + { + super(eClass, id, branch); + this.revised = revised; + this.target = target; + } + + @Override + public final int getVersion() + { + return UNSPECIFIED_VERSION; + } + + @Override + public long getTimeStamp() + { + return getBranch().getBase().getTimeStamp(); + } + + @Override + public long getRevised() + { + return revised; + } + + @Override + public void setRevised(long revised) + { + this.revised = revised; + } + + public CDOBranchVersion getTarget() + { + return target; + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java index 3fe2ae2dd2..2687010565 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java @@ -1,70 +1,70 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-
-import org.eclipse.emf.ecore.EClass;
-
-/**
- * A synthetic revision that represents the initial period of an object in a {@link CDOBranch branch} when the object is
- * still associated with a revision from one of the baseline branches. It always has {@link #getVersion() version}
- * {@link CDOBranchVersion#UNSPECIFIED_VERSION zero} and can only appear in branches below the
- * {@link CDOBranch#isMainBranch() main} branch.
- * <p>
- * Synthetic revisions are used for two slightly different purposes:
- * <ol>
- * <li>For {@link CDORevisionCache cache} optimization.
- * <li>As a persistent "detach marker" indicating that the first modification of an object in a branch is its deletion.
- * </ol>
- * <p>
- * Instances of this marker revision are not supposed to be exposed outside of a revision {@link CDORevisionManager
- * manager}. They are mainly used in the communication between a revision manager and its associated revision
- * {@link InternalCDORevisionManager.RevisionLoader loader}.
- *
- * @author Eike Stepper
- * @since 3.0
- */
-public abstract class SyntheticCDORevision extends StubCDORevision
-{
- private CDOID id;
-
- private CDOBranch branch;
-
- public SyntheticCDORevision(EClass eClass, CDOID id, CDOBranch branch)
- {
- super(eClass);
- this.id = id;
- this.branch = branch;
- }
-
- @Override
- public CDOID getID()
- {
- return id;
- }
-
- @Override
- public CDOBranch getBranch()
- {
- return branch;
- }
-
- @Override
- public void freeze()
- {
- // Do nothing
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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.spi.common.revision; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.branch.CDOBranchVersion; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.revision.CDORevisionCache; +import org.eclipse.emf.cdo.common.revision.CDORevisionManager; + +import org.eclipse.emf.ecore.EClass; + +/** + * A synthetic revision that represents the initial period of an object in a {@link CDOBranch branch} when the object is + * still associated with a revision from one of the baseline branches. It always has {@link #getVersion() version} + * {@link CDOBranchVersion#UNSPECIFIED_VERSION zero} and can only appear in branches below the + * {@link CDOBranch#isMainBranch() main} branch. + * <p> + * Synthetic revisions are used for two slightly different purposes: + * <ol> + * <li>For {@link CDORevisionCache cache} optimization. + * <li>As a persistent "detach marker" indicating that the first modification of an object in a branch is its deletion. + * </ol> + * <p> + * Instances of this marker revision are not supposed to be exposed outside of a revision {@link CDORevisionManager + * manager}. They are mainly used in the communication between a revision manager and its associated revision + * {@link InternalCDORevisionManager.RevisionLoader loader}. + * + * @author Eike Stepper + * @since 3.0 + */ +public abstract class SyntheticCDORevision extends StubCDORevision +{ + private CDOID id; + + private CDOBranch branch; + + public SyntheticCDORevision(EClass eClass, CDOID id, CDOBranch branch) + { + super(eClass); + this.id = id; + this.branch = branch; + } + + @Override + public CDOID getID() + { + return id; + } + + @Override + public CDOBranch getBranch() + { + return branch; + } + + @Override + public void freeze() + { + // Do nothing + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java index 5488739d64..e588086f1d 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java @@ -1,15 +1,15 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- */
-
-/**
- * Common service provider interfaces and useful base implementations for dealing with revisions and deltas.
- */
-package org.eclipse.emf.cdo.spi.common.revision;
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * 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 + */ + +/** + * Common service provider interfaces and useful base implementations for dealing with revisions and deltas. + */ +package org.eclipse.emf.cdo.spi.common.revision; |