¸Þ¼Òµå ±¸Çö

Data Handler¸¦ °³¹ßÇϱâ À§ÇØ, DataHandler Ŭ·¡½ºÀÇ ´ÙÀ½ ¸Þ¼Òµå¸¦ ±¸ÇöÇÕ´Ï´Ù.

Custom Data HandlerÀÇ ¸Þ¼Òµå´Â Data Handler ±âº» Ŭ·¡½º È®Àå¿¡¼­ ÀÛ¼ºÇÑ DataHandler Ŭ·¡½ºÀÇ Java ¼Ò½º ÆÄÀÏ·Î ÁøÇàÇÕ´Ï´Ù.

ÁÖ:
È£ÃâÀÚ°¡ ´ÙÁß ½º·¹µå¸¦ °ÅÃÄ DataHandler Ŭ·¡½ºÀÇ Ä³½ÃµÈ ÀνºÅϽº¸¦ ´Ù½Ã »ç¿ëÇÒ °æ¿ì, Ŭ·¡½º¸¦ ½º·¹µå ¾ÈÀü »óÅ·Π¸¸µé¾î¾ß ÇÕ´Ï´Ù. À̸¦ ¹Ýµå½Ã ¼öÇàÇØ¾ß ÇÏ´ÂÁö ¿©ºÎ¸¦ ÆÇº°ÇÏ·Á¸é, Connector Development Guide for Java¿¡¼­ ½º·¹µå ¸ðµ¨¿¡ ´ëÇÑ ¼¼ºÎ»çÇ×À» ÂüÁ¶ÇϽʽÿÀ.

Ãß»ó ¸Þ¼Òµå ±¸Çö

data-handler ±âº» Ŭ·¡½ºÀÎ DataHandler´Â Custom Data HandlerÀÇ DataHandler Ŭ·¡½º¿¡ ¹Ýµå½Ã ±¸ÇöÇØ¾ß Çϴ ǥ 75ÀÇ Ãß»ó ¸Þ¼Òµå¸¦ Á¦°øÇÕ´Ï´Ù.


Ç¥ 75. DataHandler Ŭ·¡½ºÀÇ Ãß»ó ¸Þ¼Òµå
µ¥ÀÌÅÍ º¯È¯ Á÷·ÄÈ­µÈ µ¥ÀÌÅÍÀÇ Çü½Ä DataHandler ¸Þ¼Òµå
¹®ÀÚ¿­¿¡¼­ Business Object·Î º¯È¯ Reader ¿ÀºêÁ§Æ®¸¦ ÅëÇØ ¾×¼¼½ºµÇ´Â Á÷·ÄÈ­µÈ µ¥ÀÌÅ͸¦ Business Object·Î º¯È¯ÇÕ´Ï´Ù. getBO() - Ãß»ó
Business Object¿¡¼­ ¹®ÀÚ¿­·Î º¯È¯ Business Object¸¦ InputStream ¿ÀºêÁ§Æ®·Î º¯È¯ÇÕ´Ï´Ù. getStreamFromBO()

Business Object¸¦ String ¿ÀºêÁ§Æ®·Î º¯È¯ÇÕ´Ï´Ù. getStringFromBO()

Business Object¸¦ ¹ÙÀÌÆ® ¹è¿­·Î º¯È¯ÇÕ´Ï´Ù. getByteArrayFromBO()

ÁÖ:
DataHandler Ŭ·¡½º¸¦ »ç¿ëÀÚ Data Handler·Î È®ÀåÇÏ´Â StubDataHandler.java ÆÄÀÏÀÇ »çº»¿¡´Â ±¸ÇöÇØ¾ß ÇÏ´Â Ãß»ó ¸Þ¼Òµå¿¡ ´ëÇÑ ¼±¾ðÀÌ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù.

´ÙÀ½ ¼½¼Ç¿¡¼­´Â Ãß»ó DataHandler ¸Þ¼Òµå °¢°¢¿¡ ´ëÇÑ ±¸Çö Á¤º¸¸¦ Á¦°øÇÕ´Ï´Ù.

Business Object·Î º¯È¯ ±¸Çö

Ãß»ó getBO() ¸Þ¼Òµå´Â ¹®ÀÚ¿­¿¡¼­ Business Object·ÎÀÇ º¯È¯À» ¼öÇàÇÕ´Ï´Ù. Áï, Business Object¸¦ Java Reader ¿ÀºêÁ§Æ®¿¡¼­ ÃßÃâÇÑ µ¥ÀÌÅͷΠä¿ó´Ï´Ù.

getBO() ¸Þ¼Òµå ¹öÀüÀº µÎ °¡ÁöÀÔ´Ï´Ù.

ÁÖ:
Ä¿³ØÅÍÀÇ ¹®¸Æ¿¡¼­ È£ÃâÇÏ´Â °æ¿ì, Data Handler¸¦ Áö¿øÇÏ·Á¸é, data-handler Ŭ·¡½º(DataHandler È®Àå)°¡ getBO() ¸Þ¼ÒµåÀÇ µÎ ¹öÀüÀ» ±¸ÇöÇØ¾ß ÇÕ´Ï´Ù. ¾×¼¼½º Ŭ¶óÀÌ¾ðÆ®¿¡¼­ È£ÃâÇÏ´Â °æ¿ì¿¡¸¸ Data Handler¸¦ Áö¿øÇÏ·Á¸é(IBM WebSphere InterChange Server ÅëÇÕ ºê·ÎÄ¿¿¡¸¸ ÇØ´ç), ¸Þ¼ÒµåÀÇ µÎ ¹øÂ° ¾ç½Ä¸¸ ±¸ÇöÇØ¾ß ÇÕ´Ï´Ù. getBO() ¼­¹ö ¾×¼¼½º ÀÎÅÍÆäÀ̽º´Â ÀÌ µÎ ¹øÂ° ¾ç½ÄÀÇ getBO()¸¸ »ç¿ëÇÕ´Ï´Ù.

getBO() ¸Þ¼Òµå´Â È£ÃâÀÚ°¡ ±¸¼º Á¤º¸(config ¸Å°³º¯¼ö)¸¦ Æ÷ÇÔÇÏ´Â ¼±ÅÃÀû ¿ÀºêÁ§Æ®¸¦ Àü´ÞÇÕ´Ï´Ù. ÀÌ Á¤º¸´Â Data Handler Meta Object¿¡¼­ ÁöÁ¤µÈ Á¤º¸ ¿Ü¿¡ Ãß°¡µÇ´Â Á¤º¸ÀÔ´Ï´Ù. ¿¹¸¦ µé¾î, ±¸¼º ¿ÀºêÁ§Æ®´Â ÅÛÇø®Æ® ÆÄÀÏÀ̳ª, Data Handler°¡ »ç¿ëÇÏ´Â URLÀ» Áö½ÃÇÒ ¼ö ÀÖ½À´Ï´Ù.

ÁÖ:
Business Object·Î º¯È¯ÇÒ ¶§, getBO()´Â »óÀ§ Business ObjectÀÇ ÀÀ¿ëÇÁ·Î±×·¥ ƯÁ¤ Á¤º¸¿¡¼­ cw_mo_label ű׷Π½Äº°µÈ ¼Ó¼ºÀÌ °ªÀ» ¾òÁö ¸øÇϵµ·Ï ÇØ¾ß ÇÕ´Ï´Ù.

cw_mo_label ű׿¡ ´ëÇÑ ÀÚ¼¼ÇÑ Á¤º¸´Â "Business Object¿¡¼­ º¯È¯ ±¸Çö"À» ÂüÁ¶ÇϽʽÿÀ.

Ãß»ó getBO() ¸Þ¼ÒµåÀÇ ¸ñÀûÀº Reader ¿ÀºêÁ§Æ®¿¡ µé¾î ÀÖ´Â Á÷·ÄÈ­µÈ µ¥ÀÌÅÍ·Î Business Object¸¦ ä¿ì´Â °ÍÀÔ´Ï´Ù. ±×·¯¸é getBO()ÀÇ °ø¿ë ¹öÀüÀÌ Áö¿øµÇ´Â ¿©·¯ ¾ç½Ä Áß Çϳª·Î Á÷·ÄÈ­µÈ µ¥ÀÌÅ͸¦ ¼ö½ÅÇÏ°í µ¥ÀÌÅ͸¦ Reader ¿ÀºêÁ§Æ®·Î º¯È¯ÇÑ ÈÄ, Ãß»ó getBO() ¸Þ¼Òµå¸¦ È£ÃâÇÏ¿©, ½ÇÁ¦ ¹®ÀÚ¿­¿¡¼­ Business Object·ÎÀÇ º¯È¯À» ¼öÇàÇÒ ¼ö ÀÖ½À´Ï´Ù. °ø¿ë getBO() ¸Þ¼Òµå¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ Á¤º¸´Â getBO() - °ø¿ëÀ» ÂüÁ¶ÇϽʽÿÀ.

±×¸² 41¿¡¼­´Â µÎ ¹øÂ° ¾ç½ÄÀÇ getBO() ¸Þ¼Òµå¿¡ ´ëÇÑ ±âº» ±¸ÇöÀ» º¸¿©ÁÝ´Ï´Ù. ¿¹¿¡¼­´Â °íÁ¤ Æø µ¥ÀÌÅ͸¦ Æ÷ÇÔÇÏ´Â Reader ¿ÀºêÁ§Æ®ÀÇ µ¥ÀÌÅͰ¡ Business Object·Î º¯È¯ÇÒ ¶§ »ç¿ëµÇ´Â ´Ü°è¸¦ º¸¿©ÁÝ´Ï´Ù.

  1. getBO() ¸Þ¼Òµå´Â Reader ¿ÀºêÁ§Æ®ÀÇ µ¥ÀÌÅ͸¦ String ¿ÀºêÁ§Æ®·Î º¯È¯ÇÕ´Ï´Ù. ±×·± ´ÙÀ½, »ç¿ëÀÚ Á¤ÀÇ getBOFromString() ¸Þ¼Òµå¸¦ È£ÃâÇÏ¿© Business Object ÀνºÅϽº¸¦ ÀÛ¼ºÇÕ´Ï´Ù.
  2. getBOFromString() ¸Þ¼Òµå´Â StringÀÇ Ã¹ ¹øÂ° °íÁ¤ Æø ÅäÅ«À» ±âÃÊ·Î ÀÛ¼ºÇÒ Business Object À¯ÇüÀ» ÆÇº°ÇÑ ÈÄ ÇØ´ç À¯ÇüÀÇ Business Object ÀνºÅϽº¸¦ ÀÛ¼ºÇÕ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â StringÀÇ µÎ ¹øÂ° °íÁ¤ Æø ÅäÅ«¿¡¼­ verb¸¦ È®º¸Çϰí Business Object¿¡¼­ verb¸¦ ¼³Á¤ÇÕ´Ï´Ù. ±×·± ´ÙÀ½, »ç¿ëÀÚ Á¤ÀÇ parseAttributeList() ¸Þ¼Òµå¸¦ È£ÃâÇÏ¿© StringÀÇ ³ª¸ÓÁö¸¦ ±¸¹® ºÐ¼®Çϰí Business Object¸¦ °ªÀ¸·Î ä¿ó´Ï´Ù.
  3. parseAttributeList() ¸Þ¼Òµå´Â StringÀ» ±¸¹® ºÐ¼®ÇÏ°í ¼øÈ¯ ¹æ½ÄÀ¸·Î Business Object¸¦ ä¿ó´Ï´Ù. ¸Þ¼Òµå°¡ ¿ÀºêÁ§Æ® À¯ÇüÀÇ ¼Ó¼ºÀ» ãÀ¸¸é, ¸Þ¼Òµå´Â ¿ÀºêÁ§Æ®ÀÇ ´ÜÀÏ ¶Ç´Â ´ÙÁß Ä«µð³¾¸®Æ¼ ¿©ºÎ¸¦ ÆÇº°ÇÕ´Ï´Ù. ¸Þ¼Òµå´Â getMultipleCard()¸¦ È£ÃâÇÏ¿© ¹è¿­¿¡ ÀÖ´Â Business Object¸¦ ¹Ýº¹ÀûÀ¸·Î ó¸®Çϰí getSingleCard()¸¦ È£ÃâÇÏ¿© ´ÜÀÏ Ä«µð³¾¸®Æ¼ ÇÏÀ§ Business Object¸¦ ó¸®ÇÕ´Ï´Ù.

ÆÁ:
Data Handler´Â Business Object¿¡¼­ µ¥ÀÌÅ͸¦ ÃßÃâÇϰí Ä¿³ØÅÍ¿Í µ¿ÀÏÇÑ ¹æ½ÄÀ¸·Î Business Object¸¦ µ¥ÀÌÅͷΠä¿ó´Ï´Ù. ¿¹¸¦ µé¾î, ´ÙÀ½ ÄÚµå »ùÇÿ¡¼­

getBOFromString() ¸Þ¼Òµå´Â JavaConnectorUtil.createBusinessObject()¸¦ È£ÃâÇÏ¿© Business Object ÀνºÅϽº¸¦ ÀÛ¼ºÇϰí BusinessObjectInterface.setVerb()¸¦ È£ÃâÇÏ¿© verb¸¦ ¼³Á¤ÇÕ´Ï´Ù. Business Object ó¸® ¹æ¹ý¿¡ ´ëÇÑ Á¤º¸´Â Connector Development Guide for Java¸¦ ÂüÁ¶ÇϽʽÿÀ.

±×¸² 41. getBO() ¸Þ¼Òµå ¿¹

public BusinessObjectInterface getBO(Reader serializedData,
           Object config)
           throws Exception
 {
           clear(config);
           BusinessObjectInterface resultObj = null;
  
           // Create a String object from the Reader, then use the string
           // method
           int conversionCheck;
     char[] temp = new char[2000];
           StringBuffer tempStringBuffer = new StringBuffer(1000);
  
           while ( (conversionCheck = serializedData.read(temp)) != -1 )
             tempStringBuffer.append(new String (temp, 0, conversionCheck));
  
           mBOString = new String(tempStringBuffer);
           mBOStringLength = mBOString.length();
  
           resultObj = getBOFromString(null);
           return resultObj;
 }
  
  
 // Gets Business Object name and verb and creates a bus obj instance
 private BusinessObjectInterface getBOFromString(String pvBOType)
           throws Exception
 {
           BusinessObjectInterface returnObj = null; 
           String lvBOName = null;
           String lvVerb = null;
  
           lvBOName = this.getNextToken(mBONameSize, true);
           lvVerb = this.getNextToken(mBOVerbSize, true);
  
           if( (pvBOType != null) && (lvBOName.compareTo(pvBOType) != 0) ) {
             throw new Exception(...);
     }
                 else
     {
             returnObj = JavaConnectorUtil.createBusinessObject(lvBOName);
     }
  
           returnObj.setVerb(lvVerb);
  
           parseAttributeList(returnObj);
  
           return returnObj;
 }
 
// Parse String to populate the attributes in the Business Object
 protected void parseAttributeList(BusinessObjectInterface pvBO)
           throws Exception
 {
           if ( mEndOfBOString )
             throw new Exception(...);
           else if( pvBO == null )
             throw new Exception(...);
  
           int lvAttrNum = pvBO.getAttrCount();
             
           String lvAttrName = null;
           String lvAttrValue = null;
           int lvAttrMaxLength = 0;
  
     try {
             for (int lvAttrIndex = 0; lvAttrIndex < lvAttrNum;
                 lvAttrIndex++)
         {
               CxObjectAttr lvAttrSpec = pvBO.getAttrDesc(lvAttrIndex);
               lvAttrName = lvAttrSpec.getName();
  
             // Determine if the attribute is a simple attribute or a
             // Business Object container.
               if (lvAttrSpec.isObjectType())
             {
               // Get the next token based on the BOCountSize
               lvAttrMaxLength = mBOCountSize;
               lvAttrValue =  this.getNextToken(mBOCountSize, true);
               String lvBOType = lvAttrSpec.getTypeName();
               Object lvAttrBOValue = null;
  
                 if (lvAttrSpec.isMultipleCard())
                 {
                 this.getMultipleCard(pvBO,lvAttrIndex,lvBOType,
                   lvAttrValue);
                 }
             else {
                 this.getSingleCard(pvBO,lvAttrIndex,lvBOType,
                   lvAttrValue);
                 }
             }
                 else
             {
               // Get the next token based on the MaxLength of the attribute
                 lvAttrMaxLength = lvAttrSpec.getMaxLength();
                 if (lvAttrMaxLength > 0)
                 lvAttrValue =  this.getNextToken(lvAttrMaxLength, false);
                 else
                 lvAttrValue = null;
 
              // For simple String attribute, set to null, set to 
               // configured CxIgnore or CxBlank values, or set to the
               // attribute value 
               if (lvAttrValue == null )
                 pvBO.setAttrValue(lvAttrIndex, null); 
               else if (lvAttrValue.equals(mCxIgnore)||
                     lvAttrValue.equals(""))
                 pvBO.setAttrValue(lvAttrIndex, null); 
               else if (lvAttrValue.equals(mCxBlank)||
                     lvAttrValue.equals(" "))
                 pvBO.setAttrValue(lvAttrIndex, ""); 
                 else
                 pvBO.setAttrValue(lvAttrIndex, lvAttrValue); 
             }
         }
     }
 }
  
  
 // Populates a child container with values in the String
 protected void getMultipleCard(BusinessObjectInterface pvParentBO, 
     int pvParentAttrIndex, String pvBOType, String pvObjectCountString)
           throws CW_BOFormatException, Exception
 {
     try {
             if ( pvObjectCountString.equals(mCxIgnore) )
         {
               // trace message
         } 
             else {
               int lvObjectCount = Integer.parseInt(pvObjectCountString);
               if ( lvObjectCount == 0)
             {
                 // trace message with the number of objects in container
             }
               else if (lvObjectCount > 0)
             {
           // There is at least one instance of the object in the string
             BusinessObjectInterface lvChildBO = null;
  
                 // For each instance of the child object, parse the attribute
                 // list, and then add the object container to the parent.
                 for (int lvObjectIndex = 0; lvObjectIndex < lvObjectCount;
                       lvObjectIndex++)
                 {
               lvChildBO = getBOFromString(pvBOType);       
                   pvParentBO.setAttrValue(pvParentAttrIndex,lvChildBO);
                 } 
             }
         }
     }
 }
 
// Populates a single cardinality child with values in the String
 protected void  getSingleCard(BusinessObjectInterface pvParentBO, 
     int pvParentAttrIndex, String pvBOType, String pvObjectCountString)
           throws CW_BOFormatException, Exception
 { 
     try {
             BusinessObjectInterface lvChildBO = null;
             
             // Check the object count token
             // If it does not match "1", assume that the child object should 
             //  be null
             if (pvObjectCountString.equals("1"))
         {
               // The string contains a single instance of the child
               lvChildBO = getBOFromString(pvBOType);       
               pvParentBO.setAttrValue(pvParentAttrIndex, lvChildBO);
         }
             else if ( pvObjectCountString.equals(mCxIgnore) || 
                 pvObjectCountString.equals("0"))
         {
               // Validate that the object count token is valid
         }
                 else
               throw new CW_BOFormatException(...); 
     }
 }
 

Business Object¿¡¼­ º¯È¯ ±¸Çö

Ç¥ 76ÀÇ Ãß»ó ¸Þ¼Òµå´Â Business Object¿¡¼­ ¹®ÀÚ¿­·ÎÀÇ º¯È¯À» ¼öÇàÇÕ´Ï´Ù. Áï, °¢°¢ Business ObjectÀÇ Æ¯Á¤ ¾ç½ÄÀ¸·Î Á÷·ÄÈ­µÈ µ¥ÀÌÅ͸¦ ÀÛ¼ºÇÕ´Ï´Ù.


Ç¥ 76. Business Object¿¡¼­ ¹®ÀÚ¿­·ÎÀÇ º¯È¯À» ±¸ÇöÇÏ´Â Ãß»ó ¸Þ¼Òµå
Ãß»ó ¸Þ¼Òµå ¼³¸í
getStringFromBO() Business ObjectÀÇ µ¥ÀÌÅ͸¦ String ¿ÀºêÁ§Æ®·Î º¯È¯ÇÕ´Ï´Ù.
getStreamFromBO() Business ObjectÀÇ µ¥ÀÌÅ͸¦ InputStream ¿ÀºêÁ§Æ®·Î º¯È¯ÇÕ´Ï´Ù.
getByteArrayFromBO() Business ObjectÀÇ µ¥ÀÌÅ͸¦ ¹ÙÀÌÆ® ¹è¿­·Î º¯È¯ÇÕ´Ï´Ù.

Business Object·ÎºÎÅÍÀÇ º¯È¯ ¸ñÀûÀº Business Object¿¡ ÀÖ´Â ¸ðµç µ¥ÀÌÅÍÀÇ Á÷·ÄÈ­µÈ ¾ç½ÄÀ» ÀÛ¼ºÇÏ´Â °ÍÀÔ´Ï´Ù. ±×·¯³ª ¶§¶§·Î ÀϺΠBusiness Object µ¥ÀÌÅÍ´Â Á÷·ÄÈ­µÈ µ¥ÀÌÅÍ¿¡ Æ÷ÇÔµÇÁö ¸»¾Æ¾ß ÇÕ´Ï´Ù. ¿¹¸¦ µé¾î, Business Object´Â ÇÏÀ§ Meta Object¸¦ »ç¿ëÇÏ¿© Ä¿³ØÅÍ¿¡ ´ëÇÑ µ¿Àû ±¸¼º Á¤º¸¸¦ º¸À¯ÇÒ ¼ö ÀÖ½À´Ï´Ù.

IBMÀº ±¸¼º ¹×/¶Ç´Â µ¿Àû ¸ÞŸ µ¥ÀÌÅ͸¦ À§ÇØ cw_mo_label Á¢µÎºÎ·Î ½ÃÀÛÇÏ´Â ¸ðµç ÀÀ¿ëÇÁ·Î±×·¥ ƯÁ¤ Á¤º¸¸¦ ¿¹¾àÇÕ´Ï´Ù.

Data Handler°¡ Business Object·ÎºÎÅÍÀÇ º¯È¯ Áß¿¡ ¹«½ÃÇØ¾ß ÇÏ´Â ¼Ó¼ºÀ» Ç¥½ÃÇϱâ À§ÇØ, »óÀ§ Business Object¿¡ ´ëÇÑ Business Object Á¤ÀÇ´Â ÀÀ¿ëÇÁ·Î±×·¥ ƯÁ¤ Á¤º¸¿¡ ´ÙÀ½ ű׸¦ ÁöÁ¤ÇÕ´Ï´Ù.

cw_mo_label=child_meta-object_attribute_name
 

¿©±â¼­ labelÀº Ãß°¡·Î cw_mo_ ű×ÀÇ ¸ñÀûÀ» ´õ ½Äº°Çϱâ À§ÇØ Á¤ÀÇÇÏ´Â ¹®ÀÚ¿­À̰í child_meta-object_attribute_nameÀº ¹«½ÃÇÒ ¼Ó¼ºÀÇ À̸§À» ½Äº°ÇÕ´Ï´Ù. ÀÌ ¼Ó¼º¿¡´Â º¸Åë ÇÏÀ§ Meta Object°¡ Æ÷ÇԵ˴ϴÙ. ¿©·¯ cw_mo_label ű״ ¼¼¹ÌÄÝ·Ð(;)À¸·Î ±¸ºÐµË´Ï´Ù.

Custom Data Handler¿¡ ´ëÇØ getStringFromBO(), getStreamFromBO() ¹× getByteArrayFromBO() ¸Þ¼Òµå¸¦ ±¸ÇöÇÏ´Â °æ¿ì, ÀÌ ¸Þ¼Òµå´Â ´ÙÀ½°ú °°ÀÌ Data Handler°¡ Ä¿³ØÅÍ Æ¯Á¤ ¼Ó¼ºÀ» °Ç³Ê¶Ùµµ·Ï ÇØ¾ß ÇÕ´Ï´Ù.

  1. º¯È¯µÇ°í ÀÖ´Â Business Object¸¦ À§ÇÑ Business Object Á¤ÀÇÀÇ ÀÀ¿ëÇÁ·Î±×·¥ ƯÁ¤ Á¤º¸¿¡ ÀÖ´Â cw_mo_label ű×(¿©±â¼­ labelÀº ¹«½ÃÇÒ ¼Ó¼ºÀ» ½Äº°Çϱâ À§ÇØ Á¦°øÇÏ´Â ¹®ÀÚ¿­)°¡ Á¸ÀçÇÏ´ÂÁö È®ÀÎÇϽʽÿÀ.
  2. cw_mo_label űװ¡ ÀÖÀ¸¸é, ÀÌ Å±װ¡ Á¦°øÇÏ´Â ¹®ÀÚ¿­(child_meta-

    object_attribute_name)À» ãÀ¸½Ê½Ã¿À. µîÈ£(=) ¾ÕµÚÀÇ ¸ðµç °ø¹éÀº ¹«½ÃÇϽʽÿÀ.

  3. Business Object ¼Ó¼ºÀ» ÅëÇØ ·çÇÎÇÏ´Â µ¿¾È, °¢ ¼Ó¼º À̸§À» child_meta-

    object_attribute_name ¹®ÀÚ¿­°ú ºñ±³ÇϽʽÿÀ. ÀÌ À̸§ÀÇ ¼Ó¼ºÀ» °Ç³Ê¶Ù½Ê½Ã¿À.

´ÙÀ½ ÄÚµå ´ÜÆí¿¡¼­´Â ¼Ó¼ºÀ» °Ç³Ê¶Ù´Â ¹æ¹ýÀ» º¸¿©ÁÝ´Ï´Ù.

List configObjList = 
      com.crossworlds.DataHandlers.text.namevalue.listMOAttrNames(BusObj);
  
 //this list contains attribute names, which are configuration objects
 for ( attributes in BusObj )
 {
           String attrName = BusObj.getAttrDisc(i).getName();
           if ( configObjList.contains(attrName) )
           {
             //skip
             continue;
           }
 }
 

¿¹¸¦ µé¾î, MyCustomer¶ó°í ÇÏ´Â Business Object°¡ ÇÏÀ§ Meta Object¸¦ »ç¿ëÇÏ¿© Ä¿³ØÅÍ Æ¯Á¤ ¶ó¿ìÆÃ Á¤º¸¸¦ º¸À¯ÇÑ´Ù°í °¡Á¤ÇÕ´Ï´Ù. ÀÌ Meta Object¸¦ ¼Ó¼º CustConfig·Î Ç¥½ÃÇÒ °æ¿ì, MyCustomer´Â ÀÀ¿ëÇÁ·Î±×·¥ ƯÁ¤ Á¤º¸¿¡ ´ÙÀ½ ű׸¦ °¡Áú ¼ö ÀÖ½À´Ï´Ù.

cw_mo_cfg=CustConfig
 

Business Object·ÎºÎÅÍ º¯È¯ Áß, Custom Data Handler´Â MyCustomer¿Í ¿¬°üµÈ Business Object Á¤ÀǸ¦ À§ÇØ ÀÀ¿ëÇÁ·Î±×·¥ ƯÁ¤ Á¤º¸¸¦ È®ÀÎÇϰí cw_mo_cfg ű׸¦ ãÀº ÈÄ, CustConfig ¼Ó¼ºÀ» °Ç³Ê¶Ù¾î¾ß ÇÏ´ÂÁö¸¦ ÆÇº°ÇÕ´Ï´Ù. ÀÌ¿¡ µû¶ó Data Handler¿¡¼­ »ý¼ºµÇ´Â Á÷·ÄÈ­µÈ µ¥ÀÌÅÍ¿¡´Â CustConfig ÇÏÀ§ Meta Object°¡ Æ÷ÇÔµÇÁö ¾Ê½À´Ï´Ù.

ÁÖ:
Business Object·ÎºÎÅÍ º¯È¯ÇÒ ¶§, IBM Á¦°ø Data Handler´Â cw_mo_label űװ¡ ½Äº°ÇÏ´Â ¸ðµç ¼Ó¼ºÀ» °Ç³Ê¶Ý´Ï´Ù.

Data Handler°¡ ÇÏÀ§ Meta Object³ª ´Ù¸¥ µ¿Àû ¿ÀºêÁ§Æ®¸¦ »ç¿ëÇÏ´Â Ä¿³ØÅÍ¿Í ÇÔ²² ÀÛµ¿ÇÒ °æ¿ì¿¡¸¸ cw_mo_label ű׸¦ ó¸®Çϱâ À§ÇÑ Custom Data Handler¸¦ °³¹ßÇØ¾ß ÇÕ´Ï´Ù.

getStringFromBO() ¸Þ¼Òµå ±¸Çö

getStringFromBO() ¸Þ¼Òµå´Â Business Object¿¡¼­ ¹®ÀÚ¿­·ÎÀÇ º¯È¯À» ¼öÇàÇÕ´Ï´Ù. Áï, Business ObjectÀÇ µ¥ÀÌÅ͸¦ String ¿ÀºêÁ§Æ®·Î º¯È¯ÇÕ´Ï´Ù. ÀÌ ¸Þ¼ÒµåÀÇ °æ¿ì, È£ÃâÀÚ´Â º¯È¯ÇÒ Business Object¸¦ Àü´ÞÇÕ´Ï´Ù. ±×¸² 42¿¡¼­´Â FixedWidth Data Handler¿¡ ÀÇÇØ ±¸ÇöµÇ´Â getStringFromBO() ¸Þ¼Òµå¸¦ º¸¿©ÁÝ´Ï´Ù. ¸Þ¼Òµå´Â °íÁ¤ Æø ÇʵåÀÇ StringÀ» ÀÛ¼ºÇÕ´Ï´Ù.

´ÙÀ½ ¿¹¿¡¼­´Â Business Object¿¡¼­ Reader ¿ÀºêÁ§Æ®·Î µ¥ÀÌÅ͸¦ º¯È¯ÇÒ ¶§ »ç¿ëµÇ´Â ´Ü°è¸¦ º¸¿©ÁÝ´Ï´Ù.

  1. getStringFromBO() ¸Þ¼Òµå´Â setAttrList()¸¦ È£ÃâÇÏ¿© Business ObjectÀÇ ¼Ó¼ºÀ» ÅëÇØ ¹Ýº¹ÀûÀ¸·Î ·çÇÎÇÕ´Ï´Ù. setAttrList() ¸Þ¼Òµå°¡ ´Ü¼ø ¼Ó¼ºÀ» ãÀ¸¸é, setSimpleToken() ¸Þ¼Òµå¸¦ È£ÃâÇÏ¿© °ªÀ» ¼³Á¤ÇÕ´Ï´Ù.
  2. setSimpleToken() ¸Þ¼Òµå´Â ¼Ó¼º °ªÀ» StringBuffer ¿ÀºêÁ§Æ®¿¡ Ãß°¡Çϰí StringBuffer¸¦ String ¿ÀºêÁ§Æ®·Î º¯È¯½ÃŲ ÈÄ Àüü Business Object¸¦ Ç¥½ÃÇÏ´Â StringBuffer¿¡ ¹®ÀÚ¿­À» Ãß°¡ÇÕ´Ï´Ù. setAttrList()°¡ Business Object¸¦ ó¸®Çϸé, getStringFromBO() ¸Þ¼Òµå´Â StringBuffer¸¦ String ¿ÀºêÁ§Æ®·Î º¯È¯½ÃÄÑ StringÀ» È£ÃâÀÚ¿¡°Ô ¸®ÅÏÇÕ´Ï´Ù.

±×¸² 42. getStringFromBO() ¸Þ¼Òµå ¿¹

public String getStringFromBO(BusinessObjectInterface theObj, 
           Object config)
           throws Exception
 {
                     traceWrite( 
             "Entering getStringFromBO(BusinessObjectInterface, Object) "
             + " for object type " + theObj.getName(),
             JavaConnectorUtil.LEVEL4);
  
           clear(config);
           String lvBOString = null;
           setAttrList(theObj);
           lvBOString = mBOStringBuffer.toString();
  
                     traceWrite( 
             "Exiting getStringFromBO(BusinessObjectInterface, Object) "
             + " for object type " + theObj.getName(),
             JavaConnectorUtil.LEVEL4);
  
           return lvBOString;
 }
  
  
 protected void setAttrList(BusinessObjectInterface pvBO) throws Exception
 {
                     traceWrite( 
             "Entering setAttrList(BusinessObjectInterface) for object "
              + pvBO.getName(), JavaConnectorUtil.LEVEL4);
  
           int lvAttrNum = pvBO.getAttrCount();
  
           String lvAttrName = null;
           String lvAttrValue = null;
           int lvAttrMaxLength = 0;
  
           // Add the Business Object name and verb to the fixed width format
           //  String
           this.setSimpleToken( mBONameSize, pvBO.getName());
           this.setSimpleToken( mBOVerbSize, pvBO.getVerb());
  
     try {
             List moAttrNames = listMOAttrNames( pvBO );
             int lvAttrCount = pvBO.getAttrCount();
  
             ATTRIBUTE_WALK: for (int lvAttrIndex = 0; 
               lvAttrIndex < lvAttrCount; ++lvAttrIndex)
         {
               CxObjectAttr lvAttrSpec = pvBO.getAttrDesc(lvAttrIndex);
               lvAttrName = lvAttrSpec.getName();
  
               // Check if the current attribute is a simple (String) type
               //  or a contained object.
               if (lvAttrSpec.isObjectType())
             {
                 //skip child objects designated as meta objects
                 if( moAttrNames.contains( lvAttrName ) ) 
                 {
                    continue ATTRIBUTE_WALK;
                 }
 
                if (lvAttrSpec.isMultipleCard())
             {
                   CxObjectContainerInterface lvAttrMultiCardBOValue =
               (CxObjectContainerInterface) pvBO.getAttrValue(lvAttrIndex);
  
                   if (lvAttrMultiCardBOValue == null)
                 {
                     traceWrite( 
                 "setAttrList found empty multiple cardinality container " 
                 + lvAttrSpec.getTypeName(), JavaConnectorUtil.LEVEL5);
  
                     // Add the count to the fixed width String
                     this.setSimpleToken( mBOCountSize, "0");
                 }
                 else
                 {
                     int lvObjectCount =
                       lvAttrMultiCardBOValue.getObjectCount();
                     traceWrite( 
                   "setAttrList found multiple cardinality container " 
                   + lvAttrSpec.getTypeName() + " with " 
                   + lvObjectCount + " instances",
                   JavaConnectorUtil.LEVEL5);
  
                     // Add the count to the fixed width String
                     this.setSimpleToken( mBOCountSize,
                       Integer.toString(lvObjectCount));
  
                     // Add each object in the container to the fixed
                     //  width String.
                     for (int lvContObjectIndex = 0; 
                         lvContObjectIndex < lvObjectCount;
                         ++lvContObjectIndex)
                       setAttrList(
             lvAttrMultiCardBOValue.getBusinessObject(lvContObjectIndex));
                 }
             }
                 else
             {
                   BusinessObjectInterface lvAttrSingleCardBOValue =
               (BusinessObjectInterface) pvBO.getAttrValue(lvAttrIndex);
  
                   if (lvAttrSingleCardBOValue == null)
                 {
                     traceWrite( 
                 "setAttrList found empty single cardinality container " 
                 + lvAttrSpec.getTypeName(), JavaConnectorUtil.LEVEL5);
  
                     // Add the count to the fixed width String
                     this.setSimpleToken( mBOCountSize, "0");
                 }
 
                else
                 {
                     traceWrite( 
                   "setAttrList found single cardinality container "
                   + lvAttrSpec.getTypeName(),
                   JavaConnectorUtil.LEVEL5);
  
                     // Add the count to the fixed width String
                     this.setSimpleToken( mBOCountSize, "1");
                     setAttrList(lvAttrSingleCardBOValue);
                 }
             }
         }
                 else
         {
                 lvAttrValue = (String) pvBO.getAttrValue(lvAttrIndex);
                 lvAttrMaxLength = lvAttrSpec.getMaxLength();
  
                 if (lvAttrMaxLength > 0)
                   this.setSimpleToken(lvAttrMaxLength, lvAttrValue);
            }
         }
     }
           catch (CxObjectNoSuchAttributeException e)
     {
             throw new Exception(e.getMessage());
     }
  
                     traceWrite( 
 "Exiting setAttrList(BusinessObjectInterface) for object "
              + pvBO.getName(), JavaConnectorUtil.LEVEL4);
 }
  
  
 protected void setSimpleToken( int pvCellSize, String pvTokenValue)
           throws Exception
 {
           traceWrite( "Entering setSimpleToken(int, String)",
             JavaConnectorUtil.LEVEL4);
  
           StringBuffer lvNewBuffer = new StringBuffer(pvCellSize);
           int lvTokenLength = 0;
           int lvCxIgnoreLength = mCxIgnore.length();
           int lvCxBlankLength = mCxBlank.length();
  
           int lvPadNumber = 0;
  
  
           // Check the token value to see if it is null
           if (pvTokenValue == null)
     {
             // For this case, we add the configured CxIgnore value to the
             //  fixed width String if it fits in the cell.
             if (!mTruncation && lvCxIgnoreLength > pvCellSize)
               throw new Exception(
                 " Null attribute value encountered where cell size is "
                 + pvCellSize + ", size of CxIgnore value is "
                 + lvCxIgnoreLength + "and trucation is not allowed. " 
             + "Please check your MO format configuration.");
 
                else
         {
               lvPadNumber = pvCellSize - lvCxIgnoreLength;
               lvNewBuffer.append(mCxIgnore);
         }
  
     }
           else if (pvTokenValue.equals(""))
     {
             // For this case, the configured CxBlank value is added to the
             //  fixed width String if it fits in the cell.
             if (! mTruncation && lvCxBlankLength > pvCellSize)
               throw new Exception(
             " Blank attribute value encountered where cell size is "
             + pvCellSize + ", size of CxBlank value is "
             + lvCxBlankLength + "and trucation is not allowed. " 
             + "Please check your MO format configuration.");
                 else
         {
               lvPadNumber = pvCellSize - lvCxBlankLength;
                lvNewBuffer.append(mCxBlank);
         }
     }
                 else
     {
             // For this case, actually add the token value to the fixed
             // width String, unless the data is too long for the cell.
             lvTokenLength = pvTokenValue.length();
             if (!mTruncation && lvTokenLength > pvCellSize )
               throw new Exception(
                 " Attribute value encountered where cell size is "
                 + pvCellSize + ", size of token value is "
                 + lvTokenLength + "and trucation is not allowed. "
             + "Please check your MO format configuration.");
                 else
         {
               lvNewBuffer.append(pvTokenValue);
               lvPadNumber = pvCellSize - lvTokenLength;
         }
     }
  
           if (lvPadNumber <= 0 && mTruncation)
             // Token is longer than the cell and truncation is allowed,
             //  so the characters up to pvCellSize are added
             lvNewBuffer.setLength(pvCellSize);
           else if (lvPadNumber > 0)
     {
             // Pad the cell based on the configuration option chosen
             if ( mAlignment.equals(fixedwidth.AlignmentLeft) ||
                 mAlignment.equals(fixedwidth.AlignmentBoth))
               this.padRight(lvNewBuffer, lvPadNumber);
             else if (mAlignment.equals(fixedwidth.AlignmentRight))
               this.padLeft(lvNewBuffer, lvPadNumber);
     }
 
          String lvNewBuffString =  lvNewBuffer.toString();
  
           // Note that this may cause a performance issue when the tracing
           //  level is low, but in most cases it should not as any one token
           //  is *usually* not very long.
                     traceWrite( 
             "Adding the following token to the fixed width String: "
             + lvNewBuffString, JavaConnectorUtil.LEVEL5);
  
           // After the cell has been fully formatted, append to fixed width
           //  String being built
           mBOStringBuffer.append(lvNewBuffString);
  
           traceWrite( "Exiting setSimpleToken(int, String)",
             JavaConnectorUtil.LEVEL4);
 }
 

getStreamFromBO() ¸Þ¼ÒµåÀÇ ±¸Çö

getStreamFromBO() ¸Þ¼Òµå´Â Business ObjectÀÇ µ¥ÀÌÅ͸¦ InputStream ¿ÀºêÁ§Æ®·Î º¯È¯½Ãŵ´Ï´Ù. ±×¸² 43¿¡¼­´Â

getStreamFromBO() ¸Þ¼Òµå¸¦ ±¸ÇöÇÑ ¿¹¸¦ º¸¿©ÁÝ´Ï´Ù. ÀÌ ±¸Çö¿¡¼­,

getStreamFromBO()´Â getStringFromBO()¸¦ È£ÃâÇÏ¿© Business Object µ¥ÀÌÅ͸¦ Æ÷ÇÔÇÏ´Â String ¿ÀºêÁ§Æ®¸¦ ºôµåÇÑ ÈÄ StringÀ» InputStreamÀ¸·Î º¯È¯ÇÕ´Ï´Ù. ¸Þ¼Òµå´Â Business ObjectÀÇ µ¥ÀÌÅ͸¦ Ç¥½ÃÇÏ´Â InputStream ¿ÀºêÁ§Æ®¸¦ ¸®ÅÏÇÕ´Ï´Ù.

±×¸² 43. getStreamFromBO() ¸Þ¼Òµå ¿¹

public InputStream getStreamFromBO(BusinessObjectInterface theObj, 
           Object config)
           throws Exception
 {
           clear(config);
  
 String BOstring;
 BOstring = getStringFromBO(theObj, config);
  
 return new ByteArrayInputStream( BOstring.getBytes() );
 }
 

°ø¿ë ¸Þ¼Òµå ´ëü

Ãß»ó DataHandler ¸Þ¼Òµå(±¸ÇöÇØ¾ß ÇÏ´Â ¸Þ¼Òµå) ¿Ü¿¡µµ, Custom Data Handler¿¡ ´ëÇØ ÃÖÀûÀ¸·Î ÀÛµ¿Çϵµ·Ï DataHandler Ŭ·¡½ºÀÇ °ø¿ë ¸Þ¼Òµå¸¦ ´ëÃ¼ÇØ¾ß ÇÏ´Â °æ¿ìµµ ÀÖ½À´Ï´Ù(Ç¥ 77 ÂüÁ¶).

Ç¥ 77. DataHandler Ŭ·¡½ºÀÇ °ø¿ë ¸Þ¼Òµå
°ø¿ë DataHandler ¸Þ¼Òµå ¼³¸í
getBO() - °ø¿ë Á÷·ÄÈ­µÈ µ¥ÀÌÅÍ(¸î °¡Áö Çü½Ä Áß Çϳª)¸¦ Business Object·Î º¯È¯ÇÕ´Ï´Ù.
getBOName() Á÷·ÄÈ­µÈ µ¥ÀÌÅÍ¿¡¼­ Business ObjectÀÇ À̸§À» È®º¸ÇÕ´Ï´Ù.
getBooleanOption() Data Handler¿¡¼­ ºÎ¿ï ±¸¼º ¿É¼ÇÀÇ °ªÀ» È®º¸ÇÕ´Ï´Ù.
getOption() Data Handler¿¡¼­ ±¸¼º ¿É¼ÇÀÇ °ªÀ» È®º¸ÇÕ´Ï´Ù.
setOption() Data Handler¿¡¼­ ±¸¼º ¿É¼ÇÀ» ¼³Á¤ÇÕ´Ï´Ù.
traceWrite() Data Handler(Ä¿³ØÅÍ ¶Ç´Â ÅëÇÕ ºê·ÎÄ¿°¡ InterChange ServerÀÎ °æ¿ì ¼­¹ö ¾×¼¼½º ÀÎÅÍÆäÀ̽º)ÀÇ ÇØ´ç ¹®¸Æ¿¡ ´ëÇØ trace-write ¸Þ¼Òµå¸¦ È£ÃâÇÕ´Ï´Ù.

Copyright IBM Corp. 1997, 2003