1 25 26 package org.objectweb.jonas.jtests.beans.applimet; 27 28 import java.rmi.RemoteException ; 29 import java.sql.SQLException ; 30 import javax.ejb.CreateException ; 31 import javax.ejb.SessionBean ; 32 import javax.ejb.SessionContext ; 33 import org.objectweb.jonas.common.Log; 34 import org.objectweb.util.monolog.api.Logger; 35 import org.objectweb.util.monolog.api.BasicLevel; 36 37 39 public class MetSession implements SessionBean { 40 41 SessionContext ejbContext; 42 static protected Logger logger = null; 43 private Dao dao; 44 private Dao dao2; 45 46 public void ejbRemove() throws RemoteException { 47 logger.log(BasicLevel.DEBUG, ""); 48 try { 49 dao.removeConnexion(); 50 } catch (SQLException e) { 51 throw new RemoteException ("cannot remove Connexion: " + e); 52 } 53 } 54 55 public void ejbCreate() throws CreateException { 56 logger.log(BasicLevel.DEBUG, ""); 57 try { 58 dao = new Dao(); 59 } catch (Exception e) { 60 throw new CreateException ("Cannot create Dao: " + e); 61 } 62 } 63 64 public void methode1() throws RemoteException { 65 logger.log(BasicLevel.DEBUG, ""); 66 try { 67 String liste = dao.rechercherTousLesMarches(); 68 logger.log(BasicLevel.DEBUG, liste); 69 } catch (Exception e) { 70 throw new RemoteException ("Error calling Dao: " + e); 71 } 72 } 73 74 public void moscone1() throws java.rmi.RemoteException { 75 logger.log(BasicLevel.DEBUG, ""); 76 try { 77 dao2 = new Dao(); 78 dao2.rechercherTousLesMarches(); 79 dao2.removeConnexion(); 80 } catch (Exception e) { 81 throw new RemoteException ("Error on Dao2: " + e); 82 } 83 } 84 85 public void getconn() throws java.rmi.RemoteException { 86 logger.log(BasicLevel.DEBUG, ""); 87 try { 88 dao2 = new Dao(); 89 } catch (Exception e) { 90 throw new RemoteException ("Cannot create Dao: " + e); 91 } 92 } 93 94 public void getconntx() throws java.rmi.RemoteException { 95 logger.log(BasicLevel.DEBUG, ""); 96 try { 97 dao2 = new Dao(); 98 } catch (Exception e) { 99 throw new RemoteException ("Cannot create Dao: " + e); 100 } 101 } 102 103 public void useconn() throws java.rmi.RemoteException { 104 logger.log(BasicLevel.DEBUG, ""); 105 try { 106 String liste = dao2.rechercherTousLesMarches(); 107 logger.log(BasicLevel.DEBUG, liste); 108 } catch (Exception e) { 109 throw new RemoteException ("Error calling Dao: " + e); 110 } 111 } 112 113 public void closeconn() throws java.rmi.RemoteException { 114 logger.log(BasicLevel.DEBUG, ""); 115 try { 116 dao2.removeConnexion(); 117 } catch (SQLException e) { 118 throw new RemoteException ("cannot remove Connexion: " + e); 119 } 120 } 121 122 public void ejbActivate() { 123 logger.log(BasicLevel.DEBUG, ""); 124 } 125 126 public void ejbPassivate() { 127 logger.log(BasicLevel.DEBUG, ""); 128 } 129 130 public void setSessionContext(javax.ejb.SessionContext ctx) { 131 if (logger == null) { 132 logger = Log.getLogger(Log.JONAS_TESTS_PREFIX); 133 } 134 logger.log(BasicLevel.DEBUG, ""); 135 ejbContext = ctx; 136 } 137 138 public void unsetSessionContext() { 139 logger.log(BasicLevel.DEBUG, ""); 140 } 141 } 142 | Popular Tags |