我正在使用 Eclipse Virgo/Gemini 蓝图,并且有一个具有多种实现的接口:
实施1:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<bean id="MyID1"
class="ImplementationCLass1">
</bean>
<service ref="MyID1"
interface="MyInterface" />
实施2:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<bean id="MYID2"
class="ImplementationClass2">
</bean>
<service ref="MYID2"
interface="MyInterface" />
实施3:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<bean id="MyID3"
class="ImplementationClass3">
</bean>
<service ref="MyID3"
interface="MyInterface" />
还有一个客户:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<reference-list id="MyImplementations"
interface="MyInterface" />
<bean id="clientID" class="ClientClass"
init-method="startUp">
<property name="services" ref="MyImplementations"></property>
</bean>
startUp 方法是一个简单的方法,它遍历整个列表并打印出一个简单的字符串(用于测试目的)
问题是如果我安装客户端捆绑包,我的列表中只有两个树服务。如果我停止并再次启动 Bundle,所有三个服务都在我的列表中。
任何想法/建议为什么?
是否可以告诉 virgo 该列表必须包含与 MyInterface 匹配的所有服务?
如果您需要更多信息,请随时询问