Site Search :
Standard Enterprise XML Methodology Pattern Setting Tunning Other
Article Contributors
GuestBook
Javapattern Maven
XSourceGen Dev
JetSpeed Test
JLook Image
jLook Family Site


Blueprint(J2EE Petstore) client tier pattern overview
 
½ã ºí·çºê¸°Æ®ÀÎ ¾Ö¿Ïµ¿¹°°¡°Ô(Petstore)ÀÇ Å¬¶óÀ̾ðÆ®´ÜÀÇ ÆÐÅÏ overview¹®¼­·Î °£·«ÇÏ°Ô Ç¥½ÃÇÑ´Ù. ( 2003/03/07 ) 571
Written by ienvyou - ÃÖÁö¿õ
1 of 1
 

1. web client
- protocol : http, https¸¦ ÀÌ¿ë, web-tier¿Í ¿¬µ¿
- sessionless, non-transactional
- contents format : html, xml
¢º type : 
-> web browser ¿Í ¿¬µ¿ (applet, browser plug-ins, ActiveX component ), 
-> stand-alone app. : º¸´Ù ´Ù¾çÇÏ°í interactiveÇÑ GUI ±¸¼º °¡´É : swing
-> non-java client : ȯ°æ¿¡ µû¸¥ specialized service °¡´É
	¿¹) EXCEL³»¿¡ Æ÷ÇÔµÈ VB client ¿Í jsp ÀÇ ¿¬µ¿ : xml ÇüÅÂÀÇ data °øÀ¯
2. ejb client
- protocol : rmi-iiop¸¦ ÀÌ¿ëÇØ ejb-tier¿Í ¿¬µ¿
- ´Ù¾çÇÑ middle-tier service(jndi, jms, jdbc..) µîÀÇ È°¿ë °¡´É
- ejb container¿Í ¿¬°áµÈ library ÀÌ¿ë
- java app.
- jdbc transaction ÀÌ¿ë °¡´É
- »ç¿ëÀÚ ÀÎÁõ ÀýÂ÷ °ÅÃľß
- Provide a more flexible user interface
- handle complex data models : CAD schemas ¸¦ Á¶ÀÛÇÏ´Â application ...
- Are transaction-capable : JTA ¸¦ ÀÌ¿ëÇÑ Ã³¸® °¡´É
- require explicit deployment : internet ȯ°æÀÇ °æ¿ì ºÎÀûÀý
- Require firewall reconfiguration : rmi-iiop °¡ firewall À» Åë°úÇÒ ¼ö ¾ø´Ù
- Tend to be more complex
¢º type : 
-> java : application, signed and trusted applet
-> non-java : VB, C++..
-> com : VB + java script/perl
	-> create an rmi-iiop proxy in the client
	-> type libraries must be installed
	-> IDispatch interface ¸¦ ÀÌ¿ëÇØ method È£Ãâ : JNI ¸¦ ÀÌ¿ë rmi-iiop proxy¿Í Åë½Å
	-> j2ee security service ¸¦ »ç¿ë°ï¶õ
	-> non-java client¿¡¼­ ejb-tier·Î transactionÀ» À¯Áö½Ãų ¼ö ¾ø´Ù, JTA »ç¿ë¸øÇÔ
-> legacy ÀÇ ÅëÇÕµîÀÇ ÀÌÀ¯·Î »ç¿ë
-> com : asp ¸¦ ÀÌ¿ë °¡´É

3. eis client
- jdbc ¸¦ ÀÌ¿ë rdbms resource direct access
- connector ¸¦ ÀÌ¿ë non-rdbms resource direct access ( mainframe, ERP )
- directly access·Î ÀÎÇÑ security ¹®Á¦ ¹ß»ý °¡´É 
- UI ¿Í business logic À» µ¿½Ã¿¡ °¡Áö´Â °ü°è·Î À̵éÀÇ management ±â´É ¿ª½Ã ÇÊ¿ä : tend to be complex
¿¹) db ³»ÀÇ tableÀ» °ü¸®ÇÏ´Â stand-alone eis client
	-> ÁÖ±âÀûÀ¸·Î (Çѹã) È£ÃâµÇ¾î ½ÇÇà


4. designing for multiple types of client
¢º MVC pattern

¢º Model : software abstraction of application data, business rules 
-> can be shared across all clients
-> °¢ client type ¿¡ ¸Â´Â model object ÀÇ °³¹ß ÇÊ¿ä¾ø½¿
-> °¢ clientº°·Î ¼­·Î ´Ù¸¥ authorization level ÀÇ Àû¿ëÀÌ ÇÊ¿äÇÒ °æ¿ì "Security mediator object" ¸¦ ÀÌ¿ë

- view : renders the contents of a model
-> client º°·Î ¼­·Î ´Ù¸¥ ÇüŸ¦ °¡Áú ¼öµµ ÀÖ´Ù
-> À̵éÀÇ ÅëÇÕÀº »ó´çÈ÷ ¾î·Æ´Ù
-> finer grained level ÀÏ °æ¿ì ÀÏÁ¤ºÎºÐÀÇ code ¸¦ °øÀ¯ÇÒ ¼öµµ ÀÖ´Ù
	¿¹) jsp tag ·Î  showOrder ¶ó´Â ºÎºÐ ±¸Çö : À̸¦ shopping / administrator client ¸ðµÎ¿¡°Ô »ç¿ë

¢º controller : defines application behavior
-> interprets user gestures / model ¿¡°Ô ¼öÇàÇÒ ¼ö ÀÖµµ·Ï Àü´Þ
-> view ÀÇ ¼±ÅÃ

-> ´ÜÀÏ controller
	¿¹) bank applicationÀÇ µÎ°¡Áö view : web-based interface and stand-alone desktop client
		À̵éÀÇ ¿äûÀ» model ¿¡°Ô Àü´ÞÇÏ´Â controller´Â Çϳª·Î µðÀÚÀÎ °¡´É
-> view ¿¡ Á¾¼ÓÀûÀÎ ÇüÅ°¡ ÀϹÝÀû : redeploy °¡ ¾î·Á¿ò

-> interpreting user gestures
-> user gestures 
    -> JFC event(button click...)
    -> web-interface event(http get/post...)
    -> message(asynchronous messageÀÇ »ý¼º)
->  reusable as possible
    -> user gestures¸¦ business event·Î º¯È¯½ÃÅ°´Â ÇüÅ·ΠµðÀÚÀÎ
        * business event : uni-form, view-neutral(Á߸³ÀûÀÎ) representation
    ¿¹) http request ÀÇ get/post ¿äû À» business event·Î º¯È¯½ÃÅ°´Â class generate
        => RequestToEventTranslator class
    
    -> client typeÀÇ º¯È­³ª, Ãß°¡½Ã º°µµÀÇ controller¸¦ Ãß°¡½ÃÅ´À¸·Î¼­ °¡´É

-> selecting the View
-> layered view selection component design
    -> business event¿Í À¯»çÇÑ object ¸¦ È­¸é¿¡ representÇÏ´Â component
    -> view generator Á¤ÀÇ 

	
Web Tier

¢º web-based application
- to generate dynamic content customized to ther needs
- jsp, servlet, cgi
- type
-> simple web-based j2ee application
-> jsp + servlet
-> jsp + worker bean
-> complex transactional j2ee application
-> jsp + worker bean in conjunction with EB

¢º design goal
-> internationalization
-> localization
-> migration strategies from web-centric to ejb-centric application

¢º web application
-> html/xml document + web component(jsp/servlet) + 
	other resource(directory structure/WAR-web archive file)
-> central server¿¡ À§Ä¡ÇÏ¸ç ´Ù¾çÇÑ client¿¡°Ô service
-> secure B-to-B application , electronic commerce web sites ¿¡¼­ »ç¿ë

¢º web container
-> web applicationÀÌ µ¿ÀÛÇÏ´Â runtime environment
-> web server ³»¿¡¼­ µ¿ÀÛ
-> naming service, life cycle management µîÀÇ ¼­ºñ½º Á¦°ø

¢º web server
-> security, concurrency, transactions, swapping to secondary storage µîÀÇ ¼­ºñ½º Á¦°ø
-> ejb server ¿Í ÇÔ²² µ¿ÀÛ
-> ejb server¿Í °°Àº ¸Ó½Å³»¿¡ ¹èÄ¡µÉ ÇÊ¿ä´Â ¾øÀ¸¸ç ¼­·Î´Ù¸¥ 
	web-container°£ÀÇ communication °¡´É


1. Dynamic contents create

1) CGI
-> file system, dbms °°Àº resource Á¢±Ù½Ã server platform Á¾¼ÓÀû : platform specific
-> process base : do not scale well
-> content + display logic : difficult to maintain
2) Servlet
-> viwed as applets that run on the server
-> servlet's output : html, xml, other content type..
-> different platform ¿¡¼­ recompile ¾øÀÌ »ç¿ë °¡´É
-> jdbc °°Àº api »ç¿ë °¡´É
-> extensible
	-> controller servlet : secure controller·Î È®ÀåµÉ ¼ö ÀÖ´Ù
-> lightweight thread base
-> uniform api for maintaing session data : HttpSession
-> embeded html in print statements 
	-> look and feel À» runtime½Ã¿¡ È®ÀÎ °¡´É
	-> content, display º¯°æÀ¸·Î ÀÎÇÑ recompile ÃÊ·¡

-> generating binary data
	-> generates a graph summarizing stock performance from data retrieved from a database
	-> image ´Â memory ³»¿¡ »ý¼º, updated every minute
	-> servlet ¿¡¼­ data generat -> display
	-> save time, improve performance
-> extending a web server's functionality
	-> jsp ÆÄÀÏÀ» servletÀ¸·Î parsing, compiling, loading ó¸® µî

3) JSP
-> declarative, presentation-centric method of developing servlets
-> rapidly develop servlets
-> content , display logic ÀÇ ºÐ¸®
-> Àç»ç¿ë °¡´ÉÇÑ component-based architecture
-> text-basec document : html + jsp tags + java code + other information
-> complex dynamic formatting of html : worker bean + custom tab ¸¦ ÀÌ¿ë
	-> web designer ÀÇ ÀÛ¾÷À» ºÐ¸®½ÃÅ´
-> automatically recompiled and reloaded into the web server

¢º servlet vs. jsp
-> servlet
	-> complex logic processing
	-> navigation paths between screens
	-> access to enterprise data
	-> formatting the data into an html response
-> jsp
	-> À§ÀÇ ±â´É ¸ðµÎ °¡´É
	-> encapsulate complex tasks with custom tag/worker bean
	-> º¸Åë Àß µðÀÚÀÎµÈ web-component ÀÇ °æ¿ì jsp + custom tag + worker bean À» ÀÌ¿ë
	-> servletÀº Àß »ç¿ëµÇÁö ¾ÊÀ½

2. web-component roles
¢º presentation component
-> generate html/xml response
-> produces binary data(such as image ) : ÁÖ·Î servlet¿¡¼­
-> personalizing the user interface
-> user ¸¶´Ù customizing °¡´ÉÇÑ banner¸¦ ¸¸µé·Á°í ÇÒ¶§
-> presentation component templates (ÁÖ·Î jsp tag ÀÌ¿ë)
	-> taglib Á¤ÀÇ

ex) 
<%@ taglib uri="xxxx" prefix="j2ee" %>
<%@ include file="screenDefinitions.jsp" %>
<html><title>...
<j2ee:insert template="template" parameter="HtmlTitle" /></title>
<body>
<j2ee:insert template="template" parameter="htmlBanner" />
<j2ee:insert template="template" parameter="htmlBody" />
</body></html>


¢º front component
-> manage other components and handle http request 
-> convert the request into a form that an application can understand
-> provide single entry point
	-> security, application state, presentation uniform µîÀÇ ÀåÁ¡
	-> easier to maintain
-> mvc ¿¡¼­ÀÇ controllerÀÇ ¿ªÇÒ°ú ºñ½ÁÇÑ ±â´É ¼öÇà


3. web-application designs
1) Basic jsp and servlets
2) Modular components :  jsp + workerBean + process request from form data
			+ display personalized contents
3) ejb-centric application
- flexibility Áõ°¡
-> mvc architecture ÀÇ µµÀÔ 
-> Model : EB
	-> EJB controller ¿¡°Ô Àü´ÞµÈ data º¯°æ event¿¡ ÀÇÇØ EB³»ÀÇ µ¥ÀÌŸ modification 
¢º View 
	-> ´Ù¾çÇÑ client view support
	-> model  ³»ÀÇ data ¸¦ display
	-> VB client view, Swing view, web view
	-> jsp ÀÇ È°¿ë
		-> model data ÀÇ display ¿¡ °ü·ÃµÈ code¸¸À» Æ÷ÇÔ
		-> HTML : banner, navigation bar 
		-> Locale-specific currencyÀÇ Ç¥Çöµî 
		-> custom tag, worker bean À» ÀÌ¿ëÇØ ±¸Çö
	-> worker bean
		-> web-controller¿¡°Ô µî·Ï
		-> ejb-controller·ÎºÎÅÍ model data º¯°æ À̺¥Æ®¸¦ ¹Þ´Â´Ù
		-> EB ¿¡ ¿¬°á, mirror/refresh data
		-> read-only data
¢º controller
-> front component + request processor + web controller + ejb controller
	-> ¸ðµç http request¸¦ ¹Þ¾ÆµéÀÌ´Â controller
	-> web-tier / ejb-tier »çÀ̸¦ ¸Þ¿ì´Â ¿ªÇÒ
-> http request ³»ÀÇ posted data ¸¦ ¹Þ¾ÆµéÀÓ
-> model data update event ·Î convert

¢º front component
	-> application url ÀÇ ÅëÀÏ
	-> all http request¸¦ ÀûÀýÇÏ°Ô request processor¿¡°Ô Àü´Þ

¢º request processor
	-> web application °ú http-based client¿ÍÀÇ link
	-> http request ¸¦ event·Î convert
¢º web controller
	-> ejb controller ¿¡°Ô event forwarding
	-> update event ¸¦ ejb controller·ÎºÎÅÍ ¹Þ¾Æ ÀûÀýÇÑ 
	web-tier view worker bean¿¡°Ô Àü´Þ
¢º ejb controller
	-> web controller ·ÎºÎÅÍ event¸¦ ¹Þ¾ÆµéÀÓ
	-> EB¿¡°Ô eventÀü´Þ : º¯°æ½ÃÅ´
	-> user session À» À¯Áö
	-> web controller¿¡°Ô updated modelÀÇ event¸¦ return
	-> ƯÁ¤ client type¿¡ µ¶¸³ÀûÀÓ
	-> web client, application client ¸ðµÎ¿¡°Ô Àû¿ë °¡´É

4. Application Migration
- web-centric application -> EB
-> web portion ÀÇ º¯°æ
	-> front component + mvc architecture
-> EBÀÇ »ý¼º : model object ÀÇ Ç¥Çö
-> application logic À» EB³»¿¡ Æ÷ÇÔ½ÃÅ´
-> external resource communication À» worker bean¿¡¼­ EB·Î À̵¿
-> jsp ³»ÀÇ display logic code ÀÇ ÃÖ¼ÒÈ­

2001-04-08
 
1
References
 
http://java.sun.com/blueprints
Copyright ¨Ï 2003 www.javapattern.info & www.jlook.com, an jLOOK co.,LTD