Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Declarative Services within RCP Applications

Title: Declarative Services within RCP Applications
Mitra,

The org.eclipse.equinox.ds bundle must always be started; hence you need to either use a custom config.ini which should look like
    osgi.bundles=org.eclipse.equinox.ds@2:start
or use Eclipse 3.5 M5 to be able to set the DS bundle to autostart using the new Eclipse launch configuration dialog...

On a side note, adding -Dequinox.ds.print=true to the VM args of your launch configuration may be useful to have traces about components activation, deactivation, etc.

Cheers,
Ben
Anyware Technologies
Benjamin Cabé
Expert Eclipse
benjamin.cabe@xxxxxxxxxxxxxxxx
http://blog.benjamin-cabe.com
Tel : +33(0)5 61 00 06 41
Fax : +33(0)5 61 00 51 46
 
Nouvelle adresse

Anyware Technologies
Lake Park
ZAC de l'Hers - Allée du Lac
BP 87216
31672 Labège Cedex
France
www.anyware-tech.com


Mitra, Priyanka a écrit :

Hello

I am not very clear how to use declaratively declarative services from RCP Application. I have a main container that other plugins that contribute to UI. In one of the plugin, I have a view that has to subscribe to a JMS service, the implementation of which is declared as a service in another bundle.

I am able to run this using "Run As -> OSGI Framework". The subscription takes place without any problems. But when run as Eclipse Application, osgi console comes up and then immediately shuts down and then my RCP Application comes up. The subscription to JMS service fails as there is no reference available. In fact it almost seems like the DS bundle for JMS is not loaded or installed at the runtime of RCP App. Am I missing something in the run configuration? Why the service bundle is not getting installed when RCP app comes up?

This is my service bundle: Subscription implementation is in JMSConnection.

<?xml version="1.0"?>
<component name="jmsService">
        <implementation class="com…..JMSConnection"/>
        <service>
                <provide interface="com…...IMessageService"/>
        </service>
</component>

This is the call from consumer bundle. This bundle also contributes to UI..

<?xml version="1.0"?>
<component name="jmsconn">
        <implementation class="tops.order.trade.mgmt.ui.views.AlertsView"/>
        <reference name="jmsService"
        interface="com…...IMessageService"
        bind="setService"
        unbind="unsetService"
        cardinality="0..1"
        policy="dynamic"/>
</component>

AlertsView.java

public class AlertsView extends ViewPart implements IMessageHandler {

        private IMessageService jmsService = null;

        public void createPartControl(Composite parent) {
                .............. // some UI code

                openJMSConnection(topic, mapper, handler);
        }
        /* (non-Javadoc)
         */
        public void setService(IMessageService jmsService) {
                System.out.println("Setting up JMS Service Instance");
            this.jmsService = jmsService;
            openJMSConnection("", new AlertsMessageMapper(), this);
        }
        /* (non-Javadoc)
         */
        public void unsetService(IMessageService jmsService) {
            this.jmsService = null;
        }

        public void openJMSConnection (String topic, IMessageMapper mapper, IMessageHandler handler)
        {
            if (this.jmsService != null) {
                System.out.println("Service not null");
                jmsService.subscribeService(topic, mapper, handler);
            }
            else
                System.out.println("Service is null");
        }

Can anyone suggest what is the best way to mix the use of extensions and services at the same time within RCP Application. I appreciate your attention on this matter.

Regards..
Priyanka


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

Back to the top