Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] [Gsoc][ECF Tooling]-Generate codes for Service Registration & Service Client

On 08/30/2013 04:22 AM, Salinda Jayawardana wrote:
> HI All
> 
> I am thinking to create separate project for service client , these
> screenshots  shows the wizards steps to create that client. But Now I
> have following questions in my mind.
> 
> According to my findings,  service consumer  can be created using
> following code sample (with r-osgi provider)
> 
>     BundleContext context =
> Platform.getBundle(Activator.PLUGIN_ID).getBundleContext();
> 
>     ServiceTracker  containerManagerServiceTracker = new
> ServiceTracker(context, IContainerManager.class.getName(),null);
>     containerManagerServiceTracker.open();
> 
>      IContainer containerManager =   (IContainerManager)
> containerManagerServiceTracker.getService();
>      container =
> containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer");
> 
>     IRemoteServiceContainerAdapter containerAdapter =
> (IRemoteServiceContainerAdapter) container
>                     .getAdapter(IRemoteServiceContainerAdapter.class);
>             IRemoteServiceReference[] helloReferences = containerAdapter
>                    
> .getRemoteServiceReferences(IDFactory.getDefault().createID(container.getConnectNamespace(),
>                             serviceURL), interfaceName, null);
>          IRemoteService   remoteService =
> containerAdapter.getRemoteService(helloReferences[0]);
> 
>  
> 
> 1) I tried out this code sample and it's working for me, But here I need
> Bundle Context So always service consumer should be a bundle is it? if
> not how can I get the  bundle context ??


You a) get the BundleContext passed to you in an OSGi BundleActivator or
you b) use OSGi's FrameworkUtil to get the Bundle of a class which then
allows you to get the BundleContext [2].


> 2)  Where can I find list of available providers.
> ecf.generic.client/server and ecf.r_osgi.peer .etc??


There is no _static_ list of available providers. Providers are either
deployed at runtime or not. The UI should simply reflect this.


> PS:  @Markus
> 
> during this week I couldn’t do good progress since I was completely down
> due to fever, Hopefully complete all the existing works by Monday(2nd
> Sep) will send complete update mail.
> 
> BTW , Still I feel my all my local changes are not sync with the Github,
> Can u see following class and packages
> 
> package org.eclipse.ecf.tools.serviceGenerator.wizards
> 
> RemoteServiceClientGenWizard.java
> 
> RemoteServiceClientGenWizardPage.java
> 
> JavaProjectUtils.java

You can check the content of the github repo yourself on-line [1].

M.

[1] https://github.com/Salindauwu/gsoc2013salinda/commits/master
[2]
http://blog.benjamin-cabe.com/2009/07/16/given-a-class-how-to-retrieve-its-bundle


Back to the top