Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-06-09 07:39:30 +0000
committerEike Stepper2012-06-09 07:39:30 +0000
commit5a27a212d44a369d6a83e2cae0d99fd935ec5bd1 (patch)
treec0d96b7bebe4d2dc93aacd48a2314b0ebbda80db /plugins/org.eclipse.emf.cdo.admin
parenta585f0a578c8f0f5c0f480be6f4876bbba11d021 (diff)
downloadcdo-5a27a212d44a369d6a83e2cae0d99fd935ec5bd1.tar.gz
cdo-5a27a212d44a369d6a83e2cae0d99fd935ec5bd1.tar.xz
cdo-5a27a212d44a369d6a83e2cae0d99fd935ec5bd1.zip
[381472] Design a repository administration API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=381472
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.admin')
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/.settings/.api_filters10
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClient.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientImpl.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java (renamed from plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepository.java)29
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/CDOAdminClientProtocol.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/QueryRepositoriesRequest.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/RepositoryAddedIndication.java4
9 files changed, 126 insertions, 26 deletions
diff --git a/plugins/org.eclipse.emf.cdo.admin/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.admin/.settings/.api_filters
index 4b4e442f35..76dc368cfc 100644
--- a/plugins/org.eclipse.emf.cdo.admin/.settings/.api_filters
+++ b/plugins/org.eclipse.emf.cdo.admin/.settings/.api_filters
@@ -8,18 +8,20 @@
</message_arguments>
</filter>
</resource>
- <resource path="src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepository.java" type="org.eclipse.emf.cdo.internal.admin.CDOAdminClientRepository">
- <filter id="574619656">
+ <resource path="src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java" type="org.eclipse.emf.cdo.admin.CDOAdminClientRepository">
+ <filter id="571473929">
<message_arguments>
<message_argument value="CDOAdminRepository"/>
<message_argument value="CDOAdminClientRepository"/>
</message_arguments>
</filter>
+ </resource>
+ <resource path="src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java" type="org.eclipse.emf.cdo.internal.admin.CDOAdminClientRepositoryImpl">
<filter id="574660632">
<message_arguments>
- <message_argument value="CDOAdminRepository"/>
- <message_argument value="CDOCommonRepository"/>
<message_argument value="CDOAdminClientRepository"/>
+ <message_argument value="CDOAdminRepository"/>
+ <message_argument value="CDOAdminClientRepositoryImpl"/>
</message_arguments>
</filter>
</resource>
diff --git a/plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF
index ab967578ff..310309cc10 100644
--- a/plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF
@@ -9,7 +9,8 @@ Bundle-Localization: plugin
Bundle-Activator: org.eclipse.emf.cdo.internal.admin.bundle.OM$Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.emf.cdo.common;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
+ org.eclipse.emf.cdo;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
+ org.eclipse.emf.cdo.net4j;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.net4j;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
Export-Package: org.eclipse.emf.cdo.admin;version="4.1.0",
org.eclipse.emf.cdo.internal.admin;version="4.1.0";
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClient.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClient.java
index b44afd1600..1064542646 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClient.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClient.java
@@ -12,8 +12,11 @@ package org.eclipse.emf.cdo.admin;
import org.eclipse.emf.cdo.common.admin.CDOAdmin;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.util.event.IEvent;
+import java.util.Map;
+
/**
* A client-side {@link CDOAdmin administrative interface}.
* <p>
@@ -30,6 +33,16 @@ public interface CDOAdminClient extends CDOAdmin
public boolean isConnected();
+ public IConnector getConnector();
+
+ public CDOAdminClientRepository[] getRepositories();
+
+ public CDOAdminClientRepository getRepository(String name);
+
+ public CDOAdminClientRepository createRepository(String name, String type, Map<String, Object> properties);
+
+ public CDOAdminClientRepository waitForRepository(String name);
+
/**
* An {@link IEvent event} fired from a client-side {@link CDOAdminClient administrative interface}
* after the connection {@link CDOAdminClient#isConnected() state} has changed.
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java
new file mode 100644
index 0000000000..10940ae110
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/admin/CDOAdminClientRepository.java
@@ -0,0 +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.admin;
+
+import org.eclipse.emf.cdo.common.admin.CDOAdminRepository;
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOAdminClientRepository extends CDOAdminRepository
+{
+ public CDOAdminClient getAdmin();
+
+ public CDONet4jSession openSession();
+}
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientImpl.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientImpl.java
index 987911ca49..95eae502c5 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientImpl.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientImpl.java
@@ -11,13 +11,14 @@
package org.eclipse.emf.cdo.internal.admin;
import org.eclipse.emf.cdo.admin.CDOAdminClient;
+import org.eclipse.emf.cdo.admin.CDOAdminClientRepository;
import org.eclipse.emf.cdo.common.CDOCommonRepository.State;
import org.eclipse.emf.cdo.common.CDOCommonRepository.Type;
-import org.eclipse.emf.cdo.common.admin.CDOAdminRepository;
import org.eclipse.emf.cdo.internal.admin.bundle.OM;
import org.eclipse.emf.cdo.internal.admin.protocol.CDOAdminClientProtocol;
import org.eclipse.emf.cdo.spi.common.admin.AbstractCDOAdmin;
+import org.eclipse.net4j.channel.IChannelMultiplexer;
import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.util.concurrent.ExecutorServiceFactory;
import org.eclipse.net4j.util.container.IManagedContainer;
@@ -77,9 +78,49 @@ public class CDOAdminClientImpl extends AbstractCDOAdmin implements CDOAdminClie
return connected;
}
+ public IConnector getConnector()
+ {
+ if (!connected)
+ {
+ return null;
+ }
+
+ IChannelMultiplexer multiplexer = protocol.getChannel().getMultiplexer();
+ if (multiplexer instanceof IConnector)
+ {
+ return (IConnector)multiplexer;
+ }
+
+ return null;
+ }
+
+ @Override
+ public CDOAdminClientRepository[] getRepositories()
+ {
+ return (CDOAdminClientRepository[])super.getRepositories();
+ }
+
+ @Override
+ public synchronized CDOAdminClientRepository getRepository(String name)
+ {
+ return (CDOAdminClientRepository)super.getRepository(name);
+ }
+
+ @Override
+ public CDOAdminClientRepository createRepository(String name, String type, Map<String, Object> properties)
+ {
+ return (CDOAdminClientRepository)super.createRepository(name, type, properties);
+ }
+
+ @Override
+ public CDOAdminClientRepository waitForRepository(String name)
+ {
+ return (CDOAdminClientRepository)super.waitForRepository(name);
+ }
+
public void repositoryTypeChanged(String name, Type oldType, Type newType)
{
- CDOAdminClientRepository repository = (CDOAdminClientRepository)getRepository(name);
+ CDOAdminClientRepositoryImpl repository = (CDOAdminClientRepositoryImpl)getRepository(name);
if (repository != null)
{
repository.typeChanged(oldType, newType);
@@ -88,7 +129,7 @@ public class CDOAdminClientImpl extends AbstractCDOAdmin implements CDOAdminClie
public void repositoryStateChanged(String name, State oldState, State newState)
{
- CDOAdminClientRepository repository = (CDOAdminClientRepository)getRepository(name);
+ CDOAdminClientRepositoryImpl repository = (CDOAdminClientRepositoryImpl)getRepository(name);
if (repository != null)
{
repository.stateChanged(oldState, newState);
@@ -97,7 +138,7 @@ public class CDOAdminClientImpl extends AbstractCDOAdmin implements CDOAdminClie
public void repositoryReplicationProgressed(String name, double totalWork, double work)
{
- CDOAdminClientRepository repository = (CDOAdminClientRepository)getRepository(name);
+ CDOAdminClientRepositoryImpl repository = (CDOAdminClientRepositoryImpl)getRepository(name);
if (repository != null)
{
repository.replicationProgressed(totalWork, work);
@@ -270,8 +311,8 @@ public class CDOAdminClientImpl extends AbstractCDOAdmin implements CDOAdminClie
}
});
- Set<CDOAdminRepository> repositories = protocol.queryRepositories();
- for (CDOAdminRepository repository : repositories)
+ Set<CDOAdminClientRepository> repositories = protocol.queryRepositories();
+ for (CDOAdminClientRepository repository : repositories)
{
addElement(repository);
}
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/CDOAdminClientRepositoryImpl.java
index 777781419a..e17dee4208 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/CDOAdminClientRepositoryImpl.java
@@ -10,14 +10,18 @@
*/
package org.eclipse.emf.cdo.internal.admin;
-import org.eclipse.emf.cdo.common.admin.CDOAdmin;
-import org.eclipse.emf.cdo.common.admin.CDOAdminRepository;
+import org.eclipse.emf.cdo.admin.CDOAdminClient;
+import org.eclipse.emf.cdo.admin.CDOAdminClientRepository;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOID.ObjectType;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.util.RepositoryStateChangedEvent;
import org.eclipse.emf.cdo.common.util.RepositoryTypeChangedEvent;
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.util.event.Notifier;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.om.monitor.NotifyingMonitor;
@@ -29,7 +33,7 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public class CDOAdminClientRepository extends Notifier implements CDOAdminRepository
+public class CDOAdminClientRepositoryImpl extends Notifier implements CDOAdminClientRepository
{
private CDOAdminClientImpl admin;
@@ -59,7 +63,7 @@ public class CDOAdminClientRepository extends Notifier implements CDOAdminReposi
private IDGenerationLocation idGenerationLocation;
- public CDOAdminClientRepository(CDOAdminClientImpl admin, ExtendedDataInputStream in) throws IOException
+ public CDOAdminClientRepositoryImpl(CDOAdminClientImpl admin, ExtendedDataInputStream in) throws IOException
{
this.admin = admin;
name = in.readString();
@@ -85,7 +89,7 @@ public class CDOAdminClientRepository extends Notifier implements CDOAdminReposi
idGenerationLocation = in.readEnum(IDGenerationLocation.class);
}
- public CDOAdmin getAdmin()
+ public CDOAdminClient getAdmin()
{
return admin;
}
@@ -165,6 +169,21 @@ public class CDOAdminClientRepository extends Notifier implements CDOAdminReposi
return admin.deleteRepository(this, type);
}
+ public CDONet4jSession openSession()
+ {
+ IConnector connector = admin.getConnector();
+ if (connector == null)
+ {
+ return null;
+ }
+
+ CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName(name);
+
+ return configuration.openNet4jSession();
+ }
+
@Override
public String toString()
{
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 94b6ed427e..23f826c778 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
@@ -10,7 +10,7 @@
*/
package org.eclipse.emf.cdo.internal.admin.protocol;
-import org.eclipse.emf.cdo.common.admin.CDOAdminRepository;
+import org.eclipse.emf.cdo.admin.CDOAdminClientRepository;
import org.eclipse.emf.cdo.common.util.TransportException;
import org.eclipse.emf.cdo.internal.admin.CDOAdminClientImpl;
import org.eclipse.emf.cdo.spi.common.admin.CDOAdminProtocolConstants;
@@ -33,7 +33,7 @@ public class CDOAdminClientProtocol extends SignalProtocol<CDOAdminClientImpl>
setInfraStructure(admin);
}
- public Set<CDOAdminRepository> queryRepositories()
+ public Set<CDOAdminClientRepository> queryRepositories()
{
return send(new QueryRepositoriesRequest(this));
}
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/QueryRepositoriesRequest.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/QueryRepositoriesRequest.java
index 3cebca8b6c..f70d300e13 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/QueryRepositoriesRequest.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/QueryRepositoriesRequest.java
@@ -10,9 +10,9 @@
*/
package org.eclipse.emf.cdo.internal.admin.protocol;
-import org.eclipse.emf.cdo.common.admin.CDOAdminRepository;
+import org.eclipse.emf.cdo.admin.CDOAdminClientRepository;
import org.eclipse.emf.cdo.internal.admin.CDOAdminClientImpl;
-import org.eclipse.emf.cdo.internal.admin.CDOAdminClientRepository;
+import org.eclipse.emf.cdo.internal.admin.CDOAdminClientRepositoryImpl;
import org.eclipse.emf.cdo.internal.admin.bundle.OM;
import org.eclipse.emf.cdo.spi.common.admin.CDOAdminProtocolConstants;
@@ -27,7 +27,7 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public class QueryRepositoriesRequest extends RequestWithConfirmation<Set<CDOAdminRepository>>
+public class QueryRepositoriesRequest extends RequestWithConfirmation<Set<CDOAdminClientRepository>>
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryRepositoriesRequest.class);
@@ -43,7 +43,7 @@ public class QueryRepositoriesRequest extends RequestWithConfirmation<Set<CDOAdm
}
@Override
- protected Set<CDOAdminRepository> confirming(ExtendedDataInputStream in) throws Exception
+ protected Set<CDOAdminClientRepository> confirming(ExtendedDataInputStream in) throws Exception
{
CDOAdminClientProtocol protocol = (CDOAdminClientProtocol)getProtocol();
CDOAdminClientImpl admin = protocol.getInfraStructure();
@@ -54,10 +54,10 @@ public class QueryRepositoriesRequest extends RequestWithConfirmation<Set<CDOAdm
TRACER.format("Reading {0} repository infos...", size); //$NON-NLS-1$
}
- Set<CDOAdminRepository> result = new HashSet<CDOAdminRepository>();
+ Set<CDOAdminClientRepository> result = new HashSet<CDOAdminClientRepository>();
for (int i = 0; i < size; i++)
{
- CDOAdminClientRepository repository = new CDOAdminClientRepository(admin, in);
+ CDOAdminClientRepositoryImpl repository = new CDOAdminClientRepositoryImpl(admin, in);
result.add(repository);
if (TRACER.isEnabled())
{
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/RepositoryAddedIndication.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/RepositoryAddedIndication.java
index a64de728ff..50558de2f5 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/RepositoryAddedIndication.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/protocol/RepositoryAddedIndication.java
@@ -11,7 +11,7 @@
package org.eclipse.emf.cdo.internal.admin.protocol;
import org.eclipse.emf.cdo.internal.admin.CDOAdminClientImpl;
-import org.eclipse.emf.cdo.internal.admin.CDOAdminClientRepository;
+import org.eclipse.emf.cdo.internal.admin.CDOAdminClientRepositoryImpl;
import org.eclipse.emf.cdo.spi.common.admin.CDOAdminProtocolConstants;
import org.eclipse.net4j.signal.Indication;
@@ -33,7 +33,7 @@ public class RepositoryAddedIndication extends Indication
CDOAdminClientProtocol protocol = (CDOAdminClientProtocol)getProtocol();
CDOAdminClientImpl admin = protocol.getInfraStructure();
- CDOAdminClientRepository repository = new CDOAdminClientRepository(admin, in);
+ CDOAdminClientRepositoryImpl repository = new CDOAdminClientRepositoryImpl(admin, in);
admin.addElement(repository);
}
}

Back to the top