Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2011-01-15 02:53:57 +0000
committerslewis2011-01-15 02:53:57 +0000
commitec9cb7618d514b0a6a4bc0d895ca622cf3305696 (patch)
treebbab89f7165e9b41b3cae52bd1fe977982ea850c /server-side
parente1a95f36c362194b503722d9b0ff1b92bb4cab17 (diff)
downloadorg.eclipse.ecf-ec9cb7618d514b0a6a4bc0d895ca622cf3305696.tar.gz
org.eclipse.ecf-ec9cb7618d514b0a6a4bc0d895ca622cf3305696.tar.xz
org.eclipse.ecf-ec9cb7618d514b0a6a4bc0d895ca622cf3305696.zip
Fixes for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=334448
Diffstat (limited to 'server-side')
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/META-INF/MANIFEST.MF9
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/build.properties5
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/launch/Generic Remote EnvironmentInfo Server.launch23
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/launch/r-OSGi Remote EnvironmentInfo Server.launch22
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/plugin.xml11
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/Activator.java103
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoverableServer.java182
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoveryProperties.java49
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/RemoteEnvironmentInfoImpl.java107
9 files changed, 3 insertions, 508 deletions
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/META-INF/MANIFEST.MF b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/META-INF/MANIFEST.MF
index eb7da04b6..6bdc05db1 100644
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/META-INF/MANIFEST.MF
+++ b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/META-INF/MANIFEST.MF
@@ -2,17 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.examples.remoteservices.server;singleton:=true
-Bundle-Version: 1.0.100.qualifier
+Bundle-Version: 2.0.0.qualifier
Bundle-Localization: plugin
-Bundle-Activator: org.eclipse.ecf.internal.examples.remoteservices.server.Activator
Bundle-Vendor: %plugin.provider
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.ecf.examples.remoteservices.common,
- org.eclipse.ecf,
- org.eclipse.ecf.discovery,
- org.eclipse.ecf.remoteservice
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
J2SE-1.4
Eclipse-LazyStart: true
-Export-Package: org.eclipse.ecf.internal.examples.remoteservices.server;x-friends:="org.eclipse.ecf.examples.remoteservices.server.transparent"
Bundle-ActivationPolicy: lazy
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/build.properties b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/build.properties
index 521e3b5c8..ed973e7de 100644
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/build.properties
+++ b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/build.properties
@@ -4,9 +4,8 @@ bin.includes = META-INF/,\
.,\
about.html,\
plugin.properties,\
- plugin.xml,\
- launch/
+ readme.txt
src.includes = about.html,\
- launch/
+ readme.txt
jre.compilation.profile = J2SE-1.4
javacErrors.. = -assertIdentifier,-enumIdentifier
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/launch/Generic Remote EnvironmentInfo Server.launch b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/launch/Generic Remote EnvironmentInfo Server.launch
deleted file mode 100644
index 35865a7b4..000000000
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/launch/Generic Remote EnvironmentInfo Server.launch
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
-<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="automaticAdd" value="false"/>
-<booleanAttribute key="automaticValidate" value="false"/>
-<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="[NONE]"/>
-<booleanAttribute key="clearConfig" value="false"/>
-<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Generic Remote EnvironmentInfo Server"/>
-<booleanAttribute key="default_auto_start" value="false"/>
-<intAttribute key="default_start_level" value="4"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog -application org.eclipse.ecf.examples.remoteservices.server.remoteServicesServer -debug"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dnet.slp.port=10427&#13;&#10;-Dch.ethz.iks.slp.debug=false&#13;&#10;-Dnet.slp.traceDATraffic=false&#13;&#10;-Dnet.slp.traceMsg=false&#13;&#10;-Dnet.slp.traceDrop=false&#13;&#10;-Dnet.slp.traceReg=false&#13;&#10;-Dnet.slp.failercount=3&#13;&#13;&#10;-Dnet.slp.multicastTimeouts=10,25,50,100,250,500,1000&#13;&#13;&#10;-Dnet.slp.multicastMaximumWait=2000"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<booleanAttribute key="show_selected_only" value="false"/>
-<stringAttribute key="target_bundles" value="org.eclipse.core.runtime@default:true,org.eclipse.core.runtime.compatibility.registry@default:false,org.apache.commons.logging@default:default,org.eclipse.equinox.app@default:default,javax.servlet@default:default,org.eclipse.osgi.services@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi.util@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.common@default:true,org.eclipse.core.jobs@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.osgi@:"/>
-<booleanAttribute key="tracing" value="false"/>
-<booleanAttribute key="useDefaultConfigArea" value="true"/>
-<stringAttribute key="workspace_bundles" value="org.eclipse.ecf.provider@default:default,org.eclipse.ecf.sharedobject@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.ecf.provider.discovery@default:default,org.eclipse.ecf.examples.remoteservices.common@default:default,org.eclipse.ecf.discovery@default:default,org.eclipse.ecf@default:default,ch.ethz.iks.slp@default:default,org.eclipse.ecf.provider.jslp@default:default,org.eclipse.ecf.examples.remoteservices.server@default:default,org.eclipse.ecf.remoteservice@default:default,org.eclipse.ecf.provider.remoteservice@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.jmdns@default:default,org.eclipse.ecf.ssl@default:false"/>
-</launchConfiguration>
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/launch/r-OSGi Remote EnvironmentInfo Server.launch b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/launch/r-OSGi Remote EnvironmentInfo Server.launch
deleted file mode 100644
index c668433c4..000000000
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/launch/r-OSGi Remote EnvironmentInfo Server.launch
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
-<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="automaticAdd" value="false"/>
-<booleanAttribute key="automaticValidate" value="false"/>
-<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="[NONE]"/>
-<booleanAttribute key="clearConfig" value="false"/>
-<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/r-OSGi Remote EnvironmentInfo Server"/>
-<booleanAttribute key="default_auto_start" value="false"/>
-<intAttribute key="default_start_level" value="4"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog -application org.eclipse.ecf.examples.remoteservices.server.remoteServicesServer&#13;&#10;-serviceHostContainerType ecf.r_osgi.peer&#13;&#10;-serviceHostNamespace ecf.namespace.r_osgi&#13;&#10;-serviceHostID r-osgi://localhost:9278&#13;&#10;-clientContainerType ecf.r_osgi.peer&#13;&#10;-clientConnectTarget r-osgi://localhost:9278"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dnet.slp.port=65427&#13;&#10;-Dnet.mdns.port=65353"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<booleanAttribute key="show_selected_only" value="false"/>
-<stringAttribute key="target_bundles" value="org.eclipse.core.commands@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.apache.commons.logging@default:default,org.eclipse.ui.ide@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.resources.compatibility@default:false,org.eclipse.core.resources.win32.x86*3.5.0.v20081020@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.help@default:default,org.eclipse.ui.workbench@default:default,com.ibm.icu@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ant.core@default:default,org.eclipse.ui.views@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.swt.win32.win32.x86*3.5.1.v3555a@default:false,org.eclipse.equinox.security.win32.x86*1.0.100.v20090520-1800@default:false,org.eclipse.ui.forms@default:default,org.eclipse.core.filesystem.win32.x86*1.1.0.v20080604-1400@default:false,org.eclipse.core.variables@default:default,org.eclipse.text@default:default,org.eclipse.core.runtime@default:true,org.eclipse.swt.win32.win32.x86*3.5.0.v3550a@default:false,org.eclipse.equinox.common@2:true,org.eclipse.equinox.registry@default:default,org.eclipse.core.expressions@default:default,org.eclipse.jface.text@default:default,org.eclipse.core.resources@default:default,org.eclipse.osgi.services@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.equinox.app@default:true,org.eclipse.ui.win32*3.2.100.v20090429-1800@default:false,org.objectweb.asm@default:default,org.eclipse.ui.win32*3.2.100.v20090429-1800@default:false,org.eclipse.ui@default:default,org.eclipse.core.filesystem.win32.x86*1.1.0.v20080604-1400@default:false,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.jface@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.resources.win32.x86*3.5.0.v20081020@default:false,org.eclipse.equinox.security.win32.x86*1.0.100.v20090520-1800@default:false,org.eclipse.swt@default:default,org.eclipse.osgi.util@default:default,javax.servlet@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.osgi,org.eclipse.core.jobs@default:default"/>
-<booleanAttribute key="tracing" value="false"/>
-<booleanAttribute key="useDefaultConfigArea" value="true"/>
-<stringAttribute key="workspace_bundles" value="org.eclipse.ecf.provider.jmdns@default:true,org.eclipse.ecf.provider@default:default,org.eclipse.ecf.provider.remoteservice@default:default,org.eclipse.ecf.filetransfer@default:default,ch.ethz.iks.r_osgi.remote@default:default,org.eclipse.emf.common@default:default,org.eclipse.ecf.discovery.ui.edit@default:default,org.eclipse.ecf.remoteservice.ui@default:default,org.eclipse.ecf.discovery.ui.model@default:default,org.eclipse.ecf.discovery.ui@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.discovery.ui.properties@default:false,org.eclipse.ecf.examples.remoteservices.server@default:default,org.eclipse.ecf.sharedobject@default:default,org.eclipse.ecf.provider.discovery@default:true,org.eclipse.ecf.discovery.ui.properties.tabbed@default:false,org.eclipse.emf.edit.ui@default:default,org.eclipse.emf.edit@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.ecf.remoteservice@default:default,org.eclipse.ecf.discovery@default:default,org.eclipse.ecf.examples.remoteservices.client@default:false,org.eclipse.emf.common.ui@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.r_osgi@default:true,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf.examples.remoteservices.common@default:default,org.eclipse.equinox.concurrent@default:default"/>
-</launchConfiguration>
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/plugin.xml b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/plugin.xml
deleted file mode 100644
index 1300a581d..000000000
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/plugin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
-
- <extension id="remoteServicesServer" point="org.eclipse.core.runtime.applications">
- <application cardinality="*" thread="any" visible="true">
- <run class="org.eclipse.ecf.internal.examples.remoteservices.server.DiscoverableServer"/>
- </application>
- </extension>
-
-</plugin>
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/Activator.java b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/Activator.java
deleted file mode 100644
index ec6d2968e..000000000
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/Activator.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
- * Copyright (c) 2008 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.remoteservices.server;
-
-import org.eclipse.ecf.discovery.IDiscoveryAdvertiser;
-import org.eclipse.osgi.service.environment.EnvironmentInfo;
-import org.osgi.framework.*;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator implements BundleActivator {
-
- // The shared instance
- private static Activator plugin;
-
- private BundleContext context;
-
- private ServiceTracker environmentInfoTracker;
-
- private ServiceTracker discoveryTracker;
-
- private Filter filter;
-
- //private DiscoverableServer discoverableServer;
-
- /**
- * The constructor
- */
- public Activator() {
- // nothing
- }
-
- public EnvironmentInfo getEnvironmentInfo() {
- if (environmentInfoTracker == null) {
- environmentInfoTracker = new ServiceTracker(context, org.eclipse.osgi.service.environment.EnvironmentInfo.class.getName(), null);
- environmentInfoTracker.open();
- }
- return (EnvironmentInfo) environmentInfoTracker.getService();
- }
-
- public IDiscoveryAdvertiser getDiscoveryService(int waittime) throws InterruptedException {
- if (discoveryTracker == null) {
- discoveryTracker = new ServiceTracker(context, filter, null);
- discoveryTracker.open();
- }
- return (IDiscoveryAdvertiser) discoveryTracker.waitForService(waittime);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext ctxt) throws Exception {
- plugin = this;
- this.context = ctxt;
- filter = context.createFilter("(&(" + Constants.OBJECTCLASS + "=" + IDiscoveryAdvertiser.class.getName() + ")(" + IDiscoveryAdvertiser.CONTAINER_NAME + "=ecf.discovery.composite))"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // create and start discoverable server
- //discoverableServer = new DiscoverableServer();
- //String[] args = {};
- //discoverableServer.start(args);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext ctxt) throws Exception {
- plugin = null;
- if (environmentInfoTracker != null) {
- environmentInfoTracker.close();
- environmentInfoTracker = null;
- }
- if (discoveryTracker != null) {
- discoveryTracker.close();
- discoveryTracker = null;
- }
- this.context = null;
- //if (discoverableServer != null)
- // discoverableServer.stop();
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoverableServer.java b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoverableServer.java
deleted file mode 100644
index 57bfbba1b..000000000
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoverableServer.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
- * Copyright (c) 2008 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.remoteservices.server;
-
-import java.net.URI;
-import java.util.Properties;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.ecf.core.*;
-import org.eclipse.ecf.core.identity.*;
-import org.eclipse.ecf.discovery.*;
-import org.eclipse.ecf.discovery.identity.IServiceTypeID;
-import org.eclipse.ecf.discovery.identity.ServiceIDFactory;
-import org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo;
-import org.eclipse.ecf.remoteservice.Constants;
-import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-
-/**
- *
- */
-public class DiscoverableServer implements IApplication {
-
- public static final String serviceHostContainerTypeArg = "-serviceHostContainerType"; //$NON-NLS-1$
- public static final String serviceHostNamespaceArg = "-serviceHostNamespace"; //$NON-NLS-1$
- public static final String serviceHostIDArg = "-serviceHostID"; //$NON-NLS-1$
- public static final String clientContainerTypeArg = "-clientContainerType"; //$NON-NLS-1$
- public static final String clientConnectTargetArg = "-clientConnectTarget"; //$NON-NLS-1$
- public static final String serviceTypeArg = "-serviceType"; //$NON-NLS-1$
-
- // Argument variables
- private String serviceHostContainerType = "ecf.generic.server"; //$NON-NLS-1$
- private String serviceHostNamespace = StringID.class.getName();
- private String serviceHostID = "ecftcp://localhost:3285/server"; //$NON-NLS-1$
- private String clientContainerType = "ecf.generic.client"; //$NON-NLS-1$
- private String clientConnectTarget = "ecftcp://localhost:3285/server"; //$NON-NLS-1$
- private String serviceType = "remotesvcs"; //$NON-NLS-1$
-
- private IContainer serviceHostContainer;
-
- private IServiceInfo serviceInfo;
-
- private IDiscoveryAdvertiser discoveryService;
-
- private boolean done = false;
-
- protected IContainer createServiceHostContainer() throws IDCreateException, ContainerCreateException {
- return ContainerFactory.getDefault().createContainer(serviceHostContainerType, IDFactory.getDefault().createID(serviceHostNamespace, serviceHostID));
- }
-
- protected Properties createServiceDiscoveryProperties() {
- Properties props = new Properties();
- props.put(Constants.SERVICE_CONTAINER_ID, serviceHostContainer.getID());
- props.put(Constants.SERVICE_CONTAINER_FACTORY_NAME, serviceHostContainerType);
- // Add auto registration of remote proxy
- props.put(Constants.AUTOREGISTER_REMOTE_PROXY, "true"); //$NON-NLS-1$
- return props;
- }
-
- public void start(String[] args) throws Exception {
- initializeFromArguments(args);
- // Create service host container
- serviceHostContainer = createServiceHostContainer();
- // Get adapter from serviceHostContainer
- final IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) serviceHostContainer.getAdapter(IRemoteServiceContainerAdapter.class);
- Assert.isNotNull(containerAdapter);
-
- final String serviceClassName = IRemoteEnvironmentInfo.class.getName();
-
- // register IRemoteEnvironmentInfo service
- // Then actually register the remote service implementation, with created props
- containerAdapter.registerRemoteService(new String[] {serviceClassName}, new RemoteEnvironmentInfoImpl(), createServiceDiscoveryProperties());
- System.out.println("Registered remote service " + serviceClassName + " with " + serviceHostContainer + ",ID=" + serviceHostContainer.getID()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- // then register for discovery
- discoveryService = Activator.getDefault().getDiscoveryService(15000);
-
- Assert.isNotNull(discoveryService);
-
- final String serviceName = System.getProperty("user.name") + System.currentTimeMillis(); //$NON-NLS-1$
- final IServiceTypeID serviceID = ServiceIDFactory.getDefault().createServiceTypeID(discoveryService.getServicesNamespace(), new String[] {serviceType});
- final Properties serviceProperties = createServicePropertiesForDiscovery(serviceClassName);
- URI uri = new URI(serviceHostID);
- serviceInfo = new ServiceInfo(uri, serviceName, serviceID, 0, 0, new ServiceProperties(serviceProperties));
- // register discovery here
- discoveryService.registerService(serviceInfo);
- System.out.println("service published for discovery\n\tserviceName=" + serviceName + "\n\tserviceTypeID=" + serviceID); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("\tserviceProperties=" + serviceProperties); //$NON-NLS-1$
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
- */
- public Object start(IApplicationContext ctxt) throws Exception {
- // Actually start with application args
- start((String[]) ctxt.getArguments().get("application.args")); //$NON-NLS-1$
- // wait on this thread until done
- synchronized (this) {
- while (!done) {
- wait();
- }
- }
- return new Integer(0);
- }
-
- protected Properties createServicePropertiesForDiscovery(String className) {
- return new DiscoveryProperties(className, clientContainerType, serviceHostNamespace, clientConnectTarget, null, null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.app.IApplication#stop()
- */
- public void stop() {
- if (serviceInfo != null) {
- if (discoveryService != null) {
- discoveryService.unregisterService(serviceInfo);
- serviceInfo = null;
- final IContainer container = (IContainer) discoveryService.getAdapter(IContainer.class);
- if (container != null) {
- container.disconnect();
- }
- discoveryService = null;
- }
- }
- if (serviceHostContainer != null) {
- serviceHostContainer.disconnect();
- serviceHostContainer = null;
- }
- synchronized (this) {
- done = true;
- notifyAll();
- }
-
- }
-
- private void initializeFromArguments(String[] args) throws Exception {
- if (args == null)
- return;
- for (int i = 0; i < args.length; i++) {
- if (args[i].equalsIgnoreCase(serviceHostContainerTypeArg))
- serviceHostContainerType = args[++i];
- else if (args[i].equalsIgnoreCase(serviceHostNamespaceArg))
- serviceHostNamespace = args[++i];
- else if (args[i].equalsIgnoreCase(serviceHostIDArg))
- serviceHostID = args[++i];
- else if (args[i].equalsIgnoreCase(clientContainerTypeArg))
- clientContainerType = args[++i];
- else if (args[i].equalsIgnoreCase(clientConnectTargetArg))
- clientConnectTarget = args[++i];
- else if (args[i].equalsIgnoreCase(serviceTypeArg))
- serviceType = args[++i];
- else {
- usage();
- throw new IllegalArgumentException("Invalid argument"); //$NON-NLS-1$
- }
- }
- }
-
- /**
- *
- */
- private void usage() {
- System.out.println("usage: eclipse -console [options] -application org.eclipse.ecf.examples.remoteservices.server.remoteServicesServer"); //$NON-NLS-1$
- System.out.println(" options: [" + serviceHostContainerTypeArg + " <typename>] default=ecf.generic.server"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(" [" + serviceHostNamespaceArg + " <namespacename>] default=org.eclipse.ecf.identity.StringID"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(" [" + serviceHostIDArg + " <hostID>] default=ecftcp://localhost:3285/server"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(" [" + clientContainerTypeArg + " <typename>] default=ecf.generic.client"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(" [" + clientConnectTargetArg + " <target>] default=ecftcp://localhost:3285/server"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(" [" + serviceTypeArg + " <serviceType>] default=remotesvcs"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-}
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoveryProperties.java b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoveryProperties.java
deleted file mode 100644
index b6871789c..000000000
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/DiscoveryProperties.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.ecf.internal.examples.remoteservices.server;
-
-import java.util.Properties;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.remoteservice.Constants;
-
-public class DiscoveryProperties extends Properties {
-
- private static final long serialVersionUID = -6293580853756989675L;
-
- public DiscoveryProperties(String clazz, String containerFactory, IContainer container) {
- Assert.isNotNull(container);
- Assert.isNotNull(clazz);
- ID connectedID = container.getConnectedID();
- String connectNamespace = (connectedID == null) ? container.getConnectNamespace().getName() : connectedID.getNamespace().getName();
- String connectID = (connectedID == null) ? null : connectedID.getName();
- ID containerID = container.getID();
- String targetNamespace = (containerID == null) ? null : containerID.getNamespace().getName();
- String targetID = (containerID == null) ? null : containerID.getName();
- put(Constants.SERVICE_OBJECTCLASS, clazz);
- Assert.isNotNull(containerFactory);
- put(Constants.SERVICE_CONTAINER_FACTORY_NAME, containerFactory);
- if (connectNamespace != null)
- put(Constants.SERVICE_CONNECT_ID_NAMESPACE, connectNamespace);
- if (connectID != null)
- put(Constants.SERVICE_CONNECT_ID, connectID);
- if (targetNamespace != null)
- put(Constants.SERVICE_IDFILTER_NAMESPACE, targetNamespace);
- if (targetID != null)
- put(Constants.SERVICE_IDFILTER_ID, targetID);
- }
-
- public DiscoveryProperties(String clazz, String containerFactory, String connectNamespace, String connectID, String targetNamespace, String targetID) {
- Assert.isNotNull(clazz);
- put(Constants.SERVICE_OBJECTCLASS, clazz);
- Assert.isNotNull(containerFactory);
- put(Constants.SERVICE_CONTAINER_FACTORY_NAME, containerFactory);
- if (connectNamespace != null)
- put(Constants.SERVICE_CONNECT_ID_NAMESPACE, connectNamespace);
- if (connectID != null)
- put(Constants.SERVICE_CONNECT_ID, connectID);
- if (targetNamespace != null)
- put(Constants.SERVICE_IDFILTER_NAMESPACE, targetNamespace);
- if (targetID != null)
- put(Constants.SERVICE_IDFILTER_ID, targetID);
- }
-} \ No newline at end of file
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/RemoteEnvironmentInfoImpl.java b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/RemoteEnvironmentInfoImpl.java
deleted file mode 100644
index 7aa347c2e..000000000
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.server/src/org/eclipse/ecf/internal/examples/remoteservices/server/RemoteEnvironmentInfoImpl.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
- * Copyright (c) 2008 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.remoteservices.server;
-
-import org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo;
-import org.eclipse.osgi.service.environment.EnvironmentInfo;
-
-/**
- *
- */
-public class RemoteEnvironmentInfoImpl implements IRemoteEnvironmentInfo {
-
- private EnvironmentInfo getEnvironmentInfo() {
- return Activator.getDefault().getEnvironmentInfo();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getCommandLineArgs()
- */
- public String[] getCommandLineArgs() {
- final EnvironmentInfo ei = getEnvironmentInfo();
- System.out.println("getCommandLineArgs()"); //$NON-NLS-1$
- return (ei == null) ? null : ei.getCommandLineArgs();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getFrameworkArgs()
- */
- public String[] getFrameworkArgs() {
- final EnvironmentInfo ei = getEnvironmentInfo();
- System.out.println("getFrameworkArgs()"); //$NON-NLS-1$
- return (ei == null) ? null : ei.getFrameworkArgs();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getNL()
- */
- public String getNL() {
- final EnvironmentInfo ei = getEnvironmentInfo();
- System.out.println("getNL()"); //$NON-NLS-1$
- return (ei == null) ? null : ei.getNL();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getNonFrameworkArgs()
- */
- public String[] getNonFrameworkArgs() {
- final EnvironmentInfo ei = getEnvironmentInfo();
- System.out.println("getNonFrameworkArgs()"); //$NON-NLS-1$
- return (ei == null) ? null : ei.getNonFrameworkArgs();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getOS()
- */
- public String getOS() {
- final EnvironmentInfo ei = getEnvironmentInfo();
- System.out.println("getOS()"); //$NON-NLS-1$
- return (ei == null) ? null : ei.getOS();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getOSArch()
- */
- public String getOSArch() {
- final EnvironmentInfo ei = getEnvironmentInfo();
- System.out.println("getOSArch()"); //$NON-NLS-1$
- return (ei == null) ? null : ei.getOSArch();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#getWS()
- */
- public String getWS() {
- final EnvironmentInfo ei = getEnvironmentInfo();
- System.out.println("getWS()"); //$NON-NLS-1$
- return (ei == null) ? null : ei.getWS();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#inDebugMode()
- */
- public Boolean inDebugMode() {
- final EnvironmentInfo ei = getEnvironmentInfo();
- System.out.println("inDebugMode()"); //$NON-NLS-1$
- return (ei == null) ? null : new Boolean(ei.inDebugMode());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo#inDevelopmentMode()
- */
- public Boolean inDevelopmentMode() {
- final EnvironmentInfo ei = getEnvironmentInfo();
- System.out.println("inDevelopmentMode()"); //$NON-NLS-1$
- return (ei == null) ? null : new Boolean(ei.inDevelopmentMode());
- }
-
-}

Back to the top