Simple blueprint Issue [message #753367] |
Wed, 26 October 2011 21:32 |
Geoffry Roberts Messages: 29 Registered: March 2011 |
Junior Member |
|
|
All,
I originally posted this in the Virgo forum, but perhaps it is really a Gemini issue.
I would also like to mention that this all works in Karaf.
The following code is a HelloWorld type exercise intended to try out dependency injection blueprint style.
Is the problem in my logging set up or with blueprint?
When I deploy the bundle along with its dependencies, all bundles start without error. I should see a few messages in the console. I see nothing except that the bundle was started successfully.
Below I list a class and below that the blueprint from OSGI-INF/blueprint/configuration.xml. Please note that the blueprint has an attribute: init-method="startUp".
Thanks
Could it be that the startup method is not being called?
My code:
package clientapi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import firstapi.API;
public class ClientAPI {
Logger Log = LoggerFactory.getLogger(ClientAPI.class);
API blueAPI = null;
API redAPI = null;
public void startUp() {
Log.debug("Hello world.");
Log.debug("startUp=====>" + this.getClass().getName());
Log.debug("getBlue==>" + blueAPI.getAPI());
Log.debug("getRed==>" + redAPI.getAPI());
}
public void setBlue(API api) {
Log.debug("setAPI==>" + api.getAPI());
this.blueAPI = api;
Log.debug("<==setAPI");
}
public void setRed(API api) {
Log.debug("setAPI==>" + api.getAPI());
this.redAPI = api;
Log.debug("<==setAPI");
}
}
The blueprint:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http---www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http---www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="blueprint.xsd">
<reference id="blueAPI" interface="firstapi.API" component-name="blueAPI" />
<reference id="redAPI" interface="firstapi.API" component-name="redAPI" />
<bean id="clientapi" class="clientapi.ClientAPI" init-method="startUp">
<property name="blue" ref="blueAPI" />
<property name="red" ref="redAPI" />
</bean>
</blueprint>
|
|
|
Powered by
FUDForum. Page generated in 0.03292 seconds