diff options
author | slewis | 2009-12-30 16:30:34 -0500 |
---|---|---|
committer | slewis | 2009-12-30 16:30:34 -0500 |
commit | 2a5637b62201ef7849f2209c59b56126e9265e36 (patch) | |
tree | 96168679c9609223ec5361dfb44f1326212f3d5f | |
parent | 69965cdda612ad693dc393c53037fb4403164bb4 (diff) | |
download | org.eclipse.ecf-2a5637b62201ef7849f2209c59b56126e9265e36.tar.gz org.eclipse.ecf-2a5637b62201ef7849f2209c59b56126e9265e36.tar.xz org.eclipse.ecf-2a5637b62201ef7849f2209c59b56126e9265e36.zip |
Initial checkin of DS version of hello remote services example
13 files changed, 303 insertions, 0 deletions
diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/.classpath b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/.classpath new file mode 100644 index 000000000..64c5e31b7 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/.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.remoteservices.hello.ds.consumer/.project b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/.project new file mode 100644 index 000000000..425969c9b --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/.project @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ecf.examples.remoteservices.hello.ds.consumer</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> + <buildCommand> + <name>org.eclipse.pde.ds.core.builder</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.remoteservices.hello.ds.consumer/.settings/org.eclipse.jdt.core.prefs b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..27484a833 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Dec 30 12:39:19 PST 2009 +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.remoteservices.hello.ds.consumer/.settings/org.eclipse.pde.core.prefs b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..b3b2273dd --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Wed Dec 30 12:54:03 PST 2009 +eclipse.preferences.version=1 +pluginProject.extensions=true +resolve.requirebundle=false diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/META-INF/MANIFEST.MF b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/META-INF/MANIFEST.MF new file mode 100644 index 000000000..4f0ff3267 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %bundleName +Bundle-SymbolicName: org.eclipse.ecf.examples.remoteservices.hello.ds.consumer;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: %bundleProvider +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.equinox.common;bundle-version="3.5.1" +Import-Package: org.eclipse.ecf.core;version="3.0.0", + org.eclipse.ecf.core.identity;version="3.0.0", + org.eclipse.ecf.examples.remoteservices.hello, + org.eclipse.ecf.remoteservice, + org.eclipse.ecf.remoteservice.events, + org.eclipse.equinox.app;version="1.0.0", + org.osgi.service.component;version="1.1.0" +Service-Component: OSGI-INF/helloclient.xml +Bundle-Localization: bundle diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/OSGI-INF/helloclient.xml b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/OSGI-INF/helloclient.xml new file mode 100644 index 000000000..bafae52e8 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/OSGI-INF/helloclient.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" immediate="true" name="org.eclipse.ecf.examples.remoteservices.hello.ds.consumer"> + <implementation class="org.eclipse.ecf.examples.internal.remoteservices.hello.ds.consumer.HelloClientComponent"/> + <reference bind="bindRemoteService" cardinality="0..n" interface="org.eclipse.ecf.examples.remoteservices.hello.IHello" name="IHello" policy="dynamic"/> + <reference bind="setContainerFactory" cardinality="1..1" interface="org.eclipse.ecf.core.IContainerFactory" name="IContainerFactory" policy="static"/> +</scr:component> diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/about.html b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/about.html new file mode 100644 index 000000000..4c79781a5 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 25, 2008</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/build.properties b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/build.properties new file mode 100644 index 000000000..ce1882e56 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/build.properties @@ -0,0 +1,14 @@ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/helloclient.xml,\ + about.html,\ + bundle.properties,\ + plugin.xml +source.. = src/ +src.includes = bundle.properties,\ + src/,\ + about.html,\ + OSGI-INF/,\ + META-INF/,\ + plugin.xml diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/bundle.properties b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/bundle.properties new file mode 100644 index 000000000..1037bef1e --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/bundle.properties @@ -0,0 +1,12 @@ +################################################################################ +# Copyright (c) 2009 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 +################################################################################ +bundleName=ECF RemoteServices Hello Example DS Consumer +bundleProvider=Eclipse.org - ECF
\ No newline at end of file diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/plugin.xml b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/plugin.xml new file mode 100644 index 000000000..5e4d438f1 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/plugin.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + id="HelloClientApplication" + point="org.eclipse.core.runtime.applications"> + <application + cardinality="singleton-global" + thread="main" + visible="true"> + <run + class="org.eclipse.ecf.examples.internal.remoteservices.hello.ds.consumer.HelloClientApplication"> + </run> + </application> + </extension> + +</plugin> diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/products/Hello Service Consumer DS.product b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/products/Hello Service Consumer DS.product new file mode 100644 index 000000000..196696282 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/products/Hello Service Consumer DS.product @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?pde version="3.5"?> + +<product name="ECF Remote Services Example Hello DS" uid="org.eclipse.ecf.examples.remoteservices.hello.ds.consumer.product" application="org.eclipse.ecf.examples.remoteservices.hello.ds.consumer.HelloClientApplication" version="1.0.0" useFeatures="false" includeLaunchers="true"> + + <configIni use="default"> + </configIni> + + <launcherArgs> + <programArgs>-console -consoleLog</programArgs> + <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> + </launcherArgs> + + <launcher> + <solaris/> + <win useIco="false"> + <bmp/> + </win> + </launcher> + + <vm> + </vm> + + <plugins> + <plugin id="javax.servlet"/> + <plugin id="org.eclipse.core.contenttype"/> + <plugin id="org.eclipse.core.jobs"/> + <plugin id="org.eclipse.core.runtime"/> + <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/> + <plugin id="org.eclipse.ecf"/> + <plugin id="org.eclipse.ecf.discovery"/> + <plugin id="org.eclipse.ecf.examples.remoteservices.hello"/> + <plugin id="org.eclipse.ecf.examples.remoteservices.hello.ds.consumer"/> + <plugin id="org.eclipse.ecf.identity"/> + <plugin id="org.eclipse.ecf.osgi.services.discovery"/> + <plugin id="org.eclipse.ecf.osgi.services.distribution"/> + <plugin id="org.eclipse.ecf.provider"/> + <plugin id="org.eclipse.ecf.provider.jmdns"/> + <plugin id="org.eclipse.ecf.provider.remoteservice"/> + <plugin id="org.eclipse.ecf.remoteservice"/> + <plugin id="org.eclipse.ecf.sharedobject"/> + <plugin id="org.eclipse.ecf.ssl" fragment="true"/> + <plugin id="org.eclipse.equinox.app"/> + <plugin id="org.eclipse.equinox.common"/> + <plugin id="org.eclipse.equinox.concurrent"/> + <plugin id="org.eclipse.equinox.ds"/> + <plugin id="org.eclipse.equinox.preferences"/> + <plugin id="org.eclipse.equinox.registry"/> + <plugin id="org.eclipse.equinox.util"/> + <plugin id="org.eclipse.osgi"/> + <plugin id="org.eclipse.osgi.services"/> + </plugins> + + <configurations> + <plugin id="org.eclipse.ecf.examples.remoteservices.hello.ds.consumer" autoStart="true" startLevel="0" /> + <plugin id="org.eclipse.ecf.provider" autoStart="true" startLevel="3" /> + <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" /> + <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" /> + </configurations> + +</product> diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientApplication.java b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientApplication.java new file mode 100644 index 000000000..287ac5922 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientApplication.java @@ -0,0 +1,40 @@ +/******************************************************************************* +* Copyright (c) 2009 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.internal.remoteservices.hello.ds.consumer; + +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; + +public class HelloClientApplication implements IApplication { + + boolean done = false; + Object appLock = new Object(); + + public Object start(IApplicationContext context) throws Exception { + // We just wait...everything is done by DS and HelloComponent + synchronized (appLock) { + while (!done) { + try { + appLock.wait(); + } catch (InterruptedException e) { + // do nothing + } + } + } + return IApplication.EXIT_OK; + } + + public void stop() { + synchronized (appLock) { + done = true; + } + } + +} diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientComponent.java b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientComponent.java new file mode 100644 index 000000000..002074ea9 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientComponent.java @@ -0,0 +1,56 @@ +/******************************************************************************* +* Copyright (c) 2009 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.internal.remoteservices.hello.ds.consumer; + +import org.eclipse.ecf.core.IContainerFactory; +import org.eclipse.ecf.examples.remoteservices.hello.IHello; +import org.eclipse.ecf.remoteservice.IRemoteCallListener; +import org.eclipse.ecf.remoteservice.IRemoteService; +import org.eclipse.ecf.remoteservice.IRemoteServiceProxy; +import org.eclipse.ecf.remoteservice.RemoteServiceHelper; +import org.eclipse.ecf.remoteservice.events.IRemoteCallCompleteEvent; +import org.eclipse.ecf.remoteservice.events.IRemoteCallEvent; + +public class HelloClientComponent { + + private static final String CONSUMER_NAME = "helloclientcomponent"; + + private IContainerFactory containerFactory; + + void setContainerFactory(IContainerFactory cf) { + this.containerFactory = cf; + } + + void activate() throws Exception { + // Create client of appropriate type + containerFactory.createContainer("ecf.generic.client"); + } + + public void bindRemoteService(IHello proxy) { + // First print out on console that we got something + System.out.println("Got proxy IHello="+proxy); + //Call proxy + proxy.hello(CONSUMER_NAME+" via proxy"); + + // Get IRemoteService from proxy. This is possible, because for all ECF providers + // the proxy also implements org.eclipse.ecf.remoteservice.IRemoteServiceProxy + IRemoteService remoteService = ((IRemoteServiceProxy) proxy).getRemoteService(); + // Create listener for callback in asynchronous call + IRemoteCallListener listener = new IRemoteCallListener() { + public void handleEvent(IRemoteCallEvent event) { + if (event instanceof IRemoteCallCompleteEvent) { + System.out.println("Completed hello remote service invocation using async"); + } + }}; + // Call asynchronously with listener + RemoteServiceHelper.asyncExec(remoteService, "hello", new Object[] { CONSUMER_NAME + " via async" }, listener); + } + +} |