1 14 package org.compiere.session; 15 16 import java.util.*; 17 import java.sql.*; 18 19 import java.rmi.RemoteException ; 20 import javax.ejb.CreateException ; 21 import javax.ejb.EJBException ; 22 import javax.ejb.FinderException ; 23 import javax.ejb.RemoveException ; 24 import javax.ejb.SessionBean ; 25 import javax.ejb.SessionContext ; 26 import javax.naming.Context ; 27 import javax.naming.InitialContext ; 28 import javax.naming.NamingException ; 29 import javax.rmi.PortableRemoteObject ; 30 31 import org.apache.log4j.Logger; 32 import org.compiere.interfaces.*; 33 34 import org.compiere.Compiere; 35 import org.compiere.db.*; 36 import org.compiere.model.*; 37 import org.compiere.util.*; 38 39 40 55 public class StatusBean implements SessionBean 56 { 57 58 private SessionContext m_Context; 59 60 private transient Logger log = Logger.getLogger(getClass()); 61 62 private static int s_no = 0; 63 private int m_no = 0; 64 private int m_versionCount = 0; 66 private int m_databaseCount = 0; 67 68 69 75 public String getDateVersion() throws RemoteException 76 { 77 m_versionCount++; 78 log.info ("getDateVersion " + m_versionCount); 79 return Compiere.DATE_VERSION; 80 } 82 88 public String getMainVersion() throws RemoteException 89 { 90 return Compiere.MAIN_VERSION; 91 } 93 99 public String getDbHost() throws RemoteException 100 { 101 m_databaseCount++; 102 log.info ("getDbHost " + m_databaseCount); 103 return CConnection.get().getDbHost(); 104 } 106 112 public int getDbPort() throws RemoteException 113 { 114 return CConnection.get().getDbPort(); 115 } 117 123 public String getDbName() throws RemoteException 124 { 125 return CConnection.get().getDbName(); 126 } 128 134 public String getDbUid() throws RemoteException 135 { 136 return CConnection.get().getDbUid(); 137 } 139 145 public String getDbPwd() throws RemoteException 146 { 147 return CConnection.get().getDbPwd(); 148 } 150 156 public String getFwHost() throws RemoteException 157 { 158 return CConnection.get().getFwHost(); 159 } 161 167 public int getFwPort() throws RemoteException 168 { 169 return CConnection.get().getFwPort(); 170 } 172 173 174 179 public int getVersionCount() 180 { 181 return m_versionCount; 182 } 184 189 public int getDatabaseCount() 190 { 191 return m_databaseCount; 192 } 194 199 public String getStatus() 200 { 201 StringBuffer sb = new StringBuffer ("StatusBean[No="); 202 sb.append(m_no) 203 .append(",VersionCount=").append(m_versionCount) 204 .append(",DatabaseCount=").append(m_versionCount) 205 .append("]"); 206 return sb.toString(); 207 } 209 210 214 public String toString() 215 { 216 return getStatus(); 217 } 219 220 221 226 public void ejbCreate() throws CreateException 227 { 228 m_no = ++s_no; 229 log.info("ejbCreate " + m_no); 230 try 231 { 232 org.compiere.Compiere.startupServer(new InitialContext ()); 233 } 234 catch (Exception ex) 235 { 236 log.error("ejbCreate", ex); 237 } 239 } 241 242 246 public void setSessionContext (SessionContext aContext) throws EJBException 247 { 248 m_Context = aContext; 249 } 250 251 public void ejbActivate() throws EJBException 252 { 253 if (log == null) 254 log = Logger.getLogger(getClass()); 255 log.debug("ejbActivate"); 256 } 257 258 public void ejbPassivate() throws EJBException 259 { 260 log.debug("ejbPassivate"); 261 } 262 263 public void ejbRemove() throws EJBException 264 { 265 log.debug("ejbRemove"); 266 } 267 268 } | Popular Tags |