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

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

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

    隨筆-6  評論-2  文章-0  trackbacks-0
      2006年5月12日
    轉載自Rinso的專欄

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

    Module有如下幾個標準特性:
    1. 定義了Component可見性的邊界,Component不可以在Module之外直接被引用。
    2. 在同一個Module內,Service的本地調用采用by-reference語義(除了聲明為remotable的接口)。在Module之間,Service的遠程調用采用by-value語義。
    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的名字,在一個SCA System中是唯一的。這個名字不能包含/或#字符。
    < module /> 包含0或n個 < entryPoint /> < component /> < externalService /> ?<wire />元素,這些元素的含義在之前的隨筆中 已經說過。Component包含Module的業務邏輯,Wire描述Component之間的Service的連接,Entry Point定義Module提供的、可供外部訪問的public service,External Service表示Module對外部Service的依賴。

    Component

    Component 是Implementation的配置實例,它即提供 Service也消費Service。多個Component可以使用并配置同一個Implementation,只要每個Component都采用不同 的配置。Implementation通過component type來定義可由Component配置的aspect。SCA支持多種不同的實現技術,如Java、BEPL、C++。SCA定義了一種可擴展機制來 引入新類型的Implementation。目前的規范不指定必須被SCA runtime支持的實現技術,供應商可以選擇他們認為重要的技術予以支持。我們來看一下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屬性表示這個component的名字,它必須在當前module中是唯一的。另外,當前module中的entry point和external servic不可以和component重名。
    <component />必 須有一個implementation子元素,它指向component的具體實現。implementation元素的名字由兩部分組成: "implementation"+代表implementation-type的限定詞,例如:implementation.java表示是由 Java來實現,implementation.bepl表示是由BPEL來實現。
    <implementation.java?class="services.myvalue.MyValueServiceImpl"/>
    <implementation.bpel?process="…"/>

    Component Type

    Component Type表示一個Implementation的可配置的東東,它由Implementation提供的Service、可設置的關聯到其他 Service的Reference和可設置的屬性組成。屬性和Reference將在使用這個Implementation的Component中具體 配置。
    確定一個Component Type需要兩個步驟:
    1. 從Implementation自身獲得信息(例如:從code annotation獲得信息)
    2. 從SCA component type文件獲得信息(XML配置文件)
    這是時下流行的做法,既可以從code annotation進行配置,也可以從XML進行配置,如果兩者同時使用,code annotation的優先級高,但是兩者的配置要統一。
    SCA component type文件的擴展名為".componentType",其中通過componentType元素來進行配置,我們來看看它的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 />表示這個Component Type提供的Service,可以通過<interface.interface-type />設置其為remotable。<reference />表示這個Component Type依賴的其他Service,也可以通過<interface.interface-type />設置其為remotable,multiplicity屬性表示可以關聯到這個Reference的Wire的數量。<property />表示這個Component Type可配置的屬性。
    讓我們來看一個例子,Java文件MyValueServiceImpl是這個例子中的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>

    相應的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的功能相同,兩者取一個使用就夠了。
    ????@Property
    ????
    private?String?currency?=?"USD";

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

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

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

    Implementation

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

    Interface

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

    <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方法的傳入參數和返回值可以使用Java class或Primitive type。最好使用SDO生成的Java class,因為它們和XML之間做了整合。(SDO也是IBM推出的一個SOA系列的標準。)
    如果使用WSDL,Service方法的傳入參數和返回值則使用XML schema描述。XML schema種描述的參數以SDO DataObject的形式暴露給開發者。

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

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

    由local Interface提供的Service只能在同一Module中使用,它們不能通過Entry Point發布到外部。如果不聲明@Remotable,Java interface默認為local。典型的local Interface是細粒度的,用于緊耦合的交互。它允許方法重載,并采用by-reference語義。
    posted @ 2006-04-25 15:58 Allen Young 閱讀(852) | 評論 (0)編輯 收藏
    SCA Assembly Model涵蓋了兩種model:
    • 用來組裝緊耦合服務的model
    • 用來組裝松耦合面向服務系統的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。一個Module包含一個或幾個Component,這些Component包含了這個Module所要提供的 business function。Component把這些function以Service的形式提供給外界,這些Service即可以被同一Model中的其他 Component使用,也可以通過Entry Point在Module之外使用。Component也可以依賴于其他Component提供的Service,這些依賴叫做Reference。 Reference即可以是對同一Module內其他Component提供的Service的link,也可以是對Module外Service(其他 Module提供的Service)的link。連接到Module外部Service的Reference在其Module中被定義為External Service。Reference和Service之間的連接也包含在這個Module中,用Wire來表示。

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

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

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

    1. 什么是面向服務的體系結構(SOA)?
    2. 我可以用面向服務的體系結構做什么?
    3. 構成 SOA 的技術是什么?
    4. SOA 與其他技術的關系如何?
    5. 我可以如何構建 SOA 系統?
    6. 我可以如何提高我的 SOA 技能?
    7. IBM 的什么工具和產品可用于 SOA?
    IBM肯定會為自己做廣告,呵呵,各位保持清醒就是了。
    posted @ 2006-04-25 11:09 Allen Young 閱讀(375) | 評論 (0)編輯 收藏
    Elune Team由Allen Young,atlanta,Helena和silver.sun組成,近期目標為參加2006 IBM杯中國高校SOA應用大賽,因此會在比賽期間在BlogJava SOA Team Blog進行相關討論,內容以SOA為主,會涉及參賽項目管理,團隊文化等。
    posted @ 2006-04-25 10:23 Allen Young 閱讀(307) | 評論 (0)編輯 收藏
    歡迎各位對SOA感興趣的朋友加入討論BlogJava SOA Team Blog,下面是個人的幾點聲明,各位可以給我建議或補充。

    1. 隨筆要與Team Blog主題相關,否則將刪除。
    2. 做一個Critical Thinker,對自己的言論負責。
    3. 歡迎各種觀點(我們需要不同的聲音),歡迎爭論,不歡迎爭吵。
    4. 隨筆請用Courier New字體,2號字,以便保持整體風格一致。

    SOA是一種態度,而不是一種技術。
    posted @ 2006-04-25 10:17 Allen Young 閱讀(261) | 評論 (0)編輯 收藏
    僅列出標題  
    主站蜘蛛池模板: 久久久久亚洲精品中文字幕| 国产免费午夜a无码v视频| 亚洲精品无码成人片久久| 免费人成视频在线播放| 亚洲国产小视频精品久久久三级| 春暖花开亚洲性无区一区二区| 四虎在线视频免费观看| 亚洲国产精品99久久久久久| 国产成人一区二区三区免费视频| 日本系列1页亚洲系列| 亚洲AV伊人久久青青草原| 四虎精品免费永久免费视频| 久久久久亚洲AV无码专区桃色| 国内精品99亚洲免费高清| 亚洲成AV人片在| 成人免费大片免费观看网站| 亚洲最大成人网色香蕉| 日日AV拍夜夜添久久免费| 免费播放美女一级毛片| 亚洲区小说区激情区图片区| 最近中文字幕无免费| 2020天堂在线亚洲精品专区| 亚洲Av无码国产情品久久 | 亚洲AV电影院在线观看| 16女性下面无遮挡免费| 亚洲精品无码少妇30P| 亚洲成片观看四虎永久| 日本免费久久久久久久网站| 亚洲综合色7777情网站777| 国产成人无码a区在线观看视频免费 | 1000部禁片黄的免费看| 亚洲另类无码专区丝袜| 国产精品亚洲视频| 在线视频免费观看爽爽爽| 免费一级毛片在线播放视频免费观看永久 | 中国videos性高清免费| 亚洲精品国产肉丝袜久久| 国产男女猛烈无遮挡免费视频 | 久久er国产精品免费观看8| 亚洲欧洲日产国码在线观看| 国产免费看插插插视频|