Accessing a service in a separate bundle from a managed-service-factory

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Accessing a service in a separate bundle from a managed-service-factory


I have a bundle with a blueprint.xml file that contains managed-service-factory elements.  Inside my java class that is implementing the managed-service-factory (the "client") I would like to access a service that is defined inside a different bundle (the "server"). 

The blueprint.xml for the client looks like this: 

                interface="name of interface">
                        init-method="init" destroy-method="destroy">
                        <cm:managed-properties persistent-id="" 
                                update-strategy="container-managed" />
                        <argument ref="NickName_for_class_that_implements_the_method_I_want_to_call" />
                        <property name="name" 
                                value="blahBlahBlah" />
                        <property name="description" 
                                value="yadayada" />

The blueprint.xml for the service looks like this: 

<bean id="NickName_for_class_that_implements_the_method_I_want_to_call" class="this_is_the_real_class_name that_contains_the_method" init-method="init" destroy-method="destroy" />
<service ref="NickName_for_class_that_implements_the_method_I_want_to_call" interface="the_name_of_the_interface_for_the_class_i_want_to_call"/>

In my client class,, I added a ctor that takes in the NickName_for_class_that_implements_the_method_I_want_to_call.  The code in the client class to call the method compiles successfully.  I have a log statement before it calls the method and a log statement after the method.  When the code executes, I see in my karaf.log file that the method is about to be called and then NOTHING after that. 

This is a new job for me with existing code that I am trying to understand and modify.  I can not change the existing infrastructure.  I must understand how the code is working and make minor modifications.  It is not possible for me to install different tools that might be more evolved. 

If you can point me towards some examples of clients that are configured with managed-service-factory that are calling services that are implemented in a different bundle that will help me to understand what to change to make this work. 


smime.p7s (6K) Download Attachment