Hi,
The reference is defined on the componentType and it can then be configured
at the component level. For example, a java component implementation can use
@Reference annotation to declare a reference for the componentType.
package xyz;
public class MyServiceImpl {
@Reference(name="myRef1")
protected Service1 myRef1;
or
@Reference // the reference name is default to the property name, i.e.,
myRef2
void setMyRef2(Service2 myRef2);
...
}
Then you can have more than one components using the same impl class but
with different configurations:
<component name="C1">
<implementation.java class="xyz.myServiceImpl">
<reference name="myRef1" target="C3/S1"/>
</component>
<component name="C2">
<implementation.java class="xyz.myServiceImpl">
<reference name="myRef1" target="C4/S1"/>
</component>
For more information about the componentType and component, please see the
SCA assembly spec @
http://www.osoa.org/download/attachments/35/SCA_AssemblyModel_V100.pdf?version=1.
(Around line 428).
Thanks,
Raymond
----- Original Message -----
From: "Peizhao Hu" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, July 11, 2007 10:28 PM
Subject: Any requirement for making a reference name
Hi,
I have a composite file like the following:
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
name="SensorProcess">
<component name="SensorProcessServiceComponent">
<implementation.java
class="sensorprocess.SensorProcessServiceImpl"/>
<reference name="ADC2KelvinService"
target="ADC2KelvinServiceComponent" />
<reference name="kelvin2CelsiusService"
target="Kelvin2CelsiusServiceComponent" />
<reference name="celsius2FahrenheitService"
target="Celsius2FahrenheitServiceComponent" />
</component>
<component name="ADC2KelvinServiceComponent">
<implementation.java class="sensorprocess.ADC2KelvinServiceImpl"/>
</component>
<component name="Kelvin2CelsiusServiceComponent">
<implementation.java
class="sensorprocess.Kelvin2CelsiusServiceImpl"/>
</component>
<component name="Celsius2FahrenheitServiceComponent">
<implementation.java
class="sensorprocess.Celsius2FahrenheitServiceImpl"/>
</component>
</composite>
I found that if I put the reference name of each service to a slightly
different name. it will not find the reference object. so is there any
requirement on reference name definition?
in my example, I have two different naming problems. for example: if I use
ADC2KelvinService, it will work, but not aDC2KelvinService
, and in second case, if I use Kelvin2CelsiusService, it won't work.
--
regards;
Peizhao
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]