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@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to