Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ice-dev] Fwd: [ptp-dev] [ptp-user] Refactoring code for Mars

Andrew,

You need to acquire these services using OSGi Declarative Services (DS) instead of services references. Every service used by ICE is obtained using the former and there are no instances of the latter in the entire ICE codebase (unless someone snuck one in).

If you don't know how to use DS, let us know and we can show you. For reference, the component.xml files in ICE that you needed to create for VIBE and PROTEUS are DS components.

Jay

---------- Forwarded message ----------
From: Greg Watson <g.watson@xxxxxxxxxxxx>
Date: Mon, Jun 22, 2015 at 3:08 PM
Subject: Re: [ptp-dev] [ptp-user] Refactoring code for Mars
To: PTP User list <ptp-user@xxxxxxxxxxx>
Cc: Parallel Tools Platform general developers <ptp-dev@xxxxxxxxxxx>


Andrew,

Documentation is definitely one thing that needs to be improved…

Basically, RemoteServices has been replaced with IRemoteServicesManager, and IRemoteServices and IRemoteConnectionManager have been replaced with IRemoteConnectionType. Most of the other interfaces are the same, except they have been replaced with *Service versions. e.g. IRemoteFileManager -> IRemoteFileService.

You can think of a “connection type” as representing a communication protocol, like SSH, Serial, Telnet, etc.

Everything is now a service, so you need to add some code like this to your plugin:

        /**
         * Return the OSGi service with the given service interface.
         *
         * @param service service interface
         * @return the specified service or null if it's not registered
         */
        public static <T> T getService(Class<T> service) {
                BundleContext context = plugin.getBundle().getBundleContext();
                ServiceReference<T> ref = context.getServiceReference(service);
                return ref != null ? context.getService(ref) : null;
        }

Now you obtain the “root” of the tree, IRemoteServicesManager using:

        IRemoteServicesManager mgr = getService(IRemoteServicesManager.class);

Next, you obtain the IRemoteConnectionType interface using:

        IRemoteConnectionType connType = mgr.getConnectionType(“ssh://url”);

A connection type has methods for creating and retrieving IRemoteConnection interfaces, in much the same way as IRemoteConnectionManager.

Pretty much everything else is a service. To obtain the interface, you need to check if it is a "connection type” service (extends IRemoteConnectionType.Service) or a “connection” service (extends IRemoteConnection.Service), then call the getService() method on the corresponding interface.

e.g. to obtain an IRemoteFileService (extends IRemoteConnection.Service):

        IRemoteFileService fileSvc = connection.getService(IRemoteFileService.class).

To obtain an IRemoteUIFileService (extends IRemoteConnectionType.Service):

        IRemoteUIFileService uiFileSvc = connectionType.getService(IRemoteUIFileService.class);

Let me know if there is anything else I can clarify.

Greg



> On Jun 22, 2015, at 2:09 PM, Bennett, Andrew R. <bennettar@xxxxxxxx> wrote:
>
> HI, I'm a developer on Eclipse ICE (https://projects.eclipse.org/projects/technology.ice/developer) and we are working on moving our default platform from Kepler to Mars.  It looks like there have been some API changes to org.eclipse.remote that we are unsure about how to resolve.  Specifically the pieces we are having some trouble with are:
>
> org.eclipse.remote.core.IRemoteConnectionManager
> org.eclipse.remote.core.IRemoteFileManager
> org.eclipse.remote.core.IRemoteServices
> org.eclipse.remote.core.RemoteServices
>
> Could anyone offer up advice on how to port these to the most recent version of the Remote Services plugin?
>
> Thanks,
> Andrew
> _______________________________________________
> ptp-user mailing list
> ptp-user@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/ptp-user

_______________________________________________
ptp-dev mailing list
ptp-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/ptp-dev



--
Jay Jay Billings
Oak Ridge National Laboratory
Twitter Handle: @jayjaybillings

Back to the top