Enterprise JavaBeans 1.0
Written by ½Å¼ºÈ£
ºñÆ®±³À°¼¾ÅÍ(SE)
skid1206@hitel.net
1. Enterprise JavaBeans ¶õ ¹«¾ùÀΰ¡?
1.1 ÄÄÆ÷³ÍÆ®·Î½áÀÇ Enterprise Beans
Enterprise
JavaBeans (EJB)´Â ºÐ»êȯ°æÇÏÀÇ ÄÄÆ÷³ÍÆ® ¾ÆÅ°ÅØÃ³ ÀÌ´Ù.
´ëÇ¥ÀûÀÎ ºÐ»êȯ°æÀ¸·Î´Â
Corba ¸¦ µé¼ö ÀÖÀ¸¸ç Corba ´Â ORB ¸¦ ÅëÇØ
ºÐ»êȯ°æÇÏÀÇ
°´Ã¼È£Ãâ¸ÞÄ¿´ÏÁò, Æ®·£Àè¼Çó¸® µî ¿©·¯°¡Áö ¼ºñ½º¸¦
Á¦°øÇϰí ÀÖÁö¸¸
ºÐ»êÀÛ¾÷ÀÇ ±âº» ´ÜÀ§°¡ µÇ´Â ÄÄÆ÷³ÍÆ® ¸ðµ¨Àº Á¦°øÇÏÁö
¸øÇϰí ÀÖ´Ù.
µû¶ó¼ Corba3.0
¿¡¼´Â EJB °¡ Corba ÀÇ Ç¥ÁØ ÄÄÆ÷³ÍÆ® ¸ðµ¨ÀÌ µÉ°ÍÀÌ´Ù.
1.1.1 EnterPrise Beans ÀÇ Æ¯Â¡
- enterprise Bean's instances µéÀº Container ¿¡ ÀÇÇØ RunTime ¿¡ »ý¼ºµÇ°í
°ü¸®µÈ´Ù.
- enterprise Bean ´Â environment properties¸¦ ¼öÁ¤ÇÔÀ¸·Î½á
deployment time ¿¡ ÃÖÀûÈ µÉ¼ö ÀÖ´Ù.
- Æ®·£Àè¼Ç¸ðµå, º¸¾È¼Ó¼ºµî ´Ù¾çÇÑ Metadata ´Â EnterPrise Beans Ŭ·¡½º
·ÎºÎÅÍ ¿ÜºÎ¿¡ ºÐ¸®Çؼ À§Ä¡ÇÒ¼ö ÀÖ´Ù.
À̰ÍÀº design and deployment time ¿¡ Container Tools ¸¦ ÀÌ¿ëÇØ
´Ù·ç¾î Áú¼ö ÀÖÀ½À» ÀǹÌÇÑ´Ù.
- Client Access ´Â Container(WebLogicÀÇ Thenah ¼¹ö µî) ȤÀº
EJB Server(OS, DBMS µî)¿¡ ÀÇÇØ Á¶Á¤µÉ¼ö ÀÖ´Ù.
- enterprise Bean ÀÌ EJB specification ¿¡ Á¤ÀÇµÈ standard container services
¸¸ »ç¿ëÇÑ´Ù¸é ¾î¶² Container ¿¡¼µµ ÀçÄÄÆÄÀÏ ¾øÀÌ »ç¿ë°¡´ÉÇÏ´Ù.
- enterprise Bean ´Â ÀçÄÄÆÄÀÏÀ̳ª ¼Ò½ºÄÚµå º¯°æ¾øÀÌ ¾ÖÇø®ÄÉÀ̼DZ¸¼º¿¡
Æ÷ÇԵɼö ÀÖ´Ù.
1.2 Enterprise JavaBeans contracts
1.2.1 Client's view contract
ÀÌÀåÀº Ŭ¶óÀÌ¾ðÆ®¿Í ÄÁÅ×ÀÌ³Ê »çÀÌÀÇ °è¾àÀ» ±â¼úÇÑ´Ù.
enterprise Bean provider ¿Í Container provider ´Â ´ÙÀ½°ú °°Àº °è¾àÀ»
ÀÌÇàÇÒ Ã¥ÀÓÀ» °¡Áø´Ù.
- Object identity
- Method invocation
- Home Interface
Ŭ¶óÀÌ¾ðÆ®´Â enterprise Bean object °¡ À¯ÀÏÇÑ ½Äº°ÀÚ¸¦ °¡Áú°ÍÀ» ±â´ëÇϸç
ÄÁÅ×À̳ʴ °¢°¢ÀÇ session EJB object ¿¡ ´ëÇÏ¿© À̰ÍÀ» Á¦°øÇØ¾ß ÇÑ´Ù.
(entity enterprise Beans ¿¡ ´ëÇØ¼´Â 1.3.2ÀýÀ» ÂüÁ¶)
ºó Á¦°øÀÚ´Â ÄÁÅ×À̳ʰ¡ EJB object's identifier ¼Ó¿¡ Æ÷ÇÔÇÒ¼ö ÀÖ´Â À¯ÀÏÇÑ
primary key ¸¦ Á¦°ø(EJB object »ý¼º½Ã°£µ¿¾È)ÇÑ´Ù.
±×·±´ÙÀ½ object activation and/or load time ¿¡ EJB ÀÇ primary key
¸¦ »ç¿ëÇÑ´Ù.
Ŭ¶óÀÌ¾ðÆ®´Â Java Naming and Directory Interface (JNDI) ¸¦ ÀÌ¿ëÇÏ¿©
EJB Home interface ¸¦ ãÀ»¼ö ÀÖ´Ù.
Primary key´Â Home interface ³»¿¡¼ °¢°¢ÀÇ EJB °´Ã¼¸¦ ½Äº°Çϱâ À§ÇØ
»ç¿ëÇÑ´Ù.
ºó Á¦°øÀڴ Ŭ¶óÀÌ¾ðÆ®¿¡¼ È£ÃâÇÒ¼ö ÀÖ´Â Business method¸¦ Á¤ÀÇÇÏ´Â
remote interface ¸¦ Á¤ÀÇÇÑ´Ù.
Ŭ¶óÀÌ¾ðÆ®°¡ enterprise Bean À» È£ÃâÇϸé ÄÁÅ×À̳ʴ remote interface ¸¦
ÅëÇØ È£ÃâÀ» ¹Þ¾ÆµéÀÌ°í ½ÇÁ¦ ºñÁî´Ï½º ¸Þ¼ÒµåÀÇ ½ÇÇàÀº enterprise Bean class
¿¡ À§ÀÓÇÑ´Ù.
¶ÇÇÑ ºó Á¦°øÀÚ´Â javax.ejb.EJBHome À» »ó¼ÓÇÏ´Â enterprise Bean's
home interface ¸¦ Á¦°øÇÑ´Ù.
home interface ´Â 0°³ ÀÌ»óÀÇ create() ¸Þ¼Òµå¸¦ Á¦°øÇÔÀ¸·Î½á ´Ù¾çÇÑ ¹æ¹ýÀ¸·Î
EJB °´Ã¼¸¦ »ý¼ºÇÑ´Ù.
entity Beans ÀÇ È¨ ÀÎÅÍÆäÀ̽º´Â 0°³ÀÌ»óÀÇ find...()¸Þ¼Òµå ¶ÇÇÑ Á¦°øÇÔÀ¸·Î½á
¿©·¯¹æ¹ýÀ¸·Î DB µî¿¡ ÀúÀåµÇ¾î ÀÖ´Â EJB °´Ã¼¸¦ ãÀ»¼ö ÀÖ´Ù.
ºóÁ¦°øÀÚ°¡ Ȩ ÀÎÅÍÆäÀ̳»¿¡ Á¤ÀÇÇÑ create() ¸Þ¼Òµå´Â enterprise Bean class
³»¿¡ °°Àº ½Ã±×³×ó¸¦ °¡Áö´Â ejbCreate() ·Î ´ëÀÀµÇ¸ç ÄÁÅ×À̳ʴ Ŭ¶óÀÌ¾ðÆ®¿¡¼ÀÇ
create() È£ÃâÀ» enterprise Bean class ³»ÀÇ ejbCreate() È£Ãâ·Î À§ÀÓÇÑ´Ù.
¿£Æ¼Æ¼ ºóÀÇ find..() ¸Þ¼ÒµåÀÇ °æ¿ìµµ ¸¶Âù°¡ÁöÀÌ´Ù.
1.2.2 Component contract
À̹øÀåÀº enterprise Bean °ú ÄÁÅ×ÀÌ³Ê »çÀÌÀÇ °è¾àÀÌ´Ù.
- ¼¼¼ÇºóÀº javax.ejb.SessionBean, javax.ejb.SessionSynchronization
interfaces
¿£Æ¼Æ¼ºóÀº javax.ejb.EntityBean interface ¿¡ ÀÇÇØ Á¤ÀÇµÈ »óŰü¸® callback
À»
Æ÷ÇÔÇϰí ÄÁÅ×À̳ʴ °´Ã¼ÀÇ »ý¸íÁÖ±â»ó¿¡¼ Áß¿äÇÑ À̺¥Æ®°¡ ¹ß»ýÇßÀ»¶§
À̸¦ ¾Ë¸®±â À§ÇØ À̵é ÀÎÅÍÆäÀ̽º¿¡ ÀÇÇØ Á¤ÀÇµÈ Äݹé¸Þ¼Òµå¸¦ È£ÃâÇÑ´Ù.
- ÄÁÅ×À̳ʴ ¼¼¼ÇºóÀÇ ÀνºÅϽº¸¦ »ý¼ºÇÒ¶§ javax.ejb.SessionContext interface
¸¦ Àü´ÞÇϸç SessionContext ´Â ÄÁÅ×À̳ʷκÎÅÍ ´Ù¾çÇÑ Á¤º¸¿Í ¼ºñ½º¸¦ ¾ò±â
À§ÇØ
»ç¿ëµÈ´Ù.
¿£Æ¼Æ¼ ºóÀº javax.ejb.EntityContext ¸¦ ÀÌ¿ëÇÑ´Ù.
1.2.3 Ejb-jar file
ejb-jar ÆÄÀÏÀº enterprise Beans ¸¦ ÆäŰ¡ ÇϱâÀ§ÇÑ Ç¥ÁØÆ÷¸äÀÌ¸ç ´ÙÀ½À» Æ÷ÇÔÇÑ´Ù.
- JAR file manifest entries that describe the contents of the ejb-jar file.
- Java class files for the enterprise Beans.
- Enterprise Bean deployment descriptors
(enterprise Bean °ú °ü·ÃµÈ ¼Ó¼ºµéÀ» ÁöÁ¤ÇÑ ÆÄÀÏ)
- Enterprise Bean environment properties that the enterprise Bean requires
at
runtime.
<Enterprise JavaBeans contracts>
1.3 Session and entity objects
Enterprise JavaBeans 1.0¿¡¼´Â µÎ°¡Áö ŸÀÔÀÇ enterprise Beans À» Á¤ÀÇÇÑ´Ù.
- A session object type.
- An entity object type.
session °´Ã¼´Â
1.0¿¡¼ ÄÁÅ×À̳ʰ¡ ±âº»ÀûÀ¸·Î Á¦°øÇؾßÇÏÁö¸¸, entity °´Ã¼´Â
¼±ÅÃÀûÀ̸ç
2.0 ¿¡¼´Â Çʼö±â´ÉÀ¸·Î Ãß°¡µÉ°ÍÀÌ´Ù.
1.3.1 Session objects
- Executes on behalf of a single client.
- Can be transaction-aware.
- Updates shared data in an underlying database.
- Does not represent directly shared data in the database, although it
may
access and update such data.
- Is relatively short-lived.
- Is removed when the EJB server crashes. The client has to re-establish
a new
session object to continue computation.
1.3.2 Entity objects
- Represents data in the database.
- Is transactional.
- Allows shared access from multiple users.
- Can be long-lived (lives as long as the data in the database).
- Survives crashes of the EJB server. A crash is transparent to the client.
1.4 Standard CORBA mapping
<Standard CORBA mapping>