网站地图
  
  高级搜索
  首页   技术论坛   博客 派计划   产品中心   资源中心   银弹在线   商城  





什么情况下必须使用 wire?    
#1楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 657 分
财富 787 goCom币
威望 602
排名 第 38 名
段位 新手必读

什么情况下必须使用 wire?

有人说 当名称不唯一时就必须使用用wire了,对吗?

reference 中的multiplicity属性值 0..1 or 1..1 or 0..n or 1..n 代表什么?

能这样理解吗?

1..1 代表 reference 能且只能查询到一个目标
0..1 代表 reference 能查询到0或1个目标
1..n 代表 reference 能够查询到1个或n个目标
0..n 代表 reference 能查询到0个或n个目标

2008/5/21 23:52
管理员于 2008/08/21 10:08:52 对该贴进行了分值操作, 40 goCom币 和 4 专家分 。理由为 精品贴


锐捷工作流 - BPS Express产品发布,免费下载    参与RIA产品调研 赢取goCom纪念T恤    动量ODE
普元SOA业务流程平台BPS 6.1即将发布普元融资成功新闻发布会    Primeton EOS 产品下载    Primeton BPS 产品下载
 

Re: 什么情况下必须使用 wire?    
#2楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 657 分
财富 787 goCom币
威望 602
排名 第 38 名
段位 新手必读

reference 中的multiplicity 理解一点了当 multiplicity 是1..n 或0..n 时,你的引用对象需要用数组 例如: public class HelloImpl implements Hello { Login[] login; public String echo(String str) { return login[0].login(str); } public Login[] getLogin() { return login; } @Reference public void setLogin(Login[] login) { this.login = login; } }

    <component name="HelloComponent">
        <implementation.java class="sca.reference.multiplicity.HelloImpl" />
        <reference name="login" multiplicity="1..n"
                   target="LoginOneComponent LoginTwoComponent"/>
    </component>

    <component name="LoginOneComponent">
        <implementation.java class="sca.reference.multiplicity.LoginOne" />
    </component>
   
    <component name="LoginTwoComponent">
        <implementation.java class="sca.reference.multiplicity.LoginTwo" />
    </component>

 

Re: 什么情况下必须使用 wire?    
#3楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 657 分
财富 787 goCom币
威望 602
排名 第 38 名
段位 新手必读

哈哈,找到一个应用场景了

http://www.osoa.org/xmlns/sca/1.0\"" name="\"hello\"" targetnamespace="\"http://ljy\"">

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
 targetNamespace="http://ljy"
    name="hello">

    <component name="HelloComponent">
        <implementation.java class="sca.reference.multiplicity.HelloImpl" />
    </component>

    <component name="LoginOneComponent">
        <implementation.java class="sca.reference.multiplicity.LoginOne" />
    </component>

 <wire source="HelloComponent/login"  target="LoginOneComponent"></wire>
</composite>

 

Re: 什么情况下必须使用 wire?    
#4楼
给作者发送短消息 给作者发送短消息  
查看用户其他信息
总分 13 分
财富 13 goCom币
威望 1
排名 :(
段位 新手必读

如果multiplicity是0..n或1..n, JAVA类型可以是java.util.Collection以及其子类.

例如:

@Reference

public List<OtherService> otherServices;

 

 

 

Re: 什么情况下必须使用 wire?    
#5楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 657 分
财富 787 goCom币
威望 602
排名 第 38 名
段位 新手必读
 

Re: 什么情况下必须使用 wire?    
#6楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 657 分
财富 787 goCom币
威望 602
排名 第 38 名
段位 新手必读
总算找到一种使用wire的场景了。
软件公司A 卖了一个HelloComposite构建给 公司C, 其中有个HelloComponent 组件,它依赖一个mail的服务。
公司C购买了B 公司的邮件服务,B公司提供 MailComposite 构建,其中包括 mailComponent 组件。

好,我作为C 公司的IT人员,现在要使用 sca 的 wire 将这两个组件连接起来。 这样就集成了不同公司的业务系统。
哈哈哈哈,哈哈哈哈
 

Re: 什么情况下必须使用 wire?    
#7楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 657 分
财富 787 goCom币
威望 602
排名 第 38 名
段位 新手必读


代码如下:
mail.composite 文件:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
 targetNamespace="http://mail"
    name="MailComposite">
    <component name="MailComponent">
        <implementation.java class="sca.reference.multiplicity.MailImpl" />
    </component>
</composite>

hello.composite 文件:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
 targetNamespace="http://hello"
    name="HelloComposite">
   
    <component name="HelloComponent">
        <implementation.java class="sca.reference.multiplicity.HelloImpl" />
        <reference name="mail"/>
    </component>
</composite>

wire.composite 文件:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
 targetNamespace="http://wire"
 xmlns:mail="http://mail"
 xmlns:hello="http://hello"
    name="wire">
 <include name="hello:HelloComposite"/>
 <include name="mail:MailComposite"/>
 <wire source="HelloComponent/mail"  target="MailComponent"></wire>
</composite>

 

Re: 什么情况下必须使用 wire?    
#8楼
给作者发送短消息 给作者发送短消息 实名会员 商务会员 
查看用户其他信息
总分 1548 分
财富 3422 goCom币
威望 745
排名 第 19 名
段位 新手必读
 




发表回复
账号用户名   密码   登录
内容:url email imgsrc image code quote
范例 Example
bold italic underline linethrough   


 [更多...]