package com.eactive.eai.control; //package com.eactive.eai.control; // //import javax.ejb.CreateException; //import javax.ejb.SessionBean; //import javax.ejb.SessionContext; //import javax.naming.Context; //import javax.naming.InitialContext; //import javax.naming.NamingException; //import javax.transaction.Transaction; //import javax.transaction.TransactionManager; //import weblogic.transaction.TxHelper; // //import weblogic.wtc.jatmi.TPException; //import weblogic.wtc.jatmi.TPReplyException; //import weblogic.wtc.jatmi.TypedCArray; //import weblogic.wtc.jatmi.Reply; //import weblogic.wtc.gwt.TuxedoConnectionFactory; //import weblogic.wtc.gwt.TuxedoConnection; //import weblogic.wtc.jatmi.ApplicationToMonitorInterface; // //public class TuxedoCArraySender { // private static final long serialVersionUID = 1L; // private int tpurcode; // private int tperrno; // // public int gettpurcode() { // return tpurcode; // } // // public int gettperrno() { // return tperrno; // } // // public byte[] service(String svcName, boolean isSync, boolean isXA, byte[] request) // throws TPException, TPReplyException { // Context ctx; // TuxedoConnectionFactory tcf = null; // TuxedoConnection tc = null; // TypedCArray tca; // Reply reply; // // //----------------------------------------------------------------- // // 1. Tuxedo의 TuxedoConnectionFactory를 생성한다. // //----------------------------------------------------------------- // try { // ctx = new InitialContext(); // tcf = (TuxedoConnectionFactory)ctx.lookup("tuxedo.services.TuxedoConnection"); // } catch (NamingException ne) { // // Could not get the tuxedo object, throw TPENOENT // throw new TPException(TPException.TPENOENT, // "Could not get TuxedoConnectionFactory : " + ne); // } // // Transaction tx = null; // // TransactionManager tm = null; // try { // //----------------------------------------------------------------- // // 1. TX Begin. // //----------------------------------------------------------------- // // Suspend Orginal transaction // tx = TxHelper.getTransactionManager().suspend(); // if(isXA) { // tm = (javax.transaction.TransactionManager) // ctx.lookup("javax.transaction.TransactionManager"); // tm.begin(); // } // // //----------------------------------------------------------------- // // 2. TUXEDO 서비스를 호출한다. // // 3. tpurcode를 확인해서 commit/rollback 한다. // //----------------------------------------------------------------- // tc = tcf.getTuxedoConnection(); // // int datasize = request.length; // tca = new TypedCArray(datasize); // tca.carray = request; // if(isSync) { // reply = tc.tpcall(svcName, tca, ApplicationToMonitorInterface.TPNOTRAN); // tca = (TypedCArray)reply.getReplyBuffer(); // if(tm != null) tm.commit(); // return (tca.carray); // } // else { // tc.tpacall(svcName, tca, ApplicationToMonitorInterface.TPNOREPLY); // return null; // } // // } catch (NamingException ne) { // try { if(tm != null) tm.rollback(); } catch(Exception e) { } // ne.printStackTrace(); // throw new TPException(TPException.TPENOENT, // "Could not get TuxedoConnectionFactory : " + ne); // } catch (TPReplyException tre) { // try { if(tm != null) tm.rollback(); } catch(Exception e) { } // tperrno = tre.gettperrno(); // tre.printStackTrace(); // throw tre; // } catch (TPException te) { // try { if(tm != null) tm.rollback(); } catch(Exception e) { } // tperrno = te.gettperrno(); // te.printStackTrace(); // throw te; // } catch (Exception ex) { // try { if(tm != null) tm.rollback(); } catch(Exception e) { } // ex.printStackTrace(); // throw new TPException(TPException.TPESYSTEM, "Exception: " + ex); // } // finally { // // Closing the association with Tuxedo // if(tc != null) tc.tpterm(); // // if(tx != null) { // try { // TxHelper.getTransactionManager().resume(tx); // } catch(Exception e) { // } // } // } // } // //}