<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-6  評(píng)論-2  文章-0  trackbacks-0
      2006年4月25日
    轉(zhuǎn)載自Rinso的專欄

    原文
    posted @ 2006-05-12 10:26 Allen Young 閱讀(422) | 評(píng)論 (1)編輯 收藏
    SCA Module是緊耦合component的最大的組合物,同時(shí)也是松耦合SCA System中的基本單元,也就是說,很多緊耦合的東東組成Module,然后很多Module組成松耦合的System。我們都知道一味的緊耦合及松耦 合都是不好的,過分的緊耦合會(huì)降低系統(tǒng)的靈活性、可重用性等,而過分的松耦合會(huì)導(dǎo)致系統(tǒng)性能的下降、開發(fā)難度增加、代碼不直觀、測(cè)試難做等,因此,選擇一 個(gè)合適的緊耦合和松耦合之間的臨界點(diǎn)是很重要的,而Module就是這個(gè)臨界點(diǎn)。

    Module有如下幾個(gè)標(biāo)準(zhǔn)特性:
    1. 定義了Component可見性的邊界,Component不可以在Module之外直接被引用。
    2. 在同一個(gè)Module內(nèi),Service的本地調(diào)用采用by-reference語(yǔ)義(除了聲明為remotable的接口)。在Module之間,Service的遠(yuǎn)程調(diào)用采用by-value語(yǔ)義。
    3. 定義了部署的單元。Module用來為SCA System提供business service。
    Module由sca.module中的module元素定義。下面是module的schema:
    <?xml?version="1.0"?encoding="ASCII"?>
    <module?xmlns=”http://www.osoa.org/xmlns/sca/0.9”
    ????
    xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"?name="xs:NCName">

    ????<entryPoint?name="xs:NCName" multiplicity="0..1?or?1..1?or?0..n?or?1..n"??>*
    ????????
    <interface.interface-type?/>
    ????????
    <binding.binding-type?uri="xs:anyURI"?/>+
    ????????
    <reference>wire-target-URI</reference>
    ????
    </entryPoint>

    ????<component?name="xs:NCName">*
    ????????
    <implementation.implementation-type?/>
    ????????
    <properties>?
    ????????????
    <v:property-name>property-value</v:property-name>+
    ????????
    </properties>
    ????????
    <references>?
    ????????????
    <v:reference-name>wire-target-URI</v:reference-name>+
    ????????
    </references>
    ????
    </component>

    ????<externalService?name="xs:NCName">*
    ????????
    <interface.interface-type?/>+
    ????????
    <binding.binding-type?uri="xs:anyURI"?/>*
    ????
    </externalService>

    ????<wire>*
    ????????
    <source.uri>wire-source-URI</source.uri>
    ????????
    <target.uri>wire-target-URI</target.uri>
    ????
    </wire>

    </module>

    < module /> 的name屬性表示module的名字,在一個(gè)SCA System中是唯一的。這個(gè)名字不能包含/或#字符。
    < module /> 包含0或n個(gè) < entryPoint /> < component /> < externalService /> ?<wire />元素,這些元素的含義在之前的隨筆中 已經(jīng)說過。Component包含Module的業(yè)務(wù)邏輯,Wire描述Component之間的Service的連接,Entry Point定義Module提供的、可供外部訪問的public service,External Service表示Module對(duì)外部Service的依賴。

    Component

    Component 是Implementation的配置實(shí)例,它即提供 Service也消費(fèi)Service。多個(gè)Component可以使用并配置同一個(gè)Implementation,只要每個(gè)Component都采用不同 的配置。Implementation通過component type來定義可由Component配置的aspect。SCA支持多種不同的實(shí)現(xiàn)技術(shù),如Java、BEPL、C++。SCA定義了一種可擴(kuò)展機(jī)制來 引入新類型的Implementation。目前的規(guī)范不指定必須被SCA runtime支持的實(shí)現(xiàn)技術(shù),供應(yīng)商可以選擇他們認(rèn)為重要的技術(shù)予以支持。我們來看一下Component的schema:
    <component?name="xs:NCName">*
    ???
    <implementation.implementation-type?/>
    ???
    <properties>?
    ???????
    <v:property-name>property-value</v:property-name>+
    ???
    </properties>
    ???
    <references>?
    ???????
    <v:reference-name>wire-target-URI</v:reference-name>+
    ???
    </references>
    </component>
    <component />的name屬性表示這個(gè)component的名字,它必須在當(dāng)前module中是唯一的。另外,當(dāng)前module中的entry point和external servic不可以和component重名。
    <component />必 須有一個(gè)implementation子元素,它指向component的具體實(shí)現(xiàn)。implementation元素的名字由兩部分組成: "implementation"+代表implementation-type的限定詞,例如:implementation.java表示是由 Java來實(shí)現(xiàn),implementation.bepl表示是由BPEL來實(shí)現(xiàn)。
    <implementation.java?class="services.myvalue.MyValueServiceImpl"/>
    <implementation.bpel?process="…"/>

    Component Type

    Component Type表示一個(gè)Implementation的可配置的東東,它由Implementation提供的Service、可設(shè)置的關(guān)聯(lián)到其他 Service的Reference和可設(shè)置的屬性組成。屬性和Reference將在使用這個(gè)Implementation的Component中具體 配置。
    確定一個(gè)Component Type需要兩個(gè)步驟:
    1. 從Implementation自身獲得信息(例如:從code annotation獲得信息)
    2. 從SCA component type文件獲得信息(XML配置文件)
    這是時(shí)下流行的做法,既可以從code annotation進(jìn)行配置,也可以從XML進(jìn)行配置,如果兩者同時(shí)使用,code annotation的優(yōu)先級(jí)高,但是兩者的配置要統(tǒng)一。
    SCA component type文件的擴(kuò)展名為".componentType",其中通過componentType元素來進(jìn)行配置,我們來看看它的schema:
    <?xml?version="1.0"?encoding="ASCII"?>
    <componentType?xmlns="http://www.osoa.org/xmlns/sca/0.9"?>
    ??? <service?name="xs:NCName">*
    ??????? <interface.interface-type/>
    ??? </service>
    ??? <reference?name="xs:NCName"?multiplicity="0..1?or?1..1?or?0..n?or?1..n"?>*
    ??????? <interface.interface-type/>
    ??? </reference>
    ??? <property?name="xs:NCName"?type="xs:QName"?many="xs:boolean"? default="xs:string"??required="xs:boolean"?/>*
    </componentType>
    <service />表示這個(gè)Component Type提供的Service,可以通過<interface.interface-type />設(shè)置其為remotable。<reference />表示這個(gè)Component Type依賴的其他Service,也可以通過<interface.interface-type />設(shè)置其為remotable,multiplicity屬性表示可以關(guān)聯(lián)到這個(gè)Reference的Wire的數(shù)量。<property />表示這個(gè)Component Type可配置的屬性。
    讓我們來看一個(gè)例子,Java文件MyValueServiceImpl是這個(gè)例子中的Implementation,其SCA component type如下:
    <?xml?version="1.0"?encoding="ASCII"?>
    <componentType?xmlns="http://www.osoa.org/xmlns/sca/0.9">
    ??? <service?name="MyValueService">
    ??????? <interface.java?interface="services.myvalue.MyValueService"/>
    ??? </service>
    ??? <reference?name="customerService">
    ??????? <interface.java?interface="services.customer.CustomerService"/>
    ??? </reference>
    ??? <reference?name="stockQuoteService">
    ??????? <interface.java?interface="services.stockquote.StockQuoteService"/>
    ??? </reference>
    ??? <property?name="currency"?type="xsd:string"?default="USD"/>
    </componentType>

    相應(yīng)的Java代碼如下:

    //?MyValueService?interface.
    package?services.myvalue;

    public?interface?MyValueService?{
    ????
    public?void?calculate();
    }

    //?MyValueServiceImpl?class
    package?services.myvalue;

    import?services.customer.CustomerService;
    import?services.stockquote.StockQuoteService;

    public?class?MyValueServiceImpl?implements?MyValueService?{

    ????
    //?Code?annotation.?和XML的功能相同,兩者取一個(gè)使用就夠了。
    ????@Property
    ????
    private?String?currency?=?"USD";

    ????@Reference
    ????
    private?CustomerService?customerService;

    ????@Reference
    ????
    private?StockQuoteService?stockQuoteService;

    ????
    public?void?calculate()?{
    ????????
    //?do?your?real?business?logic?here.
    ????}
    }

    Implementation

    Implementation 是業(yè)務(wù)邏輯的具體實(shí)現(xiàn),這些業(yè)務(wù)邏輯會(huì)提供或消費(fèi)Service。SCA支持多種實(shí)現(xiàn)技術(shù),如Java、BPEL或C++。我們已經(jīng)知道, Service、Reference和Property是Implementation中關(guān)于配置的東東,他們組成Component Type。在運(yùn)行時(shí),Implementation Instance是Implementation的實(shí)例化,它提供的業(yè)務(wù)邏輯和Implementation中的相同,但Property和 Reference則取決于Component中的配置。下圖描述了Component Type、Component、Implementation和Implementation Instance之間的關(guān)系:
    SCA-relationship-between-implementation-and-implementation-instance.PNG

    Interface

    Interface 負(fù)責(zé)定義一個(gè)或多個(gè)business function。這些business function通過Service提供給外部,外部通過Reference使用它們。Service由自己實(shí)現(xiàn)的Interface定義。SCA支持如 下3種Interface:
    • Java interfaces
    • WSDL 1.1 portTypes
    • WSDL 2.0 interfaces
    我們一個(gè)一個(gè)來看:

    <interface.java?interface="NCName"?…?/>
    其中interface屬性為Java interface的全名(包括package)。例如:
    <interface.java?interface="services.stockquote.StockQuoteService" />

    <interface.wsdl?interface="xs:anyURI"?…?/>
    其中interface屬性為portType/interface的URI,其格式為<WSDL-namespace-URI>#wsdl.interface(<portType or Interface-name>)。例如:
    <interface.wsdl?interface="http://www.stockquote.org/StockQuoteService#wsdl.interface(StockQuote)"/>

    如果使用Java interface,Service方法的傳入?yún)?shù)和返回值可以使用Java class或Primitive type。最好使用SDO生成的Java class,因?yàn)樗鼈兒蚗ML之間做了整合。(SDO也是IBM推出的一個(gè)SOA系列的標(biāo)準(zhǔn)。)
    如果使用WSDL,Service方法的傳入?yún)?shù)和返回值則使用XML schema描述。XML schema種描述的參數(shù)以SDO DataObject的形式暴露給開發(fā)者。

    一 個(gè)Component Implementation的Service是否是remotable的是由Service的Interface定義的。如果使用Java,為 Interface添加@Remotable annotation可以把Service聲明為remotable。WSDL定義的interface永遠(yuǎn)是remotable的。
    典型的remoteable interface是粗力度的,用于松耦合的交互。Remotable Service Interface不允許函數(shù)重載。無(wú)論是在 Module之外還是在Module內(nèi)的其他Component中使用
    remotable Service,數(shù)據(jù)交換都采用by-value語(yǔ)義。
    Remotable Serviced的Implementation可能會(huì)在Service調(diào)用過程中或調(diào)用之后改變傳入?yún)?shù),也可能在調(diào)用之后修改返回值。如果 remotable Service被locally或remotely調(diào)用,SCA container會(huì)保證傳入?yún)?shù)及返回值的改變對(duì)Service的調(diào)用者是不可見的(這就是by-value語(yǔ)義)。下面是一個(gè)remotable java interface的例子:
    package?services.hello;

    @Remotable
    //?@AllowsPassByReference
    public?interface?HelloService?{
    ????
    public?String?sayHello(String?message);
    }
    由External Service提供的Service永遠(yuǎn)是remotable的。可以使用@AllowsPassByReference annotation允許一個(gè)remotable Service在被同一Module中的其他Component調(diào)用時(shí)使用by-reference語(yǔ)義,這樣可以提高性能。

    由local Interface提供的Service只能在同一Module中使用,它們不能通過Entry Point發(fā)布到外部。如果不聲明@Remotable,Java interface默認(rèn)為local。典型的local Interface是細(xì)粒度的,用于緊耦合的交互。它允許方法重載,并采用by-reference語(yǔ)義。
    posted @ 2006-04-25 15:58 Allen Young 閱讀(859) | 評(píng)論 (0)編輯 收藏
    SCA Assembly Model涵蓋了兩種model:
    • 用來組裝緊耦合服務(wù)的model
    • 用來組裝松耦合面向服務(wù)系統(tǒng)的model

    SCA Assembly Model由一系列的artifact組成,這些artifact由XML文件中的element定義。下面先給出這些artifact的名詞:
    • Module
    • Service
    • Component
    • Entry Point
    • Reference
    • External Service
    • Wire
    • Implementation
    • SCA System
    • Subsystem
    • Module Component
    最基本的artifact是Module,它是SCA的部署單元,用來保存可以被 remote訪問的Service。一個(gè)Module包含一個(gè)或幾個(gè)Component,這些Component包含了這個(gè)Module所要提供的 business function。Component把這些function以Service的形式提供給外界,這些Service即可以被同一Model中的其他 Component使用,也可以通過Entry Point在Module之外使用。Component也可以依賴于其他Component提供的Service,這些依賴叫做Reference。 Reference即可以是對(duì)同一Module內(nèi)其他Component提供的Service的link,也可以是對(duì)Module外Service(其他 Module提供的Service)的link。連接到Module外部Service的Reference在其Module中被定義為External Service。Reference和Service之間的連接也包含在這個(gè)Module中,用Wire來表示。

    一個(gè)Component由一個(gè)配置好的Implementation組成,這個(gè)Implementation就是實(shí)現(xiàn)business function的那段程序。Component使用具體的值來配置Implementation中聲明的可配置的屬性,Component也可以把 Implementation中聲明的wiring of reference配置到具體的目標(biāo)Service上去。

    Module部署在SCA System中。一個(gè)SCA System往往表示一組相關(guān)Service的集合。為了方便建立和配置SCA System,Subsystem可以用來對(duì)Module進(jìn)行分組和配置。Subsystem包含Module Component(Module的配置好了的實(shí)例),和Module一樣,它也有Entry Point、External Service和Wire。

    下面附上兩張圖來展示這些artifact之間的關(guān)系。
    SCA-module-assembly-diagram.PNG
    SCA-system-assembly-diagram.PNG
    posted @ 2006-04-25 14:34 Allen Young 閱讀(620) | 評(píng)論 (1)編輯 收藏
    SOA and Web services 新手入門,轉(zhuǎn)自IBM DeveloperWorks,它的SOA and Web Service專區(qū)是學(xué)習(xí)SOA的很好的資源中心。本文章的內(nèi)容如下:

    1. 什么是面向服務(wù)的體系結(jié)構(gòu)(SOA)?
    2. 我可以用面向服務(wù)的體系結(jié)構(gòu)做什么?
    3. 構(gòu)成 SOA 的技術(shù)是什么?
    4. SOA 與其他技術(shù)的關(guān)系如何?
    5. 我可以如何構(gòu)建 SOA 系統(tǒng)?
    6. 我可以如何提高我的 SOA 技能?
    7. IBM 的什么工具和產(chǎn)品可用于 SOA?
    IBM肯定會(huì)為自己做廣告,呵呵,各位保持清醒就是了。
    posted @ 2006-04-25 11:09 Allen Young 閱讀(380) | 評(píng)論 (0)編輯 收藏
    Elune Team由Allen Young,atlanta,Helena和silver.sun組成,近期目標(biāo)為參加2006 IBM杯中國(guó)高校SOA應(yīng)用大賽,因此會(huì)在比賽期間在BlogJava SOA Team Blog進(jìn)行相關(guān)討論,內(nèi)容以SOA為主,會(huì)涉及參賽項(xiàng)目管理,團(tuán)隊(duì)文化等。
    posted @ 2006-04-25 10:23 Allen Young 閱讀(313) | 評(píng)論 (0)編輯 收藏
    歡迎各位對(duì)SOA感興趣的朋友加入討論BlogJava SOA Team Blog,下面是個(gè)人的幾點(diǎn)聲明,各位可以給我建議或補(bǔ)充。

    1. 隨筆要與Team Blog主題相關(guān),否則將刪除。
    2. 做一個(gè)Critical Thinker,對(duì)自己的言論負(fù)責(zé)。
    3. 歡迎各種觀點(diǎn)(我們需要不同的聲音),歡迎爭(zhēng)論,不歡迎爭(zhēng)吵。
    4. 隨筆請(qǐng)用Courier New字體,2號(hào)字,以便保持整體風(fēng)格一致。

    SOA是一種態(tài)度,而不是一種技術(shù)。
    posted @ 2006-04-25 10:17 Allen Young 閱讀(267) | 評(píng)論 (0)編輯 收藏
    主站蜘蛛池模板: aⅴ在线免费观看| 亚洲人成片在线观看| 免费的一级片网站| 亚洲国产精品无码av| 日韩中文字幕在线免费观看| 毛片在线全部免费观看| 永久免费无码网站在线观看个| 亚洲资源最新版在线观看| 国产zzjjzzjj视频全免费| 日本永久免费a∨在线视频| 亚洲国产精品一区二区久| 亚洲∧v久久久无码精品 | 永久免费无码网站在线观看| 在线看无码的免费网站| 中文字幕视频免费在线观看| 久久久久无码精品亚洲日韩| 亚洲区不卡顿区在线观看| 日本午夜免费福利视频| 最近免费中文字幕4| 国产在线a免费观看| 无遮挡国产高潮视频免费观看| 亚洲乱码日产精品一二三| 亚洲中文字幕久久精品无码喷水| 色猫咪免费人成网站在线观看| 在线观看免费黄网站| 成全视成人免费观看在线看| 一区二区三区免费在线观看| 亚洲国产av美女网站| 亚洲精品国产肉丝袜久久| 亚洲成av人片一区二区三区 | 亚洲av乱码一区二区三区香蕉| 久久亚洲精品无码AV红樱桃| 日本免费网站观看| 日韩在线视频免费看| 日韩一区二区在线免费观看| 日韩成人免费aa在线看| 国产又黄又爽又刺激的免费网址| 免费国产成人午夜在线观看| 久久国产精品免费专区| 99久久免费观看| 美女被免费喷白浆视频|