Search in sources :

Example 1 with Hello

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");
}
Also used : Hello(org.eclipse.ecf.examples.remoteservices.hello.impl.Hello) IHello(org.eclipse.ecf.examples.remoteservices.hello.IHello) IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) IContainerManager(org.eclipse.ecf.core.IContainerManager)

Example 2 with Hello

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");
}
Also used : Dictionary(java.util.Dictionary) IHelloAsync(org.eclipse.ecf.examples.remoteservices.hello.IHelloAsync) Hello(org.eclipse.ecf.examples.remoteservices.hello.impl.Hello) IHello(org.eclipse.ecf.examples.remoteservices.hello.IHello) Hashtable(java.util.Hashtable)

Aggregations

IHello (org.eclipse.ecf.examples.remoteservices.hello.IHello)2 Hello (org.eclipse.ecf.examples.remoteservices.hello.impl.Hello)2 Dictionary (java.util.Dictionary)1 Hashtable (java.util.Hashtable)1 IContainerManager (org.eclipse.ecf.core.IContainerManager)1 IHelloAsync (org.eclipse.ecf.examples.remoteservices.hello.IHelloAsync)1 IRemoteServiceContainerAdapter (org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter)1