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

📄 compierectrl.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.server;

import java.sql.*;

import org.jboss.system.ServiceMBeanSupport;
import org.apache.log4j.*;

import org.compiere.*;
import org.compiere.util.*;

/**
 *	Compiere Controller & Status Info for Dialnostics only
 *
 * 	@author 	Jorg Janke
 * 	@version 	$Id: CompiereCtrl.java,v 1.6 2003/01/20 05:42:38 jjanke Exp $
 */
public class CompiereCtrl extends ServiceMBeanSupport
	implements CompiereCtrlMBean
{

	/**
	 * 	Cosntructor
	 */
	public CompiereCtrl()
	{
	}	//	CompiereCtrl

	/**	DataSource Name		*/
	private String m_dataSourceName;

	/**
	 * 	Get Name
	 * 	@return Name
	 */
	public String getName()
	{
		return	NAME;
	}	//	getName

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

	/**
	 * 	Create Service
	 *  @throws Exception
	 */
	protected void createService() throws Exception
	{
		Ini.setClient (false);

		//	Set XML environment explicitly to standard 1.4.0 distribution
		System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
			"org.apache.crimson.jaxp.DocumentBuilderFactoryImpl");	//	System Default
		//	"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
		System.setProperty("javax.xml.parsers.SAXParserFactory",
			"org.apache.crimson.jaxp.SAXParserFactoryImpl");	//	System Default
		//	"org.apache.xerces.jaxp.SAXParserFactoryImpl");

	}	//	createService

	/**
	 * 	Start Service
	 *  @throws Exception
	 */
	protected void startService() throws Exception
	{
		Compiere.startupServer(null);
	}	//	startService

	/**
	 * 	Stop Service
	 */
	protected void stopService()
	{
	}	//	stopService

	/**
	 * 	Destroy Service
	 */
	protected void destroyService()
	{
	}	//	destroy Service

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

	/**
	 * 	Get Compiere Home
	 * 	@return Compiere Home
	 */
	public String getCompiereHome()
	{
		return Ini.getCompiereHome();
	}	//	getCompiereHome

	/**
	 * 	Get Compiere Summary
	 * 	@return Compiere Summary
	 */
	public String getCompiereSummary()
	{
		return Compiere.getSummary();
	}	//	getCompiereSummary

	/**
	 * 	Get Database Summary
	 * 	@return Database Summary
	 */
	public String getDatabaseSummary()
	{
		StringBuffer sb = new StringBuffer();
		try
		{
			DatabaseMetaData dbmd = DB.getConnectionRW().getMetaData();
			sb.append("Driver=").append(dbmd.getDriverName())
				.append(" Version: ").append(dbmd.getDriverVersion());
			sb.append(" - Database=").append(dbmd.getDatabaseProductName())
				.append(" Version: ").append(dbmd.getDatabaseProductVersion());
		}
		catch (SQLException ex)
		{
			sb.append(ex);
		}
		return sb.toString();
	}	//	getDatabaseSummary

	/**
	 * 	Get DataSource Name
	 * 	@return DataSource Name
	 */
	public String getDataSourceName()
	{
		return m_dataSourceName;
	}	//	getDataSourceName

	/**
	 * 	Set DataSource Name
	 * 	@param dataSourceName DataSource Name
	 */
	public void setDataSourceName (String dataSourceName)
	{
		m_dataSourceName = dataSourceName;
	}	//	setDataSourceName

	/**
	 * 	Set Log Trace Level
	 * 	@param traceLevel trace level
	 */
	public void setTraceLevel (int traceLevel)
	{
		Log.setTraceLevel(traceLevel);
		Ini.setProperty(Ini.P_DEBUGLEVEL, traceLevel);
		Ini.saveProperties(false);
	}	//	setTraceLevel

	/**
	 * 	Get Log Trace Level
	 * 	@return trace level
	 */
	public int getTraceLevel ()
	{
		return Log.getTraceLevel();
	}	//	getTraceLevel


	/**
	 * 	Get Log Level Info
	 * 	@return log Level Info
	 */
	public String getLogLevel()
	{
		Logger root = Logger.getRootLogger();
		return "Effective=" + root.getEffectiveLevel() + ", Level=" + root.getLevel();
	}

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

	/**
	 * 	String Representation
	 * 	@return info
	 */
	public String toString()
	{
		StringBuffer sb = new StringBuffer("Ctrl[");
		sb.append("");
		sb.append("]");
		return sb.toString();
	}	//	toString

}	//	Ctrl

⌨️ 快捷键说明

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