Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.net4j/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CloneRepositoryIndication.java110
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitNotificationRequest.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadBranchesIndication.java67
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRepositoryIndication.java89
7 files changed, 175 insertions, 148 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java
index 1d8c2b4415..e6beb510e9 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java
@@ -12,6 +12,7 @@
package org.eclipse.emf.cdo.server.internal.net4j.protocol;
import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
@@ -100,6 +101,12 @@ public abstract class CDOServerIndication extends IndicationWithResponse
}
@Override
+ protected CDOCommitInfoManager getCommitInfoManager()
+ {
+ return getRepository().getCommitInfoManager();
+ }
+
+ @Override
protected CDORevisionFactory getRevisionFactory()
{
return getRepository().getRevisionManager().getFactory();
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java
index f851e5e447..015ca94cbf 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java
@@ -175,6 +175,9 @@ public class CDOServerProtocol extends SignalProtocol<InternalSession> implement
case CDOProtocolConstants.SIGNAL_LOAD_SUB_BRANCHES:
return new LoadSubBranchesIndication(this);
+ case CDOProtocolConstants.SIGNAL_LOAD_BRANCHES:
+ return new LoadBranchesIndication(this);
+
case CDOProtocolConstants.SIGNAL_LOAD_REVISIONS:
return new LoadRevisionsIndication(this);
@@ -244,8 +247,8 @@ public class CDOServerProtocol extends SignalProtocol<InternalSession> implement
case CDOProtocolConstants.SIGNAL_LOAD_COMMIT_INFOS:
return new LoadCommitInfosIndication(this);
- case CDOProtocolConstants.SIGNAL_CLONE_REPOSITORY:
- return new CloneRepositoryIndication(this);
+ case CDOProtocolConstants.SIGNAL_SYNC_REPOSITORY:
+ return new SyncRepositoryIndication(this);
default:
return super.createSignalReactor(signalID);
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CloneRepositoryIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CloneRepositoryIndication.java
deleted file mode 100644
index 12ec92b664..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CloneRepositoryIndication.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Copyright (c) 2004 - 2010 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.server.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.spi.common.CDOCloningContext;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.net4j.util.WrappedException;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class CloneRepositoryIndication extends CDOServerIndication
-{
- private long startTime;
-
- private long endTime;
-
- private int branchID;
-
- public CloneRepositoryIndication(CDOServerProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_CLONE_REPOSITORY);
- }
-
- @Override
- protected void indicating(CDODataInput in) throws IOException
- {
- startTime = in.readLong();
- endTime = in.readLong();
- branchID = in.readInt();
- }
-
- @Override
- protected void responding(final CDODataOutput out) throws IOException
- {
- getRepository().clone(new CDOCloningContext()
- {
- public long getStartTime()
- {
- return startTime;
- }
-
- public long getEndTime()
- {
- return endTime;
- }
-
- public int getBranchID()
- {
- return branchID;
- }
-
- public void addPackageUnit(String id)
- {
- try
- {
- out.writeByte(CDOProtocolConstants.CLONING_PACKAGE);
- out.writeString(id);
- }
- catch (IOException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- public void addBranch(int id)
- {
- try
- {
- out.writeByte(CDOProtocolConstants.CLONING_BRANCH);
- out.writeInt(id);
- }
- catch (IOException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- public void addRevision(InternalCDORevision revision)
- {
- try
- {
- out.writeByte(CDOProtocolConstants.CLONING_REVISION);
- out.writeCDORevision(revision, CDORevision.UNCHUNKED);
- }
- catch (IOException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
- });
-
- out.writeByte(CDOProtocolConstants.CLONING_FINISHED);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitNotificationRequest.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitNotificationRequest.java
index 8db697e489..389e60643f 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitNotificationRequest.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitNotificationRequest.java
@@ -35,41 +35,5 @@ public class CommitNotificationRequest extends CDOServerRequest
protected void requesting(CDODataOutput out) throws IOException
{
out.writeCDOCommitInfo(commitInfo);
-
- // if (TRACER.isEnabled())
- // {
- // TRACER.format("Writing branchPoint: {0}", branchPoint); //$NON-NLS-1$
- // }
- //
- // out.writeCDOBranchPoint(branchPoint);
- // if (TRACER.isEnabled())
- // {
- // TRACER.format("Writing {0} dirty IDs", dirtyIDs.size()); //$NON-NLS-1$
- // }
- //
- // out.writeCDOPackageUnits(packageUnits);
- //
- // out.writeInt(dirtyIDs == null ? 0 : dirtyIDs.size());
- // for (CDOIDAndVersion dirtyID : dirtyIDs)
- // {
- // if (TRACER.isEnabled())
- // {
- // TRACER.format("Writing dirty ID: {0}", dirtyID); //$NON-NLS-1$
- // }
- //
- // out.writeCDOIDAndVersion(dirtyID);
- // }
- //
- // out.writeInt(deltas == null ? 0 : deltas.size());
- // for (CDORevisionDelta delta : deltas)
- // {
- // out.writeCDORevisionDelta(delta);
- // }
- //
- // out.writeInt(detachedObjects == null ? 0 : detachedObjects.size());
- // for (CDOID id : detachedObjects)
- // {
- // out.writeCDOID(id);
- // }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
index eab3b008c8..efa900f39f 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
@@ -14,6 +14,7 @@
package org.eclipse.emf.cdo.server.internal.net4j.protocol;
import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
@@ -132,6 +133,12 @@ public class CommitTransactionIndication extends IndicationWithMonitoring
}
@Override
+ protected CDOCommitInfoManager getCommitInfoManager()
+ {
+ return CommitTransactionIndication.this.getRepository().getCommitInfoManager();
+ }
+
+ @Override
protected CDORevisionFactory getRevisionFactory()
{
return CommitTransactionIndication.this.getRepository().getRevisionManager().getFactory();
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadBranchesIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadBranchesIndication.java
new file mode 100644
index 0000000000..370810c966
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LoadBranchesIndication.java
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2004 - 2010 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.server.internal.net4j.protocol;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
+import org.eclipse.emf.cdo.common.io.CDODataInput;
+import org.eclipse.emf.cdo.common.io.CDODataOutput;
+import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
+
+import org.eclipse.net4j.util.WrappedException;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public class LoadBranchesIndication extends CDOReadIndication
+{
+ private int startID;
+
+ private int endID;
+
+ public LoadBranchesIndication(CDOServerProtocol protocol)
+ {
+ super(protocol, CDOProtocolConstants.SIGNAL_LOAD_BRANCHES);
+ }
+
+ @Override
+ protected void indicating(CDODataInput in) throws IOException
+ {
+ startID = in.readInt();
+ endID = in.readInt();
+ }
+
+ @Override
+ protected void responding(final CDODataOutput out) throws IOException
+ {
+ InternalCDOBranchManager branchManager = getRepository().getBranchManager();
+ branchManager.getBranches(startID, endID, new CDOBranchHandler()
+ {
+ public void handleBranch(CDOBranch branch)
+ {
+ try
+ {
+ out.writeByte(CDOProtocolConstants.SYNC_BRANCH);
+ out.writeCDOBranch(branch);
+ }
+ catch (IOException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+ });
+
+ out.writeByte(CDOProtocolConstants.SYNC_FINISHED);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRepositoryIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRepositoryIndication.java
new file mode 100644
index 0000000000..40e8359506
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/SyncRepositoryIndication.java
@@ -0,0 +1,89 @@
+/**
+ * Copyright (c) 2004 - 2010 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.server.internal.net4j.protocol;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.io.CDODataInput;
+import org.eclipse.emf.cdo.common.io.CDODataOutput;
+import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
+import org.eclipse.emf.cdo.spi.common.CDOReplicationContext;
+
+import org.eclipse.net4j.util.WrappedException;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public class SyncRepositoryIndication extends CDOServerIndication
+{
+ private int lastReplicatedBranchID;
+
+ private long lastReplicatedCommitTime;
+
+ public SyncRepositoryIndication(CDOServerProtocol protocol)
+ {
+ super(protocol, CDOProtocolConstants.SIGNAL_SYNC_REPOSITORY);
+ }
+
+ @Override
+ protected void indicating(CDODataInput in) throws IOException
+ {
+ lastReplicatedBranchID = in.readInt();
+ lastReplicatedCommitTime = in.readLong();
+ }
+
+ @Override
+ protected void responding(final CDODataOutput out) throws IOException
+ {
+ getRepository().sync(new CDOReplicationContext()
+ {
+ public int getLastReplicatedBranchID()
+ {
+ return lastReplicatedBranchID;
+ }
+
+ public long getLastReplicatedCommitTime()
+ {
+ return lastReplicatedCommitTime;
+ }
+
+ public void handleBranch(CDOBranch branch)
+ {
+ try
+ {
+ out.writeByte(CDOProtocolConstants.SYNC_BRANCH);
+ out.writeCDOBranch(branch);
+ }
+ catch (IOException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ public void handleCommitInfo(CDOCommitInfo commitInfo)
+ {
+ try
+ {
+ out.writeByte(CDOProtocolConstants.SYNC_COMMIT);
+ out.writeCDOCommitInfo(commitInfo);
+ }
+ catch (IOException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+ });
+
+ out.writeByte(CDOProtocolConstants.SYNC_FINISHED);
+ }
+}

Back to the top