Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bundles/org.eclipse.ecf.examples.provider.remoteservice')
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.classpath7
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.project28
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/META-INF/MANIFEST.MF22
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/build.properties6
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/plugin.properties12
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/plugin.xml20
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/examples/provider/remoteservice/identity/RSExampleID.java24
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/examples/provider/remoteservice/identity/RSExampleNamespace.java43
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/internal/examples/provider/remoteservice/container/RSExampleContainer.java281
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/internal/examples/provider/remoteservice/container/RSExampleContainerInstantiator.java47
12 files changed, 502 insertions, 0 deletions
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.classpath b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.classpath
new file mode 100644
index 000000000..2d1a4302f
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.project b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.project
new file mode 100644
index 000000000..ef31131e2
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.ecf.examples.provider.remoteservice</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.settings/org.eclipse.jdt.core.prefs b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..a97b222d4
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 04 13:23:29 PDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.settings/org.eclipse.pde.core.prefs b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..d16699cb3
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Mon Jul 04 13:28:20 PDT 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
+resolve.requirebundle=false
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/META-INF/MANIFEST.MF b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..ef6872792
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundle.name
+Bundle-SymbolicName: org.eclipse.ecf.examples.provider.remoteservice;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: %bundle.provider
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.ecf.core;version="3.0.0",
+ org.eclipse.ecf.core.events,
+ org.eclipse.ecf.core.identity,
+ org.eclipse.ecf.core.provider,
+ org.eclipse.ecf.core.security,
+ org.eclipse.ecf.examples.provider.trivial.identity,
+ org.eclipse.ecf.remoteservice;version="6.0.0",
+ org.eclipse.ecf.remoteservice.events;version="6.0.0",
+ org.eclipse.ecf.remoteservice.util;version="6.0.0",
+ org.eclipse.equinox.concurrent.future;version="1.0.0",
+ org.osgi.framework;version="1.6.0"
+Require-Bundle: org.eclipse.equinox.common;bundle-version="3.6.0"
+Export-Package: org.eclipse.ecf.examples.provider.remoteservice.identity,
+ org.eclipse.ecf.internal.examples.provider.remoteservice.container;x-internal:=true
+Bundle-Localization: plugin
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/build.properties b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/build.properties
new file mode 100644
index 000000000..8665ac2ff
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/plugin.properties b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/plugin.properties
new file mode 100644
index 000000000..26decd979
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/plugin.properties
@@ -0,0 +1,12 @@
+################################################################################
+# Copyright (c) 2011 Composent, Inc. 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:
+# Composent, Inc. - initial API and implementation
+################################################################################
+bundle.name=ECF Example Remoteservice Provider
+bundle.provider=Eclipse.org - ECF \ No newline at end of file
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/plugin.xml b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/plugin.xml
new file mode 100644
index 000000000..8605ad5e4
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ecf.identity.namespace">
+ <namespace
+ class="org.eclipse.ecf.examples.provider.remoteservice.identity.RSExampleNamespace"
+ description="RS Example Namespace"
+ name="ecf.namespace.example.rs">
+ </namespace>
+ </extension>
+ <extension
+ point="org.eclipse.ecf.containerFactory">
+ <containerFactory
+ class="org.eclipse.ecf.internal.examples.provider.remoteservice.container.RSExampleContainerInstantiator"
+ name="ecf.container.example.rs">
+ </containerFactory>
+ </extension>
+
+</plugin>
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/examples/provider/remoteservice/identity/RSExampleID.java b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/examples/provider/remoteservice/identity/RSExampleID.java
new file mode 100644
index 000000000..0e816df4b
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/examples/provider/remoteservice/identity/RSExampleID.java
@@ -0,0 +1,24 @@
+/****************************************************************************
+ * Copyright (c) 2011 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.examples.provider.remoteservice.identity;
+
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.identity.StringID;
+
+public class RSExampleID extends StringID {
+
+ private static final long serialVersionUID = -3656862045346223983L;
+
+ protected RSExampleID(Namespace n, String s) {
+ super(n, s);
+ }
+
+}
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/examples/provider/remoteservice/identity/RSExampleNamespace.java b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/examples/provider/remoteservice/identity/RSExampleNamespace.java
new file mode 100644
index 000000000..e2c6df9a9
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/examples/provider/remoteservice/identity/RSExampleNamespace.java
@@ -0,0 +1,43 @@
+/****************************************************************************
+ * Copyright (c) 2011 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.examples.provider.remoteservice.identity;
+
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.identity.IDCreateException;
+import org.eclipse.ecf.core.identity.Namespace;
+
+public class RSExampleNamespace extends Namespace {
+
+ private static final long serialVersionUID = 1235788855435011811L;
+ public static final String SCHEME = "example";
+ public static final String NAME = "ecf.namespace.example.rs";
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.identity.Namespace#createInstance(java.lang.Object[])
+ */
+ public ID createInstance(Object[] parameters) throws IDCreateException {
+ // XXX Note that this assumes that a unique string is provided for creating the ID
+ // e.g. IDFactory.getDefault().createID("myid");
+ if (parameters == null || parameters.length < 1)
+ throw new IDCreateException("parameters not of correct size");
+ if (!(parameters[0] instanceof String))
+ throw new IDCreateException("parameter not of String type");
+ return new RSExampleID(this, (String) parameters[0]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.identity.Namespace#getScheme()
+ */
+ public String getScheme() {
+ return SCHEME;
+ }
+
+}
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/internal/examples/provider/remoteservice/container/RSExampleContainer.java b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/internal/examples/provider/remoteservice/container/RSExampleContainer.java
new file mode 100644
index 000000000..79178fbfd
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/internal/examples/provider/remoteservice/container/RSExampleContainer.java
@@ -0,0 +1,281 @@
+/****************************************************************************
+ * Copyright (c) 2011 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.internal.examples.provider.remoteservice.container;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.ecf.core.AbstractContainer;
+import org.eclipse.ecf.core.ContainerConnectException;
+import org.eclipse.ecf.core.events.ContainerConnectedEvent;
+import org.eclipse.ecf.core.events.ContainerConnectingEvent;
+import org.eclipse.ecf.core.events.ContainerDisconnectedEvent;
+import org.eclipse.ecf.core.events.ContainerDisconnectingEvent;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.identity.IDCreateException;
+import org.eclipse.ecf.core.identity.IDFactory;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.security.IConnectContext;
+import org.eclipse.ecf.examples.provider.trivial.identity.TrivialNamespace;
+import org.eclipse.ecf.remoteservice.IOSGiRemoteServiceContainerAdapter;
+import org.eclipse.ecf.remoteservice.IRemoteFilter;
+import org.eclipse.ecf.remoteservice.IRemoteService;
+import org.eclipse.ecf.remoteservice.IRemoteServiceCallPolicy;
+import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
+import org.eclipse.ecf.remoteservice.IRemoteServiceID;
+import org.eclipse.ecf.remoteservice.IRemoteServiceListener;
+import org.eclipse.ecf.remoteservice.IRemoteServiceReference;
+import org.eclipse.ecf.remoteservice.IRemoteServiceRegistration;
+import org.eclipse.ecf.remoteservice.events.IRemoteServiceEvent;
+import org.eclipse.ecf.remoteservice.util.RemoteFilterImpl;
+import org.eclipse.equinox.concurrent.future.IFuture;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Trivial container implementation. Note that container adapter implementations can be
+ * provided by the container class to expose appropriate adapters.
+ */
+@SuppressWarnings("restriction")
+public class RSExampleContainer extends AbstractContainer implements IRemoteServiceContainerAdapter, IOSGiRemoteServiceContainerAdapter {
+
+ /*
+ * The targetID. This value is set on 'connect' and unset in 'disconnect'.
+ * This represents the other process that this container is connected to.
+ * Value is returned via getConnectedID()
+ */
+ private ID targetID = null;
+ /*
+ * This is the ID for this container. Returned via getID().
+ */
+ private ID containerID = null;
+
+ public RSExampleContainer() throws IDCreateException {
+ super();
+ this.containerID = IDFactory.getDefault().createGUID();
+ }
+
+ public RSExampleContainer(ID id) {
+ super();
+ Assert.isNotNull(id);
+ this.containerID = id;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainer#connect(org.eclipse.ecf.core.identity.ID,
+ * org.eclipse.ecf.core.security.IConnectContext)
+ */
+ public void connect(ID targetID, IConnectContext connectContext) throws ContainerConnectException {
+ if (!targetID.getNamespace().getName().equals(getConnectNamespace().getName()))
+ throw new ContainerConnectException("targetID not of appropriate Namespace");
+
+ fireContainerEvent(new ContainerConnectingEvent(getID(), targetID));
+
+ // XXX connect to remote service here
+
+ this.targetID = targetID;
+ fireContainerEvent(new ContainerConnectedEvent(getID(), targetID));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainer#disconnect()
+ */
+ public void disconnect() {
+ fireContainerEvent(new ContainerDisconnectingEvent(getID(), targetID));
+
+ final ID oldID = targetID;
+
+ // XXX disconnect here
+
+ fireContainerEvent(new ContainerDisconnectedEvent(getID(), oldID));
+ }
+
+ public void dispose() {
+ disconnect();
+ synchronized (remoteServiceListeners) {
+ remoteServiceListeners.clear();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainer#getConnectNamespace()
+ */
+ public Namespace getConnectNamespace() {
+ return IDFactory.getDefault().getNamespaceByName(TrivialNamespace.NAME);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainer#getConnectedID()
+ */
+ public ID getConnectedID() {
+ return targetID;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.identity.IIdentifiable#getID()
+ */
+ public ID getID() {
+ return containerID;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.AbstractContainer#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class serviceType) {
+ /*
+ * See AbstractContainer.getAdapter() implementation.
+ */
+ return super.getAdapter(serviceType);
+ }
+
+ // IOSGiRemoteServiceContainerAdapter impl. This supercedes the implementation of
+ // IRemoteServiceContainerAdapter.registerRemoteService
+ public IRemoteServiceRegistration registerRemoteService(String[] clazzes,
+ @SuppressWarnings("rawtypes") ServiceReference aServiceReference, @SuppressWarnings("rawtypes") Dictionary properties) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ // IRemoteServiceContainerAdapter impl
+ private List<IRemoteServiceListener> remoteServiceListeners = new ArrayList<IRemoteServiceListener>();
+
+ void fireRemoteServiceEvent(IRemoteServiceEvent event) {
+ List<IRemoteServiceListener> toNotify = null;
+ // Copy array
+ synchronized (remoteServiceListeners) {
+ toNotify = new ArrayList<IRemoteServiceListener>(remoteServiceListeners);
+ }
+ for (IRemoteServiceListener i: toNotify) {
+ i.handleServiceEvent(event);
+ }
+ }
+
+ public void addRemoteServiceListener(IRemoteServiceListener listener) {
+ synchronized (remoteServiceListeners) {
+ remoteServiceListeners.add(listener);
+ }
+ }
+
+ public void removeRemoteServiceListener(IRemoteServiceListener listener) {
+ synchronized (remoteServiceListeners) {
+ remoteServiceListeners.remove(listener);
+ }
+ }
+
+ public IRemoteServiceRegistration registerRemoteService(String[] clazzes,
+ Object service, @SuppressWarnings("rawtypes") Dictionary properties) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IRemoteServiceReference[] getRemoteServiceReferences(ID target,
+ ID[] idFilter, String clazz, String filter)
+ throws InvalidSyntaxException, ContainerConnectException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IFuture asyncGetRemoteServiceReferences(ID target, ID[] idFilter,
+ String clazz, String filter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IRemoteServiceReference[] getRemoteServiceReferences(ID[] idFilter,
+ String clazz, String filter) throws InvalidSyntaxException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IRemoteServiceReference[] getRemoteServiceReferences(ID target,
+ String clazz, String filter) throws InvalidSyntaxException,
+ ContainerConnectException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IFuture asyncGetRemoteServiceReferences(ID[] idFilter, String clazz,
+ String filter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IFuture asyncGetRemoteServiceReferences(ID target, String clazz,
+ String filter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IRemoteServiceReference[] getAllRemoteServiceReferences(
+ String clazz, String filter) throws InvalidSyntaxException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Namespace getRemoteServiceNamespace() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IRemoteServiceID getRemoteServiceID(ID containerID,
+ long containerRelativeID) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IRemoteServiceReference getRemoteServiceReference(
+ IRemoteServiceID serviceID) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IRemoteService getRemoteService(IRemoteServiceReference reference) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean ungetRemoteService(IRemoteServiceReference reference) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public IRemoteFilter createRemoteFilter(String filter)
+ throws InvalidSyntaxException {
+ return new RemoteFilterImpl(filter);
+ }
+
+ public void setConnectContextForAuthentication(
+ IConnectContext connectContext) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean setRemoteServiceCallPolicy(IRemoteServiceCallPolicy policy) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/internal/examples/provider/remoteservice/container/RSExampleContainerInstantiator.java b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/internal/examples/provider/remoteservice/container/RSExampleContainerInstantiator.java
new file mode 100644
index 000000000..3f0c6bed2
--- /dev/null
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.remoteservice/src/org/eclipse/ecf/internal/examples/provider/remoteservice/container/RSExampleContainerInstantiator.java
@@ -0,0 +1,47 @@
+/****************************************************************************
+ * Copyright (c) 2011 Composent, Inc. 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:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.internal.examples.provider.remoteservice.container;
+
+import org.eclipse.ecf.core.ContainerCreateException;
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.IContainer;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.identity.IDCreateException;
+import org.eclipse.ecf.core.identity.IDFactory;
+import org.eclipse.ecf.core.provider.BaseRemoteServiceContainerInstantiator;
+
+public class RSExampleContainerInstantiator extends BaseRemoteServiceContainerInstantiator {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.provider.BaseContainerInstantiator#createInstance(org.eclipse.ecf.core.ContainerTypeDescription, java.lang.Object[])
+ */
+ public IContainer createInstance(ContainerTypeDescription description, Object[] parameters) throws ContainerCreateException {
+ try {
+ if (parameters != null && parameters.length > 0) {
+ if (parameters[0] instanceof ID)
+ return new RSExampleContainer((ID) parameters[0]);
+ if (parameters[0] instanceof String)
+ return new RSExampleContainer(IDFactory.getDefault().createStringID((String) parameters[0]));
+ }
+ return new RSExampleContainer();
+ } catch (final IDCreateException e) {
+ throw new ContainerCreateException("Exception creating ID for trivial container", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.provider.BaseContainerInstantiator#getSupportedAdapterTypes(org.eclipse.ecf.core.ContainerTypeDescription)
+ */
+ public String[] getSupportedAdapterTypes(ContainerTypeDescription description) {
+ // TODO Return String [] with adapter types supported for the given description
+ return super.getSupportedAdapterTypes(description);
+ }
+}

Back to the top