Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] help

Hi,

Are all the required ECF bundles running? Please examine the example plugins (and especially the launch configurations) to make find out the bundles that you need to start.

Yes, server side only is possible, there is no ui dependency.

Regards,

Wim 

On Mon, Mar 21, 2011 at 11:20 AM, ronen hamias <ronen.hamias@xxxxxxxxx> wrote:

 

Hi,

I am trying to consume a remote service. Note that my environment is entirely server side.

I have implemented a simple hello world service running on tomcat using the bridge.war

 

My service is registered like this:

 

/*

     * (non-Javadoc)

     * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)

     */

    public void start(BundleContext context) throws Exception {

      Properties props = new Properties();

 

      props.put("service.exported.interfaces", "*");

      props.put("service.exported.configs", "ecf.r_osgi.peer");

 

      ServiceRegistration reg =

      context.registerService(IHelloWorld.class.getName(),new HelloServiceImpl(), props);

 

            System.out.println("IHello RemoteService registered");

 

    }

 

I wish to consume this service again from server side environment:

My service client looks like this:

 

public void start(BundleContext context) throws Exception

      {

            _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); // after this line of code containerAdapter is null

 

            // Lookup IRemoteServiceReference

            IRemoteServiceReference[] helloReferences = containerAdapter.getRemoteServiceReferences(IDFactory.getDefault()

                        .createID(_container.getConnectNamespace(), GENERIC_SERVICE_HOST), IHelloWorld.class.getName(), null);

 

            // Get remote service for reference

            IRemoteService remoteService = containerAdapter.getRemoteService(helloReferences[0]);

 

            // Get the proxy

            IHelloWorld proxy = (IHelloWorld) remoteService.getProxy();

 

            // Call the proxy

            proxy.hello("RemoteService Client via Proxy");

            System.out.println((new Date()) + " RemoteService Called via Proxy");

 

            // Call Sync

            remoteService.callSync(createRemoteCall("RemoteService Client Sync"));

            System.out.println((new Date()) + " RemoteService Called Sync");

 

 

      }

 

The IRemoteServiceContainerAdapter is inherits from IAdaptable (org.eclipse.core) that is a UI dependency?

 

How would I consume a service from a server side environment?

 

Best regards

Ronen.

 

 

 

 


_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev



Back to the top