use of org.eclipse.ecf.examples.remoteservices.hello.impl.Hello in project ecf by eclipse.
the class Activator method start.
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext context) throws Exception {
this.context = context;
// Create R-OSGi Container
IContainerManager containerManager = getContainerManagerService();
container = containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer");
// Get remote service container adapter
IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class);
// Register remote service
serviceRegistration = containerAdapter.registerRemoteService(new String[] { IHello.class.getName() }, new Hello(), null);
System.out.println("IHello RemoteService registered");
}
use of org.eclipse.ecf.examples.remoteservices.hello.impl.Hello in project ecf by eclipse.
the class HelloHostApplication method registerHelloRemoteService.
void registerHelloRemoteService() {
// Setup properties for remote service distribution, as per OSGi 4.2
// remote services
// specification (chap 13 in compendium spec)
Dictionary props = new Hashtable();
// 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 service property specifying container factory args
props.put(IDistributionConstants.SERVICE_EXPORTED_CONTAINER_FACTORY_ARGUMENTS, containerId);
props.put("ecf.exported.async.objectClass", new String[] { IHelloAsync.class.getName() });
// register remote service
helloRegistration = bundleContext.registerService(IHello.class.getName(), new Hello(), props);
// tell everyone
System.out.println("Host: Hello Service Registered");
}
Aggregations