⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statusbean.java

📁 Java写的ERP系统
💻 JAVA
字号:
/******************************************************************************
 * The contents of this file are subject to the   Compiere License  Version 1.1
 * ("License"); You may not use this file except in compliance with the License
 * You may obtain a copy of the License at http://www.compiere.org/license.html
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * The Original Code is                  Compiere  ERP & CRM  Business Solution
 * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
 * Portions created by Jorg Janke are Copyright (C) 1999-2002 Jorg Janke, parts
 * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
 * Contributor(s): ______________________________________.
 *****************************************************************************/
package org.compiere.session;

import java.util.*;
import java.sql.*;

import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.FinderException;
import javax.ejb.RemoveException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

import org.apache.log4j.Logger;
import org.compiere.interfaces.*;

import org.compiere.Compiere;
import org.compiere.db.*;
import org.compiere.model.*;
import org.compiere.util.*;


/**
 * 	Compiere Status Bean
 *
 *  @ejb:bean name="compiere/Status"
 *           display-name="Compiere Status Session Bean"
 *           type="Stateless"
 *           transaction-type="Bean"
 *           jndi-name="ejb/compiere/Status"
 *
 *  @ejb:ejb-ref ejb-name="compiere/Status"
 *              ref-name="compiere/Status"
 *
 * 	@author 	Jorg Janke
 * 	@version 	$Id: StatusBean.java,v 1.7 2002/11/13 04:55:53 jjanke Exp $
 */
public class StatusBean implements SessionBean
{
	/**	Context					*/
	private SessionContext 		m_Context;
	/**	Logging					*/
	private transient Logger	log = Logger.getLogger(getClass());

	private static int		s_no = 0;
	private int				m_no = 0;
	//
	private int				m_versionCount = 0;
	private int				m_databaseCount = 0;


	/**
	 * 	Get Version (Date)
	 *  @ejb:interface-method view-type="remote"
	 *  @return version e.g. 2002-09-02
	 *  @throws RemoteException
	 */
	public String getDateVersion() throws RemoteException
	{
		m_versionCount++;
		log.info ("getDateVersion " + m_versionCount);
		return Compiere.DATE_VERSION;
	}	//	getDateVersion

	/**
	 * 	Get Main Version
	 *  @ejb:interface-method view-type="remote"
	 *  @return main version - e.g. Version 2.4.3b
	 *  @throws RemoteException
	 */
	public String getMainVersion() throws RemoteException
	{
		return Compiere.MAIN_VERSION;
	}	//	getMainVersion

	/**
	 *  Get Database Host
	 *  @ejb:interface-method view-type="remote"
	 *  @return Database Host Name
	 *  @throws RemoteException
	 */
	public String getDbHost() throws RemoteException
	{
		m_databaseCount++;
		log.info ("getDbHost " + m_databaseCount);
		return CConnection.get().getDbHost();
	}   //  getDbHost

	/**
	 *  Get Database Port
	 *  @ejb:interface-method view-type="remote"
	 *  @return Database Posrt
	 *  @throws RemoteException
	 */
	public int getDbPort() throws RemoteException
	{
		return CConnection.get().getDbPort();
	}   //  getDbPort

	/**
	 *  Get Database SID
	 *  @ejb:interface-method view-type="remote"
	 *  @return Database SID
	 *  @throws RemoteException
	 */
	public String getDbName() throws RemoteException
	{
		return CConnection.get().getDbName();
	}   //  getDbSID

	/**
	 *  Get Database UID
	 *  @ejb:interface-method view-type="remote"
	 *  @return Database User Name
	 *  @throws RemoteException
	 */
	public String getDbUid() throws RemoteException
	{
		return CConnection.get().getDbUid();
	}   //  getDbUID

	/**
	 *  Get Database PWD
	 *  @ejb:interface-method view-type="remote"
	 *  @return Database User Password
	 *  @throws RemoteException
	 */
	public String getDbPwd() throws RemoteException
	{
		return CConnection.get().getDbPwd();
	}   //  getDbPWD

	/**
	 *  Get Connection Manager Host
	 *  @ejb:interface-method view-type="remote"
	 *  @return Connection Manager Host
	 *  @throws RemoteException
	 */
	public String getFwHost() throws RemoteException
	{
		return CConnection.get().getFwHost();
	}   //  getCMHost

	/**
	 *  Get Connection Manager Port
	 *  @ejb:interface-method view-type="remote"
	 *  @return Connection Manager Port
	 *  @throws RemoteException
	 */
	public int getFwPort() throws RemoteException
	{
		return CConnection.get().getFwPort();
	}   //  getCMPort

	/*************************************************************************/

	/**
	 * 	Get Version Count
	 *  @ejb:interface-method view-type="remote"
	 * 	@return number of version inquiries
	 */
	public int getVersionCount()
	{
		return m_versionCount;
	}	//	getVersionCount

	/**
	 * 	Get Database Count
	 *  @ejb:interface-method view-type="remote"
	 * 	@return number of database inquiries
	 */
	public int getDatabaseCount()
	{
		return m_databaseCount;
	}	//	getVersionCount

	/**
	 * 	Describes the instance and its content for debugging purpose
	 *  @ejb:interface-method view-type="remote"
	 * 	@return Debugging information about the instance and its content
	 */
	public String getStatus()
	{
		StringBuffer sb = new StringBuffer("StatusBean[No=");
		sb.append(m_no)
			.append(",VersionCount=").append(m_versionCount)
			.append(",DatabaseCount=").append(m_versionCount)
			.append("]");
		return sb.toString();
	}	//	getStatus


	/**
	 * 	String Representation
	 * 	@return info
	 */
	public String toString()
	{
		return getStatus();
	}	//	toString

	/*************************************************************************/

	/**
	 * 	Create the Session Bean
	 * 	@throws CreateException
	 *  @ejb:create-method view-type="remote"
	 */
	public void ejbCreate() throws CreateException
	{
		m_no = ++s_no;
		log.info("ejbCreate " + m_no);
		try
		{
			org.compiere.Compiere.startupServer(new InitialContext());
		}
		catch (Exception ex)
		{
			log.error("ejbCreate", ex);
		//	throw new CreateException ();
		}
	}	//	ejbCreate


	// -------------------------------------------------------------------------
	// Framework Callbacks
	// -------------------------------------------------------------------------

	public void setSessionContext (SessionContext aContext) throws EJBException
	{
		m_Context = aContext;
	}

	public void ejbActivate() throws EJBException
	{
		if (log == null)
			log = Logger.getLogger(getClass());
		log.debug("ejbActivate");
	}

	public void ejbPassivate() throws EJBException
	{
		log.debug("ejbPassivate");
	}

	public void ejbRemove() throws EJBException
	{
		log.debug("ejbRemove");
	}

}	//	StatusBean

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -