DZone ForumsDZone Forums  

Go Back   DZone Forums > Community > Languages & Frameworks > Java
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
LinkBack Thread Tools Display Modes

Topic: Problem using Declarative Services
Old 07-02-2008, 03:02 PM   #1 (permalink)
Member
 
Join Date: Jul 2008
Posts: 1
Hello everybody,

I am using osgi for my thesis project and i have faced a problem by using declarative services.

Specifically i want to declare a service which refers to another. Here is the source code.

Service Interface :

package admin.service.adjustLight;

import classes.*;

public interface LightAdjustment {
public void adjustLight (Light light);
}

Service Implementation Class :

package admin.service.adjustLight;

import admin.decision.module.*;
import classes.ConsoleMessages;
import classes.Light;

public class LightAdjustmentImpl implements LightAdjustment{

ConsoleMessages consoleMessages = new ConsoleMessages();
static AdjustmentDecision decisionService;

protected void bind(AdjustmentDecision decision) {
System.out.println("A new service was bind");
decisionService=decision;
}

protected void unbind(AdjustmentDecision decision) {
decisionService=null;
}


public void adjustLight(Light light) {
Object object=null;
decisionService.getDecision(object);
}

}

Component Description xml file :

<?xml version="1.0"?>
<component name="L">
<implementation class="admin.service.adjustLight.LightAdjustmentIm pl"/>
<service>
<provide interface="admin.service.adjustLight.LightAdjustme nt"/>
</service>
<reference name="LOG"
interface="admin.decision.module.AdjustmentDecisio n"
bind="bind"
unbind="unbind"
/>
</component>

The problem is that, although my service LightAdjustment is registered, the binding with the reference service AdjustmentDecision is never happened (the message "A new service was bind" is not printed).

I would be very glad if anyone could help me.

Thanks.
u722 is offline   Reply /w Quote -


Thread Tools
Display Modes



All times are GMT -5. The time now is 02:31 AM.