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


1:¼øÂ÷N±¸Á¶ÀÇ name-value pair DataSet Á¤ÀÇ
 
À̸§ ±â¹ÝÀÇ À¯¿¬ÇÑ °´Ã¼±¸Á¶¸¦ ÀÌ¿ëÇÏ¿© ¼øÂ÷ÀûÀÎ µ¥ÀÌÅ͸¦ °³¹ßÀÚ°¡ »ý¼ºÇÏÁö ¾Ê°í setValue¸¸À» È£ÃâÇÏ¿© µ¥ÀÌÅÍ󸮰¡ °¡´ÉÇϵµ·Ï ¸¸µç ±¸Á¶·Î ³î»õ°¡ ¸¹ÀÌ »ç¿ëÇÒ °Í °°¾Æ ¿Ã¸³´Ï´Ù. ( 2004/01/29 ) 144
Written by ienvyou - ÃÖÁö¿õ
1 of 1
 


Áö±Ý ÇÏ´Â °÷»Ó¸¸ÀÌ ¾Æ´Ï¶ó ´Ù¸¥°÷¿¡¼­ »ó´çÈ÷ ¸¹ÀÌ »ç¿ëÇÒ °Í °°¾Æ¼­ ¹Ì¸® ¿Ã·ÁµÓ´Ï´Ù.
¾²½Ç¼ö ÀÖÀ¸¸é ¾²½Ã±¸¿ä.
Dependency¸¦ °¡Áø Value Object(VO)ÀÇ ÇüÅ°¡ ¾Æ´Ï¶ó ¿©·¯°¡Áö ÇüÅÂÀÇ µ¥ÀÌÅ͸¦ À̸§°ª¿¡
ÀÇÇÏ¿© 󸮰¡ µÇµµ·Ï jolt package³»¿ëÀ» ÂüÁ¶ÇÏ¿© ¸¸µé¾ú½À´Ï´Ù.

¢º AsiDataSet

±×³É À̸§ÇÏ¿© AsiDataSetÀ̶ó°í ºÙ¿´½À´Ï´Ù  ASI(Application System Integration)À̶ó°í 
¹¹ ¾î¼±¸ Àú¼±¸ ÇÏ´Â°Ô Àִµ¥¿ä. °Å±â¼­ »ç¿ëÇÒ·Á°í ¸¸µé¾ú´Ù°¡ ºÐ¸í ³ªÁß¿¡ ¶Ç ¾²ÀÌ°Ô µÉ°Í°°¾Æ¼­
ÀÒ¾î¹ö¸±±îºÁ ¿Ã¸³´Ï´Ù.

¾îµð´Ù°¡ ¾²·Á°í Çß³Ä¸é ¸Þ½ÃÁö Æ÷¸ËÆÃ(ÀÚ¸®¼ö ¸ÂÃß°í, ¼ø¼­¸ÂÃß°í µîµî) °ú work flowó¸®, 
transactionó¸®, rule󸮵îÀ» À§ÇÏ¿© ÇϳªÀÇ °´Ã¼¸¦ »ç¿ëÇϵµ·Ï ÇÏ·ÁÇÑ°Ì´Ï´Ù.

ÀÌ°É »ç¿ëÇÏ´Â °÷Àº 5°³ÀÇ ¼­·Î´Ù¸¥ ¾÷¹«°è ½Ã½ºÅÛ(WAS, Tuxedo)À̸ç AsiDataSet¿¡ 
´Ù¸¥ ½Ã½ºÅÛ(Tuxedo, ELink, TCP/IP Socket Adapter, FTP, MQ Series, Soap)¿¡ ´ëÇÑ Å¸ÄÏÁ¤º¸¸¦
¹°°í µé¾î¿À¸é ½ÇÁ¦ DataSet¿¡ ÀÖ´Â µ¥ÀÌÅ͸¦ °¢°¢ÀÇ ´ë¿Ü½Ã½ºÅÛ¿¡ ¸Â°Ô²û Á¶ÇÕÇÏ¿© ó¸®µÉ ¼ö ÀÖµµ·Ï
¸¸µç ÀÚµ¿È­ Ŭ·¡½ºÀÇ ÇÙ½É µ¥ÀÌÅ͸¦ ¹°°í ÀÖ½À´Ï´Ù.




/*
 * @(#)AsiDataSet.java	1.0 04/01/12
 *
 * Copyright (C) The Javapattern.info All rights reserved.
 *
 */

package com.javapattern.pool;

import java.util.Map;
import java.util.Hashtable;
import java.util.Vector;
import java.util.ArrayList;

/**
* WLI¿¡ ¿äûÀ» ÇÏ°Ô µÇ´Â request parameter data setÀ» Á¤ÀÇÇÑ´Ù.
* Member VariableÀº _¸¦ ÀÌ¿ëÇÏ¿© ÇØ´ç Àü¿ªº¯¼öÀÓÀ» ¾Ë¾Æº¼¼ö ÀÖµµ·Ï ÇÏ¿´´Ù
* °¢ ÆĶó¹ÌÅ͸¦ ÀÌ¿ëÇÏ¿© µ¥ÀÌÅ͸¦ ¼¼ÆÃÇÒ ¼ö ÀÖµµ·Ï ó¸®Çϸç ÇϳªÀÇ String index¿¡ 
* ´Ù¼ö°³ÀÇ value°ªÀÌ ¼øÂ÷ÀûÀ¸·Î µé¾î°¥¼ö ÀÖ´Â
* ÇüÅ·Π¼±ÅÃÇÏ¿© ¸¸µé¾ú´Ù. Áï name-valueÀÇ pair°¡ ¹Ýµå½Ã ÀÌ·ç¾îÁö´Â °ÍÀÌ ¾Æ´Ï¶ó 1-nÀÇ À¯¿¬ÇÑ ±¸Á¶·Î¼­
* µ¥ÀÌÅ͸¦ Çڵ鸵Çϵµ·Ï Çϸç, ÆĶó¹ÌÅÍ¿¡ °ªÀÌ À¯µ¿ÀûÀ¸·Î 󸮵ǾîÁú ¼ö Àִ Ư¡À» °¡Áö°Ô ÇÑ´Ù.
* ±Ã±ÝÇÑ »çÇ×ÀÌ ÀÖÀ¸¸é ¾Æ·¡ ¸ÞÀÏ·Î ¸ÞÀϺ¸³»±â.
*
* @version 0.0a
* @author Choi Ji Woong
*/
public class AsiDataSet extends Hashtable implements java.io.Serializable {
    protected boolean unrestricted;

    private String _svcName;

    // to do : Constructor here
    /**
    *	AsiDataSet »ý¼ºÀڷμ­ »ý¼ºÀμö°¡ ¾øÀ¸¸é ÃʱâÀÇ 10ÀÇ Å©±â·Î µ¥ÀÌÅͼÂÀ» ¸¸µé¾îÁ¦°øÇϵµ·Ï ÇÑ´Ù.
    */
    public AsiDataSet(){
        super(10);
        unrestricted = true;
    }

    /**
    *	±âº»ÀûÀ¸·Î application¿äû¿¡ ÀÇÇÏ¿© »ý¼ºÇϵµ·Ï ÇÑ´Ù.
    *	@param i Ãʱâ DataSet size
    */
    public AsiDataSet(int i)	{
        super(i);
        unrestricted = true;
    }

    protected AsiDataSet(int i, boolean flag)	{
        super(i);
        unrestricted = flag;
    }

    /**
    * Service ¸í ¼³Á¤
    * @param	svc_name	Tuxedo Service Name
    */
    public void setSvcName(String svcName){
        this._svcName = svcName;
    }

    /**
    *	Service¸íÀÇ ¹Ýȯ
    *	@return _svcName ¼­ºñ½ºÀÇ ½ÇÁ¦ À̸§
    */
    public String getSvcName() {
        return this._svcName;
    }


    /**
    *	Result¸¦ ÅëÇÏ¿© °á°ú°ªÀ» ¾ò¾î°¡µµ·Ï ó¸®ÇÑ´Ù.
    *	@param s value°ª¿¡ ´ëÇÑ À¯ÀÏÇÑ ½Äº°ÀÚ
    *	@param i °´Ã¼ÀÇ À§Ä¡
    *	@param obj default°´Ã¼
    *	@return °á°ú¹Ýȯ°ª
    */
    public Object getValue(String s, int i, Object obj)	{
        Vector vector = (Vector)super.get(s);
        if(vector == null)	 return obj;
        try {
            return vector.elementAt(i);
        } catch(ArrayIndexOutOfBoundsException ex) {
            return obj;
        }
    }

    /**
    *	Result¸¦ ÅëÇÏ¿© °á°ú°ªÀ» ¾ò¾î°¡µµ·Ï ó¸®ÇÑ´Ù.
    *	@param s value°ª¿¡ ´ëÇÑ À¯ÀÏÇÑ ½Äº°ÀÚ
    *	@param i °´Ã¼ÀÇ À§Ä¡
    *	@param obj default°´Ã¼
    */
    public Object getValue(String s, Object obj) {
        return getValue(s, 0, obj);
    }

    /**
    *	HashtableÀÇ s°ªÀÇ µ¥ÀÌÅ͸¦ putÇϵµ·Ï Çϸç
    *	½ÇÁ¦ ±×¾ÈÀÇ µ¥ÀÌÅ͸¦ ¼øÂ÷°ªÀ» °¡Áø Vector¸¦ »ç¿ëÇÑ´Ù
    */
    public void setValue(String s, int i, Object obj) {
        Vector vector = (Vector)get(s);
        if(vector == null) {
            vector = new Vector(1, 5);
            put(s, vector);
        }
        if(i >= vector.size()) vector.setSize(i + 1);
        vector.setElementAt(obj, i);
    }

    /**
    *	HashtableÀÇ s°ªÀÇ µ¥ÀÌÅ͸¦ putÇϵµ·Ï Çϸç
    *	½ÇÁ¦ ±×¾ÈÀÇ µ¥ÀÌÅ͸¦ ¼øÂ÷°ªÀ» °¡Áø Vector¸¦ »ç¿ëÇÑ´Ù
    *	setValue(s, 0, obj¸¦ È£ÃâÇÑ´Ù.
    */
    public void setValue(String s, Object obj) {
        setValue(s, 0, obj);
    }

    /**
    *	s°ª¿¡ ÀÇÇÏ¿© ÀúÀåµÈ µ¥ÀÌÅÍÀÇ »çÀÌÁ ±¸Çϵµ·Ï ÇÑ´Ù.
    */
    public int getCount(String s) {
        Vector vector = (Vector)super.get(s);
        if(vector == null)
            return 0;
        else
            return vector.size();
    }

    /**
    *	È®Àå¿©ºÎ¸¦ È®ÀÎÇÑ´Ù.
    */
    protected boolean expanded() {
        return true;
    }

}
ÀÌÁ¦ À§ÀÇ Å¬·¡½º¸¦ ÀÌ¿ëÇÏ¿© legacy system°ú ¿¬µ¿ÈÄ °á°ú°ª¿¡ ´ëÇÑ Å¬·¡½º°¡ ÇÊ¿äÇÏ°Ú³×¿ä ±× °á°ú´Â ±×³É DataSetÀ» ±×´ë·Î »ó¼ÓÇÏ¿© Ŭ¶óÀ̾ðÆ®Ãø¿¡¼­µµ °°Àº ¹æ¹ýÀ¸·Î µ¥ÀÌÅÍ¿¡ Á¢±ÙÇϵµ·Ï ÇÕ´Ï´Ù.

/*
 * @(#)AsiResult.java	1.0 04/01/12
 *
 * Copyright (C) The Javapattern.info. All rights reserved.
 */

/**
* ÀÌ Å¬·¡½º´Â AsiDataSetÀÇ ±âº»ÀûÀÎ µ¥ÀÌÅÍ¿Í °ªÀ» ±×·¡µµ ÃëÇÕÇÏ¿© »ç¿ëÇÒ¼ö ÀÖµµ·Ï
* »ó¼Ó¹Þ°í ÀÖ´Â ÇüŸ¦ ÃëÇÑ´Ù.
* °á°ú°ª¿¡ ´ëÇÑ applicationÄÚµå¿Í error ¹× ±âŸÁ¤º¸¿¡ ´ëÇÑ ³»¿ëÀ» ´ã°í ÀÖµµ·Ï ÇÑ´Ù.
*
* @version 0.0a
* @author Choi Ji Woong
*/
public class AsiResult extends AsiDataSet implements  java.io.Serializable{
    // ´Ù¸¥ ÆÐÅ°Áö Á¢±ÙÁ¦ÇÑ
    protected int applicationCode;
    protected static final int NO_ERROR = 0;
    protected static final int APPLICATION_ERROR = 1;
    protected static final int SYSTEM_ERROR = 2;

    // to do : Field mapping required
    protected AsiResult(int i) {
        super(i);
    }

    public int getApplicationCode() {
        return applicationCode;
    }
}
Ŭ¶óÀ̾ðÆ®´Â Hashtable¿¡ ¼øÂ÷ÀûÀÎ ListÇüÅÂÀÇ °ªÀ» ÀúÀåÇϱâ À§ÇÏ¿© ±»ÀÌ java.util.List°è¿­ÀÇ Å¬·¡½º¸¦ »ç¿ëÇÏÁö ¾Ê¾Æµµ µÈ´Ù. ±×Àú setValue(), getValue()¸Þ¼Òµå¸¦ ÅëÇÏ¿© ¿øÇÏ´Â target½Ã½ºÅÛÀ¸·Î data¸¦ Àü¼ÛÇÏ°í ¹ÞÀ»»ÓÀÌ´Ù À§ÀÇ Å¬·¡½º¸¦ Å×½ºÆ®Çϴ Ŭ¶óÀ̾ðÆ® Äڵ带 º¸µµ·Ï ÇÏÀÚ.

public class TestClient extends Thread 
{
    public static void main(String [] args) throws Exception{
        TestClient x = new TestClient();
        x.start();
    }

    public void run() {
        try{
            AsiDataSet dataSet = new AsiDataSet();
            dataSet.setSvcName("MSS001");
            dataSet.setValue("NAME", "ÃÖÁö¿õ");
            dataSet.setValue("ADDRESS", "°æ±âµµ ¿ëÀνà ¼öÁöÀ¾ µ¿Ãµµ¿");
            dataSet.setValue("MOVIE", 0, "űرâÈÖ³¯¸®¸ç");
            dataSet.setValue("MOVIE", 1, "±×³à¸¦ ¸ð¸£¸é °£Ã¸");
            dataSet.setValue("HOBBY", "¼ú¸¶½Ã±â");
            dataSet.setValue("E", "E");
            System.out.println(dataSet);
        }catch(Exception e) {
            e.printStackTrace();	
        }
    }
};
À§¿¡²¨ ½ÇÇàÇÏ¸é ¾Æ·¡Ã³·³ ³ª¿Â´Ù. {E=[E], NAME=[ÃÖÁö¿õ], MOVIE=[űرâÈÖ³¯¸®¸ç, ±×³à¸¦ ¸ð¸£¸é °£Ã¸], HOBBY=[¼ú¸¶½Ã±â], ADDRESS=[°æ±âµµ ¿ëÀνà ¼öÁöÀ¾ µ¿Ãµµ¿]}

public class TestClient extends Thread 
{
    public static void main(String [] args) throws Exception{
        TestClient x = new TestClient();
        x.start();
    }

    public void run() {
        try{
            AsiDataSet dataSet = new AsiDataSet();
            dataSet.setSvcName("MSS001");
            dataSet.setValue("NAME", "ÃÖÁö¿õ");
            dataSet.setValue("ADDRESS", "°æ±âµµ ¿ëÀνà ¼öÁöÀ¾ µ¿Ãµµ¿");
            dataSet.setValue("MOVIE", 0, "űرâÈÖ³¯¸®¸ç");
            dataSet.setValue("MOVIE", 3, "±×³à¸¦ ¸ð¸£¸é °£Ã¸");
            dataSet.setValue("HOBBY", "¼ú¸¶½Ã±â");
            dataSet.setValue("E", "E");
            System.out.println(dataSet);
        }catch(Exception e) {
            e.printStackTrace();	
        }
    }
};
À§Ã³·³ 1À» 3À¸·Î ¹Ù²Ù°í ½ÇÇàÇÏ¸é ¾Æ·¡Ã³·³ ³ª¿Â´Ù. {E=[E], NAME=[ÃÖÁö¿õ], MOVIE=[űرâÈÖ³¯¸®¸ç, null, null, ±×³à¸¦ ¸ð¸£¸é °£Ã¸], HOBBY=[¼ú¸¶½Ã±â], ADDRESS=[°æ±âµµ ¿ëÀνà ¼öÁöÀ¾ µ¿Ãµµ¿]} ÀÌÁ¦ºÎÅʹ ȣ½ºÆ®¿Í Ŭ¶óÀ̾ðÆ®»çÀÌÀÇ ÀÎÅÍÆäÀ̽º¸¸ º¸°í¼­µµ ¿ì¸®´Â Çڵ鸵 ÇÒ¼ö ÀÖ°Ô µÇ¾ú´Ù.
 
1
References
 
Copyright ¨Ï 2003 www.javapattern.info & www.jlook.com, an jLOOK co.,LTD