Core J2EE Technical Concepts Symposium - Download as PowerPoint

Document Sample
scope of work template
							Core J2EE Technical
Concepts Symposium
          廖峻鋒
          NCCU Computer Center
          Jan 24,2003
考慮採用J2EE 技術?
   技術問題
       確定J2EE 的技術能夠解決專案上的問題
   人員素質
       確定開發者能夠掌握相關的技術能力
   成本考量
       使用的J2EE Application Server 能夠吻合所需要的技
        術。
(引用自 : Java Two 2002 Taiwan / J2EE in Depth)
討論進行方式
   觀念介紹中間會加入若干討論主題。
   請大家對討論的主題發表意見或問題。
   無法回答的問題會統一搜集,於下次向各位報告。
Agenda
   J2EE Platform Overview.
   Administrative Affairs Management System in
    NCCU .
   EJB Technology Introduced.
       Session Bean .
       Entity Bean .
   DEMO : Developing EJB application using
    Jbuilder 8 and Weblogic 7 .
   Conclusions and Suggestions .
(Discussion)
Please define JavaBeans ?
    Difference of Classes and JavaBeans .
    When and how to use JavaBeans .
    Using JavaBeans with MVC Pattern in
     web applications.
What is J2EE
   J2EE is a industrial standard .
       J2EE 1.3 is Java Community Process         (JSR-58)
    J2EE composed of 4 topics
       Standard:
        http://java.sun.com/j2ee/j2ee-1_3-pfd4- spec.pdf
       J2EE reference implentations (PetStore)
        •   J2EE Reference Implementation
       J2EE blueprint
        •   http://java.sun.com/j2ee/blueprints/
       Compatibility verifications .
J2EE Architecture
   基本服務(Services)
       定義J2EE 伺服器所需要的服務
   元件架構(Component)
       定義能夠在J2EE 伺服器中執行的元件架構
   容器(Container)
       定義用來讓J2EE 元件執行的環境
   連接架構(Connector)
       定義J2EE 如何與後端既存系統相互溝通
J2EE Roles
   J2EE 產品提供者
   程式元件提供者
   應用程式開發者
   部署者
   系統管理者
   開發工具提供者
(Discussion) J2EE慣例 –
使用界面區分實作者與使用者
J2EE技術(1)
   Servlet 2.3/ JSP 1.2 (JavaServer Pages)
       由Server端動態產生網頁的技術。
   EJB 2.0 (Enterprise JavaBeans)
       伺服器端元件技術。
   JNDI (Java Naming and Directory Interface)
       命名與目錄服務。
J2EE技術(2)
   JTA 1.0 (Java Transaction API)
       控制交易服務。
   RMI-IIOP (Remote Method Interface – Internet
    Inter-ORB Protocol)
       允許Java 使用類似RMI的方式存取CORBA。
   Java-IDL (Java Definition Language)
       由IIOP與CORBA 互通。
J2EE技術(3)
   JDBC 2.0(Java Database Connectivity)
       提供存取DMBS服務。
   JMS 1.0 (Java Message Service)
       提供標準的API 存取Message Server。
   JavaMail 1.2
       包裝了IMAP/POP3/SMTP這三個協定。
J2EE技術(4)
   JAXP 1.1(Java APIs for XML Processing -
    Parsing)
       用來parse XML的API,目前已內建於J2SE 1.4。
   JCA (Java Connector Architecture)
       存取既存系統。
   JAAS 1.0 (Java Authentication and
    Authorization Service)
       提供認証服務。
(Discussion) Container
    Servlet / JSP Container .
    EJB Container .
Administrative Affairs
Management System in NCCU
   Provide web user
    interface using
    J2EE technology.
   Using weblogic
    5.1 as servlet and
    EJB container .
   Using Informix as
    main database
    with more than
    800 tables.
Deployment Architecture

   Must allow
    over 200
    users working
    concurrently
    online.
   Using
    weblogic 5.1
    Clustering as
    a solution .
J2EE Implementations
(Application Server)
   Application Server vendor do not
    required to implement all of J2EE
    functions.(Ex : Tomcat .)
   Application Server vendor
    implements all of J2EE standards
    will get a J2EE compatible
    certification . (Ex : Weblogic ,
    WebSphere )
Distributed Component
自己動手處理細節…..?
EJB幫我們處理細節
What is EJB ?
   伺服器端的分散式元件架構。
   提供monitor及transaction功能。
   我們依照EJB規格來開發Business rule及佈署程
    式,Container幫我們處理其它細節。
EJB Prerequisites
   要了解EJB,有二項J2EE技術必需先行了解。
       RMI-IIOP
       JNDI
   可參考Mastering EJB 2nd Edition 之附錄A。(可
    在www.thesereverside.com免費取得)
   可參考java.sun.com上的J2EE Tutorial。
EJB的組成
(discussion) jar、war and ear
EJB的分類
   Session Bean
       主要負責邏輯,以及狀態保留
   Entity Bean
       主要負責資料庫之間的處理
   Message-Driven Bean (EJB 2.0 only)
       不是由Client觸發,是由Container收到message之後
        主動觸發。
Session Bean
   使用者可以建立Session Bean
       Session Bean 可以當程式程式的邏輯元件
       Session Bean 用完之後,應將其移除
   一般的描述邏輯的Class轉成Session Bean
       新增兩個Interface
        • Home
        • Remote/Local Interface
       一般的Class 改寫成Bean Class
Stateful / Stateless
Session Bean
   Stateful Session Bean
       一個使用者會產生一個Stateful Session Bean
       可以保留資料在Stateful Session Bean 內
   Stateless Session Bean
       多個使用者可能共用相同的Stateless Session Bean
       不應該在Stateless Session Bean 中保留資料
   Stateful Session Bean的濫用會導致伺服器效能
    急速降低。
   使用Session Façade Pattern .
Session Facade Pattern
(Discussion)
JavaBeans 和 EJB有何不同
Object-Relational Mapping
   我們寫程式時,常將資料庫的某一個row,封裝
    成一個物件。這時每一個column就是物件中的一
    個field。
   此時所有資料的取出及轉換,由寫程式的人手動
    處理。這個程序稱為object-relational mapping。
   如果要對資料做變動或者要再加上交易等功能,
    會使程式變得相當複雜。
Entity Bean
   Entity Bean 的一個 instance可以對應到資料庫
    的一個Row。
   資料庫中的insert動作,在Entity Bean中叫做
    create(…..)。
   資料庫中delete動作,在Entity Bean中叫做
    remove()。
   要從資料庫中抓已存在的資料來處理,要呼叫
    findByPrimaryKey(….)。
BMP和CMP
   Bean Managed Persistence
       程式開發者自行控制資料的一致性
       所有的程式碼均由程式開發者產生
       可以做複雜的控制
   Container Managed Persistence
       由Container ,或是J2EE 伺服器來維護資料
       取決於J2EE 伺服器的能力
(Discussion)
何時使用Session bean ?何時使用
entity bean ?




   Session Bean : 動詞 ; Entity Bean : 名詞
Developing EJB application using
JBuilder 8 and Weblogic 7 .
      Jbuilder 8 provide several wizards and
       graphical editors which simplifies most of
       difficult jobs when writing EJB .
      Developing Stateless Session bean is most
       straightforward .
      To develop CMP 2.0 Entity bean we have to
       relate fields to DB columns .
      We must create TxDataSource in weblogic
       console instead of DataSource to support
       transactions of Entity bean .
Conclusions and Suggestions
    Message bean及JMS今天都沒有提到,但在和
     大型主機做溝通時,messaging相當重要。
    要活用EJB技術,必須先了解分散式系統的基本
     觀念。
    熟悉Gof的23個Design Patterns及Sun的Core
     J2EE Patterns,可以讓我們在閱讀J2EE文件時
     更加容易。
Conclusions and Suggestions
     EJB develop is very “Application Server
      dependent”.建議大家至少熟悉一種免費的Ap
      Server (如JBoss),再熟悉一種商用Ap Server
      (如weblogic),以便應付各種需求。
     完成專案以滿足客戶要求為目的,不是用來顯示
      工程師的功力,所以能用簡單技術處理的專案,
      就不要用複雜的技術。
     (Discussion)
     Design Pattern
     Resources in J2EE


http://java.sun.com/blueprints/patterns/catalog.html
Questions
Collection

						
Related docs
Other docs by bzs12927
CSS LETTER 03-03 ERRATA
Views: 11  |  Downloads: 1
The Future Of Perl CGI Programming
Views: 23  |  Downloads: 2
Descontaminación manual del win32-kido
Views: 48  |  Downloads: 0
It's Not ColdFusion - It's J2EE!
Views: 63  |  Downloads: 0
O homem perante a natureza Blaise Pascal - PDF
Views: 20  |  Downloads: 0
Scrum and Perl
Views: 48  |  Downloads: 1