Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2010-07-31 18:12:02 +0000
committerslewis2010-07-31 18:12:02 +0000
commit74991d3a52050b3b6a00514a8ac72ce0964429be (patch)
tree6373217174dc6643aa758f9c8c4ecaa67d36db5c /examples
parent0cf29aef20e072c1d264c5b4b79da37a06d19433 (diff)
downloadorg.eclipse.ecf-74991d3a52050b3b6a00514a8ac72ce0964429be.tar.gz
org.eclipse.ecf-74991d3a52050b3b6a00514a8ac72ce0964429be.tar.xz
org.eclipse.ecf-74991d3a52050b3b6a00514a8ac72ce0964429be.zip
Fix for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=321354
Diffstat (limited to 'examples')
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/META-INF/MANIFEST.MF1
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/products/Data Processor Service Host (activemq).product3
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/src/org/eclipse/ecf/internal/examples/loadbalancing/servicehost/DataProcessorServiceHostApplication.java62
3 files changed, 8 insertions, 58 deletions
diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/META-INF/MANIFEST.MF b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/META-INF/MANIFEST.MF
index f8731e4e6..b74458d12 100644
--- a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/META-INF/MANIFEST.MF
+++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/META-INF/MANIFEST.MF
@@ -9,7 +9,6 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.ecf.core,
org.eclipse.ecf.core.identity;version="3.0.0",
org.eclipse.ecf.examples.loadbalancing,
- org.eclipse.ecf.osgi.services.distribution,
org.eclipse.ecf.remoteservice,
org.eclipse.equinox.app;version="1.0.0",
org.osgi.framework;version="1.3.0",
diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/products/Data Processor Service Host (activemq).product b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/products/Data Processor Service Host (activemq).product
index 5f547f6b2..480ef1e2c 100644
--- a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/products/Data Processor Service Host (activemq).product
+++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/products/Data Processor Service Host (activemq).product
@@ -20,11 +20,8 @@
<plugin id="org.eclipse.ecf.examples.loadbalancing"/>
<plugin id="org.eclipse.ecf.examples.loadbalancing.servicehost"/>
<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"/>
diff --git a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/src/org/eclipse/ecf/internal/examples/loadbalancing/servicehost/DataProcessorServiceHostApplication.java b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/src/org/eclipse/ecf/internal/examples/loadbalancing/servicehost/DataProcessorServiceHostApplication.java
index 113b20ed4..5e2bc0ea8 100644
--- a/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/src/org/eclipse/ecf/internal/examples/loadbalancing/servicehost/DataProcessorServiceHostApplication.java
+++ b/examples/bundles/org.eclipse.ecf.examples.loadbalancing.servicehost/src/org/eclipse/ecf/internal/examples/loadbalancing/servicehost/DataProcessorServiceHostApplication.java
@@ -12,17 +12,15 @@ import java.util.Properties;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.IContainerManager;
import org.eclipse.ecf.examples.loadbalancing.IDataProcessor;
-import org.eclipse.ecf.osgi.services.distribution.IDistributionConstants;
import org.eclipse.ecf.remoteservice.Constants;
import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
import org.eclipse.ecf.remoteservice.IRemoteServiceRegistration;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
import org.osgi.util.tracker.ServiceTracker;
-public class DataProcessorServiceHostApplication implements IApplication, IDistributionConstants {
+public class DataProcessorServiceHostApplication implements IApplication {
private static final String LB_SVCHOST_CONTAINER_TYPE = "ecf.jms.activemq.tcp.manager.lb.svchost";
public static final String DEFAULT_QUEUE_ID = "tcp://localhost:61616/exampleQueue";
@@ -46,15 +44,6 @@ public class DataProcessorServiceHostApplication implements IApplication, IDistr
// -topicId tcp://myjmdnsbrokerdnsname:61616/myTopicName
private String topicId = DEFAULT_TOPIC_ID;
- // The local service registration when using the osgi remote services
- private ServiceRegistration dataProcessorServiceServiceRegistration;
-
- private boolean useECFRemoteServices = false;
- // The following two member variables are only used if the useECFRemoteServices
- // flag is set to true via command line argument...e.g. -useECFRemoteServices
- // The default is to use OSGi remote services, and so these two members
- // will be null
-
// Container instance that connects us with the ActiveMQ queue as a message
// producer and publishes the service on the topicId
private IContainer container;
@@ -64,43 +53,9 @@ public class DataProcessorServiceHostApplication implements IApplication, IDistr
public Object start(IApplicationContext appContext) throws Exception {
bundleContext = Activator.getContext();
- // Process Arguments...i.e. set queueId and topicId if specified
+ // Process Arguments...i.e. set queueId and topicId if specified, otherwise use defaults
processArgs(appContext);
- // Register and publish as OSGi remote service
- if (useECFRemoteServices) registerECFRemoteService();
- else registerOSGiRemoteService();
-
- // wait for remote service requests until stopped
- waitForDone();
-
- return IApplication.EXIT_OK;
- }
-
- private void registerOSGiRemoteService() throws Exception {
- // Setup properties for remote service distribution, as per OSGi 4.2 remote services
- // specification (chap 13 in compendium spec)
- Properties props = new Properties();
- // add OSGi service property indicated export of all interfaces exposed by service (wildcard)
- props.put(IDistributionConstants.SERVICE_EXPORTED_INTERFACES, IDistributionConstants.SERVICE_EXPORTED_INTERFACES_WILDCARD);
- // add OSGi service property specifying config
- props.put(IDistributionConstants.SERVICE_EXPORTED_CONFIGS, containerType);
- // add ECF container arguments
- props.put(IDistributionConstants.SERVICE_EXPORTED_CONTAINER_FACTORY_ARGUMENTS, new String[] { topicId, queueId });
- // This is setting (currently) magical service property that indicates
- // that this service registration is a load balancing service host
- props.put(Constants.SERVICE_REGISTER_PROXY, "true");
- // register remote service
- dataProcessorServiceServiceRegistration = bundleContext.registerService(IDataProcessor.class
- .getName(), new IDataProcessor() {
- public String processData(String data) {
- return null;
- }}, props);
- // tell everyone
- System.out.println("LB Service Host: DataProcessor Registered via OSGi Remote Services topic="+topicId);
- }
-
- private void registerECFRemoteService() throws Exception {
// Create container of appropriate type, and with the topicId and
// queueId set
// upon construction
@@ -110,7 +65,7 @@ public class DataProcessorServiceHostApplication implements IApplication, IDistr
// Get IRemoteServiceContainerAdapter
IRemoteServiceContainerAdapter remoteServiceAdapter = (IRemoteServiceContainerAdapter) container
.getAdapter(IRemoteServiceContainerAdapter.class);
-
+
Properties properties = new Properties();
// This is setting (currently) magical service property that indicates
// that
@@ -130,15 +85,14 @@ public class DataProcessorServiceHostApplication implements IApplication, IDistr
dataProcessorServiceHostRegistration = remoteServiceAdapter
.registerRemoteService(new String[] { IDataProcessor.class
.getName() }, null, properties);
-
+
System.out.println("LB Service Host: DataProcessor Registered via ECF Remote Services topic="+topicId);
+ // wait for remote service requests until stopped
+ waitForDone();
+ return IApplication.EXIT_OK;
}
-
+
public void stop() {
- if (dataProcessorServiceServiceRegistration != null) {
- dataProcessorServiceServiceRegistration.unregister();
- dataProcessorServiceServiceRegistration = null;
- }
if (dataProcessorServiceHostRegistration != null) {
dataProcessorServiceHostRegistration.unregister();
dataProcessorServiceHostRegistration = null;

Back to the top