diff options
13 files changed, 284 insertions, 0 deletions
diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/.classpath b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/.classpath new file mode 100644 index 000000000..64c5e31b7 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.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.loadbalancing.ds.consumer/.project b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/.project new file mode 100644 index 000000000..fd4e7a9b3 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/.project @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ecf.examples.loadbalancing.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.loadbalancing.ds.consumer/.settings/org.eclipse.jdt.core.prefs b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..c9126dc8c --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon Apr 26 12:37:30 PDT 2010 +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.loadbalancing.ds.consumer/.settings/org.eclipse.pde.core.prefs b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..cf4da5b7e --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Mon Apr 26 12:47:40 PDT 2010 +eclipse.preferences.version=1 +pluginProject.extensions=true +resolve.requirebundle=false diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/META-INF/MANIFEST.MF b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/META-INF/MANIFEST.MF new file mode 100644 index 000000000..85932d542 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %bundleName +Bundle-Vendor: %bundleProvider +Bundle-SymbolicName: org.eclipse.ecf.examples.loadbalancing.ds.consumer;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.equinox.common +Import-Package: org.eclipse.ecf.examples.loadbalancing, + org.eclipse.ecf.remoteservice, + org.eclipse.equinox.app +Service-Component: OSGI-INF/dataprocessorclient.xml +Bundle-Localization: bundle diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/OSGI-INF/dataprocessorclient.xml b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/OSGI-INF/dataprocessorclient.xml new file mode 100644 index 000000000..085ebfabd --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/OSGI-INF/dataprocessorclient.xml @@ -0,0 +1,5 @@ +<?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.loadbalancing.ds.consumer"> + <implementation class="org.eclipse.ecf.examples.internal.loadbalancing.ds.consumer.DataProcessorClientComponent"/> + <reference bind="bind" cardinality="1..1" interface="org.eclipse.ecf.examples.loadbalancing.IDataProcessor" name="IDataProcessor" policy="static"/> +</scr:component> diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/about.html b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/about.html new file mode 100644 index 000000000..4c79781a5 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.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.loadbalancing.ds.consumer/build.properties b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/build.properties new file mode 100644 index 000000000..4c1d3c1a4 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/build.properties @@ -0,0 +1,7 @@ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/dataprocessorclient.xml,\ + plugin.xml,\ + bundle.properties +source.. = src/ diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/bundle.properties b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/bundle.properties new file mode 100644 index 000000000..c8e976dc0 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/bundle.properties @@ -0,0 +1,12 @@ +################################################################################ +# Copyright (c) 2010 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 Load Balancing Example DS Consumer +bundleProvider=Eclipse.org - ECF
\ No newline at end of file diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/plugin.xml b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/plugin.xml new file mode 100644 index 000000000..99324fd31 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/plugin.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + id="DataProcessorConsumerDS" + point="org.eclipse.core.runtime.applications"> + <application + cardinality="*" + thread="any" + visible="true"> + <run + class="org.eclipse.ecf.examples.internal.loadbalancing.ds.consumer.DataProcessorClientApplication"> + </run> + </application> + </extension> + +</plugin> diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/products/Data Processor Consumer DS (activemq).product b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/products/Data Processor Consumer DS (activemq).product new file mode 100644 index 000000000..a6a739063 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/products/Data Processor Consumer DS (activemq).product @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?pde version="3.5"?> + +<product name="ECF Load Balancing Consumer DS" uid="org.eclipse.ecf.examples.loadbalancing.ds.consumer.product" application="org.eclipse.ecf.examples.loadbalancing.ds.consumer.DataProcessorConsumerDS" 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.datashare"/> + <plugin id="org.eclipse.ecf.discovery"/> + <plugin id="org.eclipse.ecf.examples.loadbalancing"/> + <plugin id="org.eclipse.ecf.examples.loadbalancing.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.datashare"/> + <plugin id="org.eclipse.ecf.provider.jmdns"/> + <plugin id="org.eclipse.ecf.provider.jms"/> + <plugin id="org.eclipse.ecf.provider.jms.activemq"/> + <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.loadbalancing.ds.consumer" autoStart="true" startLevel="0" /> + <plugin id="org.eclipse.ecf.osgi.services.distribution" 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.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientApplication.java b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientApplication.java new file mode 100644 index 000000000..8ecb27330 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientApplication.java @@ -0,0 +1,40 @@ +/******************************************************************************* +* Copyright (c) 2010 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.loadbalancing.ds.consumer; + +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; + +public class DataProcessorClientApplication 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.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientComponent.java b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientComponent.java new file mode 100644 index 000000000..fe3cb2028 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.ds.consumer/src/org/eclipse/ecf/examples/internal/loadbalancing/ds/consumer/DataProcessorClientComponent.java @@ -0,0 +1,44 @@ +/******************************************************************************* +* Copyright (c) 2010 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.loadbalancing.ds.consumer; + +import org.eclipse.ecf.examples.loadbalancing.IDataProcessor; +import org.eclipse.ecf.examples.loadbalancing.IDataProcessorAsync; +import org.eclipse.ecf.remoteservice.IAsyncCallback; + +public class DataProcessorClientComponent { + + public void bind(IDataProcessor dataProcessor) { + System.out.println("Got data processor on client"); + final String data = "Here's some data from a client"; + // Use it + System.out.println("Invoking data processor"); + String result = dataProcessor.processData(data); + System.out.println("Sync result="+result); + System.out.println(); + // See if we've got an async interface and if so, use it + if (dataProcessor instanceof IDataProcessorAsync) { + IDataProcessorAsync dpAsync = (IDataProcessorAsync) dataProcessor; + System.out.println("Got async data processor on client"); + IAsyncCallback<String> callback = new IAsyncCallback<String>() { + public void onSuccess(String result) { + System.out.println("Async result="+result); + } + public void onFailure(Throwable exception) { + System.out.println("Async invoke failed with exception"); + if (exception != null) exception.printStackTrace(); + } + + }; + // Now invoke async + dpAsync.processDataAsync(data, callback); + } + } +} |