package com.eactive.eai.adapter.jtc;

import tmax.jtc.TuxService;
import tmax.jtc.io.TuxBuffer;
import tmax.webt.WebtException;

// JEUS -> TUXEDO
//11. JEUS lifecycle-invocation 등록하기
//
//JEUSMain.xml 파일
//
//
//<lifecycle-invocation>
//    <class-name>tmax.jtc.external.TuxBootstrapper</class-name>
//    <invocation>
//         <invocation-method>
//            <method-name>init</method-name>
//            <method-params>
//                <method-param>java.lang.String</method-param>
//            </method-params>
//        </invocation-method>
//        <invocation-argument>/user/barami/jeus5/lib/application/jtc.properties</invocation-argument>
//
//<invocation-type>BOOT</invocation-type>
//
//   </invocation>
//
//</lifecycle-invocation> 
//
// 
//
//12. jtc.properties 환경파일 설정으로 primary의 경우 barami 계정의 tuxedo이고 backup의 경우chnam 계정의 tuxedo이다.
//
//
//log.level=debug
//log.dir=/user/barami/jeus5/logs/
//log.file=jtc1.log
//log.bufsize=1024
// 
//
//tux.local.name=DM_M1_10
//tux.remote.name.list=DM_A1_10,DM_A1_20
//tux.default.remote=DM_A1_10
// 
//
//tux.buffer.size=1024
//tux.default.timeout=60
//tux.default.txtimeout=300
// 
//
//# Primary Tuxedo Server Setting
// 
//
//tux.DM_A1_10.addr=192.167.10.48
//tux.DM_A1_10.port=20010
//tux.DM_A1_10.interval=10
//tux.DM_A1_10.backup=DM_A1_20
// 
//
//# Backup Tuxedo Server Setting
// 
//
//tux.DM_A1_20.addr=192.167.10.48
//tux.DM_A1_20.port=20020
//tux.DM_A1_20.interval=10


public class JtcClientSample {

	public static void main(String[] args) {
		TuxService service = new TuxService("TUXDOM", "SAMPLE");
//		TuxCallDescripter cd = service.tpconnect(false);
		
		try {
//			if(cd == null) {
				// System.out.println("tpconnect failed!");
//			}
//			else {

//			TuxBuffer sndbuf = service.createCarrayBuffer();
//			sndbuf.setBytes("test".getBytes());
			
				TuxBuffer sndbuf = service.createStringBuffer();
				sndbuf.setString("conversation service");
				
				TuxBuffer rcvbuf = service.tpcall(sndbuf);
				// System.out.println(rcvbuf.getString());
//			}
		}
		catch (WebtException e) {
			e.printStackTrace();
			// System.out.println("error Occurred");
			
		}
		finally {
//			service.tpdiscon(cd);
		}
	}

}
