Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ice-dev] Enabling ConnectCoreAction

Hello Jay, Scott,

Thanks again for the links and inputs. I store an instance of RSA based on how it was outlined in Scott's code. When I try to launch via the o.e.i.product/ice.product_linux.launch file, I get Unresolved Requirement and Import-Package errors. They seem to be related to o.e.ecf.osgi.services.remoteserviceadmin bundle. Changes are at

I have already added relevant packages to the Manifest files but I still get this error (please find attached the log file). Based on our earlier discussions, is this related to the RSA being started first, i.e. is it more conducive to use DS and the Reference annotation to resolve this? I hope I am not missing something obvious here.

Thanking You,
Ram

On Wed, Nov 30, 2016 at 11:43 PM Scott Lewis <slewis@xxxxxxxxxxxxx> wrote:
On 11/30/2016 5:12 PM, Jay Jay Billings wrote:
> There's an interesting bug with the Eclipse Resources bundle: It
> doesn't work with DS-started bundles that require it to be started
> first. I personally spent weeks sorting this out, and found that the
> only way to fix it was to take the Core and Client service
> implementations back to the dark ages and manually register the service.
>
> So, with that in mind, you can easily pull the service for the RSA
> using a service reference or a service tracker. You can pick which one
> you need depending on what you know about its lifecycle (i.e. - will
> you need it for the whole life of the program, etc.?). Lines 194-237
> in Client.java show how to use service references:
>
> https://github.com/eclipse/ice/blob/master/org.eclipse.ice.client/src/org/eclipse/ice/client/internal/Client.java

The RemoteServiceAdmin service is only needed when the remote service is
actually imported...which is in RSCoreConnectAction line 117.

The main problem with the service reference approach is one of timing:
it depends upon the RemoteServiceAdmin service being started before the
org.eclipse.ice.client bundle.   For that reason I prefer a
ServiceTracker...e.g. here's a method that I added to Client class
(because it's the BundleActivator for your bundle):


import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
import org.osgi.util.tracker.ServiceTracker;

...

     public RemoteServiceAdmin getRSA() {
         ServiceTracker<RemoteServiceAdmin,RemoteServiceAdmin> st = new
ServiceTracker<RemoteServiceAdmin,RemoteServiceAdmin>(getContext(),RemoteServiceAdmin.class,null);
         st.open();
         RemoteServiceAdmin rsa = st.getService();
         st.close();
         return rsa;
     }

Then line 117 in RSCoreConnectAction can then use getRSA() like this:

                     reg = (ImportRegistration)
Client.getDefault().getRSA().importService(new EndpointDescription(props));

>
> Note too that using DS with classes that are registered or otherwise
> use static service references works just fine too.

The @Reference in RSCore is static (@Reference defaults to statis), and
it works in my tests...i.e. the RemoteServiceAdmin gets injected right
away...I think you should be able to use that in org.eclipse.ice.client
if you wish.

Scott


_______________________________________________
ice-dev mailing list
ice-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/ice-dev
--
Ramachandran K. Narayanan
(Ram)
Software Engineer
RNET Technologies Inc.
240 W.Elmwood Drive, Suite 2010
Dayton, OH 45459-4248

Attachment: console_log.log
Description: Binary data


Back to the top