diff options
author | slewis | 2010-05-07 05:16:51 +0000 |
---|---|---|
committer | slewis | 2010-05-07 05:16:51 +0000 |
commit | d1b7077171b3f2efe73d7e0f40ef8f43e9fa9c44 (patch) | |
tree | efc6b67e35c9364a5e698f199276e6c4c8c54099 /examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer | |
parent | 4d2fd4121239c52bdeba19e0b41f7728f3ca0d63 (diff) | |
download | org.eclipse.ecf-d1b7077171b3f2efe73d7e0f40ef8f43e9fa9c44.tar.gz org.eclipse.ecf-d1b7077171b3f2efe73d7e0f40ef8f43e9fa9c44.tar.xz org.eclipse.ecf-d1b7077171b3f2efe73d7e0f40ef8f43e9fa9c44.zip |
Added proxy distribution listener to log distribution events
Diffstat (limited to 'examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer')
2 files changed, 19 insertions, 5 deletions
diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer/META-INF/MANIFEST.MF b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer/META-INF/MANIFEST.MF index 449b0ca14..9fbcd5901 100644 --- a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer/META-INF/MANIFEST.MF +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer/META-INF/MANIFEST.MF @@ -11,6 +11,7 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5, 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.osgi.services.discovery;version="1.1.0", org.eclipse.ecf.osgi.services.distribution;version="1.0.0", org.eclipse.ecf.remoteservice, org.eclipse.ecf.remoteservice.events, diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer/src/org/eclipse/ecf/internal/examples/remoteservices/hello/consumer/HelloConsumerApplication.java b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer/src/org/eclipse/ecf/internal/examples/remoteservices/hello/consumer/HelloConsumerApplication.java index 5c5ea9d71..42de69fb0 100644 --- a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer/src/org/eclipse/ecf/internal/examples/remoteservices/hello/consumer/HelloConsumerApplication.java +++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.consumer/src/org/eclipse/ecf/internal/examples/remoteservices/hello/consumer/HelloConsumerApplication.java @@ -15,7 +15,11 @@ import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.ecf.core.IContainerFactory; import org.eclipse.ecf.examples.remoteservices.hello.IHello; import org.eclipse.ecf.examples.remoteservices.hello.IHelloAsync; +import org.eclipse.ecf.osgi.services.discovery.IProxyDiscoveryListener; +import org.eclipse.ecf.osgi.services.discovery.LoggingProxyDiscoveryListener; import org.eclipse.ecf.osgi.services.distribution.IDistributionConstants; +import org.eclipse.ecf.osgi.services.distribution.IProxyDistributionListener; +import org.eclipse.ecf.osgi.services.distribution.LoggingProxyDistributionListener; import org.eclipse.ecf.remoteservice.IAsyncCallback; import org.eclipse.ecf.remoteservice.IRemoteService; import org.eclipse.ecf.remoteservice.IRemoteServiceProxy; @@ -57,17 +61,26 @@ public class HelloConsumerApplication implements IApplication, // upon discovery via the IProxyContainerFinder/DefaultProxyContainerFinder. getContainerFactory().createContainer(containerType); + // Register proxy discovery listener to log the publish/unpublish of remote services. + // This LoggingProxyDiscoveryListener logs the publication of OSGi remote services...so + // that the discovery can be more easily debugged. + // Note that other IProxyDiscoveryListeners may be created and registered, and + // all will be notified of publish/unpublish events + bundleContext.registerService(IProxyDiscoveryListener.class.getName(), new LoggingProxyDiscoveryListener(), null); + + // Register proxy distribution listener to log the register/unregister of remote services. + // This LoggingProxyDistributionListener logs the register/unregister of OSGi remote services...so + // that the distribution can be more easily debugged. + // Note that other IProxyDistributionListener may be created and registered, and + // all will be notified of register/unregister events + bundleContext.registerService(IProxyDistributionListener.class.getName(), new LoggingProxyDistributionListener(), null); + // Create service tracker to track IHello instances that have the 'service.imported' // property set (as defined by OSGi 4.2 remote services spec). helloServiceTracker = new ServiceTracker(bundleContext, createRemoteFilter(), this); helloServiceTracker.open(); - // Register proxy discovery listener to log the publish/unpublish of remote services. - // This LoggingProxyDiscoveryListener logs the publication of OSGi remote services...so - // that the discovery can be more easily debugged. - //bundleContext.registerService(IProxyDiscoveryListener.class.getName(), new LoggingProxyDiscoveryListener(), null); - startLocalDiscoveryIfPresent(); waitForDone(); |