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


Java WebMail System Implementation(2)
 
¾Æ½Ã´Â ºÐÀº ¾Ë°ÚÁö¸¸ 2001³â¿¡ ¸ð¸ð »çÀÌÆ®¿¡ µ·(¹«·Á 900¿ø)¹Þ°í ¿Ã¶ó°£ ³»¿ëÀε¥ ¿äû¿¡ ÀÇÇÏ¿© ÀÚ¹ÙÆÐÅÏ»çÀÌÆ®¿¡ ´Ù½Ã °ø°³ÇÕ´Ï´Ù. ( 2003/04/25 ) 715
Written by ienvyou - ÃÖÁö¿õ
1 of 4
 


Major JavaMail API Components



*Message Class

Message Ŭ·¡½º´Â mail messageÀÇ ³»¿ë°ú attributeÀÇ ÁýÇÕÀ¸·Î Á¤ÀÇµÈ abstract classÀÌ´Ù.

Message Class

ÀÌ Å¬·¡½ºÀÇ attribute·Î´Â content typeÀ» Æ÷ÇÔÇÏ´Â content¸¦ Á¤ÀÇÇÏ°í ¸ÞÀÏÁÖ¼Ò¿¡ °ü·ÃµÈ 

Á¤º¸¸¦ ¸í½ÃÇÏ°í ÀÖ´Ù.

content´Â ½ÇÁ¦µ¥ÀÌÅ͸¦ °¨½Î°í ÀÖ´Â DataHandler object¿¡ ÀÇÇØ Ç¥ÇöµÇ¾îÁö¸ç, 

ÀÌ Message class´Â Super classÀÎ Part interface¸¦ ±¸ÇöÇÏ°í ÀÖ´Ù. 

ÀÌ Part ÀÎÅÍÆäÀ̽º´Â Message object¸¦ Àü´ÞÇϱâ À§ÇÑ ÇüÅÂ¿Í ¼Ó¼ºµéÀÌ Á¤ÀǵǾîÁ® Àִ Ŭ·¡½ºÀ̸ç, 

MessageŬ·¡½º¿¡´Â From, To, Subject, Reply-To¿Í ´Ù¸¥ ¼Ó¼ºµéÀ» Ãß°¡ÇÒ¼ö ÀÖ´Ù
 
 MessageÀÇ ³»¿ëÀº byteÀÇ ÁýÇÕ ¶Ç´Â byteÁýÇÕÀ» ÂüÁ¶ÇÏ´Â Message object¾È¿¡¼­ Ãß»óÈ­µÇ´Âµ¥ 
 
 »ç½Ç JavaMailÀº message ³»¿ë¿¡ ´ëÇÑ ¾î¶² Çüųª Á¤º¸µµ °¡Áö°í ÀÖÁö ¾Ê±â ¶§¹®¿¡ Message object¸¦ 
 
 »ç¿ëÇÏ¿©  Áß°£°èÃþ(intermediate layer- Áï JavaBeans Activation Framework(JAF))°ú Åë½ÅÀ» ÇÏ°Ô µÈ´Ù.

¶ÇÇÑ JavaMail API¿¡¼­´Â multipart Message °´Ã¼µéÀ» Áö¿øÇϱâ À§ÇØ¿© ÀڽŸ¸ÀÇ attribute¿Í content¸¦ 

Á¤ÀÇÇÒ¼ö ÀÖ´Â BodyPartŬ·¡½º¸¦ Áö¿øÇÏ°í ÀÖ´Ù.


¸Þ½ÃÁöÀÇ ÀúÀå°ú °Ë»ö

ÀϹÝÀûÀ¸·Î ¸Þ½ÃÁö´Â Folder°´Ã¼ ¾È¿¡ ÀúÀåµÇ°Ô µÈ´Ù. Folder°´Ã¼´Â ¸Þ½ÃÁö »Ó¸¸ ¾Æ´Ï¶ó Æ®¸®±¸Á¶¿Í 
  
°°Àº subfolderµéÀ» Æ÷ÇÔÇÏ°í ÀÖ´Ù.

Folder Ŭ·¡½º´Â ¸Þ½ÃÁö¸¦ fetch(°¡Á®¿À±â), append(Ãß°¡Çϱâ), copy(º¹»çÇϱâ), delete(»èÁ¦Çϱâ)¸¦ 
  
ÇÒ¼ö ÀÖ´Â ¸Þ¼Òµå¸¦ Á¦°øÇϸç ÄÄÆ÷³ÍÆ®·Î event¸¦ º¸³¾¼öµµ ÀÖÀ¸¸ç,  
  
event listener¸¦ µî·Ï½Ãų¼öµµ Àִ Ư¼ºÀ» °¡Áö°í ÀÖ´Ù.

StoreŬ·¡½º´Â folder¾È¿¡ ÀúÀåµÇ¾îÀÖ´Â ¸Þ½ÃÁöµéÀ» °Ë»öÇÏ°í folder¸¦ accessÇÒ¼ö ÀÖ´Â

access protocolÀ» ¸í½ÃÇÏ°í ÀÖ´Ù. 

ÀÌ Å¬·¡½º´Â ¶ÇÇÑ µ¥ÀÌÅͺ£À̽º (¸ÞÀÏÀúÀå¼Ò)¿Í ¿¬°áÇÏ°í, ¸Þ½ÃÁö¸¦ fetchÇϸç, 
  
¿¬°á(connection)À» ²÷À» ¼ö ÀÖ´Â ¸Þ¼ÒµåµéÀ» Á¦°øÇÏ°í ÀÖ´Ù.

Mail Service ProviderµéÀº ÀÌ StoreŬ·¡½º¸¦ subclassingÇÔÀ¸·Î¼­ ¸Þ½ÃÁö¸¦ Àо¼ö ÀÖ´Â 

ÇÁ·ÎÅäÄÝ(IMAP4, POP3µîµî)µéÀ» ±¸ÇöÇÒ¼ö ÀÖ°Ô ¸¸µé°í ÀÖ´Ù.


*¸Þ½ÃÁöÀÇ Á¶ÇÕ°ú Àü´Þ

Ŭ¶óÀ̾ðÆ®´Â Message¸¦ ÀûÀýÇÏ°Ô subclassingÇÑÈÄ °´Ã¼È­¿¡ ÀÇÇÏ¿© »õ·Î¿î ¸Þ½ÃÁö¸¦ »ý¼ºÇϵµ·Ï ÇÑ´Ù. 

±× Ŭ·¡½º·Î ÇÏ¿©±Ý Message°´Ã¼·Î ¼ö½ÅÀÎÁÖ¼Ò, Á¦¸ñ, ³»¿ë µîÀÇ ¼Ó¼º°ªµéÀ» ¼¼ÆýÃÅ°µµ·Ï ÇÑ´ÙÀ½ 

Transport.send()¸Þ¼Òµå¸¦ È£ÃâÇÔÀ¸·Î¼­ Á¶ÇÕµÈ ¸Þ½ÃÁöÀÇ ³»¿ëÀ» ¼ö½ÅÀο¡°Ô Àü´ÞÇϵµ·Ï ÇÑ´Ù.

Transport Ŭ·¡½º´Â ¸ñÀûÁö ÁÖ¼Ò·Î ¸Þ½ÃÁö¸¦ Àü´ÞÇϱâ À§ÇÑ 

transport agent(Àü´ÞÀ» À§ÀÓÇÑ)·Î¼­ ¸¸µé¾îÁø´Ù.

ÀÌ Å¬·¡½º´Â ¿©·¯¸íÀÇ ¼ö½ÅÀο¡°Ô ¸Þ½ÃÁö¸¦ º¸³»±â À§ÇÑ ¸Þ¼Òµå¸¦ Á¦°øÇÏ°í Àִµ¥,

TransportŬ·¡½ºÀÇ send¸Þ¼Òµå°¡ ±× ¿ªÇÒÀ» ÇÑ´Ù.


* Session Ŭ·¡½º

SessionŬ·¡½º´Â network°ú ¸ÞÀÏÀ» »ç¿ëÇÒ¼ö Àִ Ŭ¶óÀ̾ðÆ®»çÀÌÀÇ ÀÎÅÍÆäÀ̽º¸¦ Àü¿ªÀûÀÌ¸ç »ç¿ëÀÚ 

°¢°¢¿¡ ¸Â°Ô Ư¼º(property)À» Á¤ÀÇÇÑ Å¬·¡½ºÀÌ´Ù.

ÀÌ Session°´Ã¼´Â JavaMail ÄÄÆ÷³ÍÆ®¿¡¼­´Â ¾ø¾î¼­´Â ¾ÈµÇ¸ç, ¾î¶² Ư¼öÇÑ ¼Ó¼º°ªµéÀ» ¼¼ÆýÃÅ°°Å³ª

¾ò¾î¿À±â À§ÇØ¿© ÀÌ Session°´Ã¼¸¦ »ç¿ëÇÑ´Ù.

SessionŬ·¡½º´Â ¶ÇÇÑ ¼¼¼Ç°´Ã¼(»ç¿ëÀÚ)¸¦ ÀÎÁõÇѴٰųª desktop applicationÀ» °øÀ¯ÇÒ¼ö ÀÖ°Ô ÇÒ¼öµµ ÀÖ´Ù. 

±×¸®°í ÀÌ Å¬·¡½º´Â final concreteŬ·¡½º·Î¼­ subclass½Ãų¼ö ¾ø´Ù´Â Ư¼ºÀ» °¡Áö°í ÀÖ´Ù.


*JavaMail Event Model

JavaMail event¸ðµ¨Àº JavaBeans ½ºÆå¿¡ Á¤ÀÇµÈ JDK1.1 event¸ðµ¨ ½ºÆåÀ» µû¸£°í ÀÖ´Ù.

(¿Ö³Ä¸é ¾Õ¼­ ¾ð±ÞÇß´øºÁ¾ß °°ÀÌ JDK1.1.X¹öÀüÀÌÈÄ »ç¿ë°¡´ÉÇϱ⠶§¹®ÀÌ´Ù)

JavaBean ½ºÆå¿¡¼­´Â naming event, event methods, event listenerµî·Ï¿¡ ´ëÇÑ 

desing patternÀ» Á¤ÀÇÇÏ°í ÀÖ´Ù.

¸ðµç JavaMail event´Â MailEvent·ÎºÎÅÍ »ó¼ÓÀ» ¹Þ°í ÀÖ´Ù. Ŭ¶óÀ̾ðÆ®´Â ÀÚ½ÅÀ» À§ÇÏ¿© event¸¦ À§ÇÑ

listener¸¦ µî·Ï½ÃÅ´À¸·Î¼­ event¸¦ ±â´Ù¸±¼ö ÀÖ´Ù.

Event´Â ¼¼¼ÇÀÌ ÁøÇàµÇ¸é¼­ º¯ÇÏ´Â »óŸ¦ listenerÃøÀ¸·Î ¾Ë¸®µµ·Ï ÇÏ°í ÀÖ´Ù.

JavaMail¿¡¼­´Â Store, Folder ±×¸®°í TransportŬ·¡½ºµéÀÌ ±×·¯ÇÑ event ¼Ò½ºµéÀÌ´Ù.

 
1 2 3 4
References
 
Copyright ¨Ï 2003 www.javapattern.info & www.jlook.com, an jLOOK co.,LTD