Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-06-03 10:35:49 +0000
committerEike Stepper2012-06-03 10:35:49 +0000
commita66523b6c1a7059184d07a2d6e08b490816cd475 (patch)
tree400c7e354b8597785d3451ef87348b63b489698e /plugins/org.eclipse.emf.cdo.admin
parentd8e62434bca5480541b758b2face74e1080e9718 (diff)
downloadcdo-a66523b6c1a7059184d07a2d6e08b490816cd475.tar.gz
cdo-a66523b6c1a7059184d07a2d6e08b490816cd475.tar.xz
cdo-a66523b6c1a7059184d07a2d6e08b490816cd475.zip
[381472] Design a repository administration API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=381472 Add notification for replication progress.
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.admin')
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClient.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepository.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/CDOAdminClientProtocol.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/RepositoryReplicationProgressedIndication.java40
4 files changed, 58 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClient.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClient.java
index 9e52167ef4..a2456bd5f8 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClient.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClient.java
@@ -58,6 +58,15 @@ public class CDOAdminClient extends AbstractCDOAdmin
}
}
+ public void repositoryReplicationProgressed(String name, double totalWork, double work)
+ {
+ CDOAdminClientRepository repository = (CDOAdminClientRepository)getRepository(name);
+ if (repository != null)
+ {
+ repository.replicationProgressed(totalWork, work);
+ }
+ }
+
@Override
protected boolean doCreateRepository(String name, String type, Map<String, Object> properties)
{
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepository.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepository.java
index 156e7e6608..a82e767fdb 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepository.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepository.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent;
import org.eclipse.net4j.util.event.Notifier;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.om.monitor.NotifyingMonitor;
import java.io.IOException;
import java.util.HashSet;
@@ -180,4 +181,9 @@ public class CDOAdminClientRepository extends Notifier implements CDOAdminReposi
state = newState;
fireEvent(new RepositoryStateChangedEvent(this, oldState, newState));
}
+
+ public void replicationProgressed(double totalWork, double work)
+ {
+ fireEvent(new NotifyingMonitor.ProgressEvent(this, totalWork, work));
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/CDOAdminClientProtocol.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/CDOAdminClientProtocol.java
index ccbed1981d..91d88a05ad 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/CDOAdminClientProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/CDOAdminClientProtocol.java
@@ -66,6 +66,9 @@ public class CDOAdminClientProtocol extends SignalProtocol<CDOAdminClient>
case CDOAdminProtocolConstants.SIGNAL_REPOSITORY_STATE_CHANGED:
return new RepositoryStateChangedIndication(this);
+ case CDOAdminProtocolConstants.SIGNAL_REPOSITORY_REPLICATION_PROGRESSED:
+ return new RepositoryReplicationProgressedIndication(this);
+
default:
return super.createSignalReactor(signalID);
}
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/RepositoryReplicationProgressedIndication.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/RepositoryReplicationProgressedIndication.java
new file mode 100644
index 0000000000..827407c1dd
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/RepositoryReplicationProgressedIndication.java
@@ -0,0 +1,40 @@
+/*
+ * 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.internal.admin.protocol;
+
+import org.eclipse.emf.cdo.internal.admin.CDOAdminClient;
+import org.eclipse.emf.cdo.spi.common.admin.CDOAdminProtocolConstants;
+
+import org.eclipse.net4j.signal.Indication;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public class RepositoryReplicationProgressedIndication extends Indication
+{
+ public RepositoryReplicationProgressedIndication(CDOAdminClientProtocol protocol)
+ {
+ super(protocol, CDOAdminProtocolConstants.SIGNAL_REPOSITORY_REPLICATION_PROGRESSED);
+ }
+
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws Exception
+ {
+ CDOAdminClientProtocol protocol = (CDOAdminClientProtocol)getProtocol();
+ CDOAdminClient admin = protocol.getInfraStructure();
+
+ String name = in.readString();
+ double totalWork = in.readDouble();
+ double work = in.readDouble();
+ admin.repositoryReplicationProgressed(name, totalWork, work);
+ }
+}

Back to the top