Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

2) promote属性
在SCA中,可以采用<implementation.composite>来在一个composite中使用另一个compoiste。比如,Catalog service本身可以以composite的形式部署,
在Catalog composite中,可以用

In SCA, a pre-assembled composite can be reused as a building block for
compositions. It's achieved by <implementation.composite>. For example, the
Catalog service itself can be developed as a SCA composite. Inside the
Catalog composite, there could be a few java components.

composite中:
<component name="CatalogComponent>
<implementation.composite composite="ns1:CatalogComposite"/>
...
</component>

Now the question is what services/references in the CatalogComposite will be
made public for CatalogComponent. Service/Reference promotion is introduced
for this purpose.

For example,

//此处又一点不明白,composite="ns1:CatalogComposite"表明使用另一个composite,那么这个composite的xml描述是在一个独立的xxx.composite中,还是在Catalog composite中,不知道//tuscany runtime是如何调入xx.composite文件的?

问题是CatalogComposite中那些services和references该对CatalogComponent公开?我们知道引入Service和 Reference 的promotion就是为了解决这个问题。
比如:
<composite name="CatalogComposite">
<service name="Catalog"
promote      promote="InternalCatalogComponent/InternalCatalog">
...
</service>

<reference name="parnterCatalog"
promote      promote="InternalCatalogComponent/partnerCatalog">
...
</reference>

<component name="InternalCatalogComponent>
...<service name="InternalCatalog" ></service>
</component>
</composite>
上面service中的promote的意思是说,如果CatalogComposit被当作一个component实用的话,那么名为Catalog的Service将使得InternalCatalogComponent 的InternalCatalog service对外公开。如此,CatalogComponen就可以连向一个Catalog 服务了。

同样,上面的reference 的promote的意思是说,如果如果CatalogComposit被当作一个component实用的话,那么名为partnerCatalog的reference 将使得使得InternalCatalogComponent 的partnerCatalog service对外公开。
下面的还是不是很明白.....The @promote for the <service> says if CatalogComposite is used as a
component for assembly, there is a service named Catalog that makes the
InternalCatalogComponent's InternalCatalog service public. As a result, the
CatalogComponent has a public Catalog service that can be wired to.
The @promote for the <reference> says if CatalogComposite is used as a
component for assembly, there is a reference named partnerCatalog that makes
the InternalCatalogComponent's partnerCatalog reference public. As a result,
the CatalogComponent has a public partnerCatalog reference and a service
provider can be defined for this reference.