* Remove client activator, not needed.

* Delay create of logger for Ini until CLogMgt have been properly init.
* Added method to Adempiere to check whether the platform have been started.
This commit is contained in:
Heng Sin Low 2010-07-20 01:00:24 +08:00
parent de964d5180
commit 912afccfe0
7 changed files with 14 additions and 39 deletions

View File

@ -455,6 +455,11 @@ public final class Adempiere
return url.getHost();
} // getCodeBase
public static synchronized boolean isStarted()
{
return (log != null);
}
/*************************************************************************
* Startup Client/Server.
* - Print greeting,
@ -477,6 +482,7 @@ public final class Adempiere
System.exit(1);
Ini.setClient (isClient); // init logging in Ini
CLogMgt.initialize(isClient);
// Init Log
log = CLogger.getCLogger(Adempiere.class);
// Greeting

View File

@ -88,7 +88,7 @@ public class GridTable extends AbstractTableModel
implements Serializable
{
/**
*
* generated
*/
private static final long serialVersionUID = 7799823493936826600L;

View File

@ -276,6 +276,7 @@ public class CLogFile extends Handler
//
if (record.getLevel() == Level.SEVERE
|| record.getLevel() == Level.WARNING
|| record.getLevel() == Level.OFF
|| m_records % 10 == 0) // flush every 10 records
flush();
}

View File

@ -275,6 +275,7 @@ public class CLogMgt
return;
Logger rootLogger = Logger.getLogger(getRootLoggerName());
rootLogger.setUseParentHandlers(false);
rootLogger.setLevel(level);
Handler[] handlers = rootLogger.getHandlers();
if (handlers == null || handlers.length == 0)
{
@ -286,6 +287,7 @@ public class CLogMgt
{
handlers[i].setLevel(level);
}
// JDBC if ALL
setJDBCDebug(level.intValue() == Level.ALL.intValue());
//

View File

@ -234,7 +234,7 @@ public final class Ini implements Serializable
private static String s_propertyFileName = null;
/** Logger */
private static Logger log = Logger.getLogger(Ini.class.getName());
private static Logger log = null;
/**
* Save INI parameters to disk
@ -284,6 +284,7 @@ public final class Ini implements Serializable
*/
public static void loadProperties (boolean reload)
{
log = Logger.getLogger(Ini.class.getName());
if (reload || s_prop.size() == 0)
{
if (isWebStartClient())
@ -690,7 +691,7 @@ public final class Ini implements Serializable
public static final String ADEMPIERE_HOME = "ADEMPIERE_HOME";
/** IsClient Internal marker */
private static boolean s_client = true;
private static boolean s_client = false;
/** IsClient Internal marker */
private static boolean s_loaded = false;
/** Show license dialog for first time **/
@ -711,8 +712,7 @@ public final class Ini implements Serializable
*/
public static void setClient (boolean client)
{
s_client = client;
CLogMgt.initialize(client);
s_client = client;
} // setClient
/**

View File

@ -24,7 +24,6 @@ Export-Package: de.schaeffer.compiere.tools,
org.eevolution.form
Require-Bundle: org.adempiere.base;bundle-version="1.0.0",
org.adempiere.tools;bundle-version="1.0.0"
Bundle-Activator: org.adempiere.client.Activator
Eclipse-ExtensibleAPI: true
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.core.runtime;version="3.4.0",

View File

@ -1,33 +0,0 @@
package org.adempiere.client;
import org.compiere.util.CLogger;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
public class Activator extends Plugin {
private static final String ADMEPIERE_PREFIX = "org.adempiere";
private static CLogger log = CLogger.getCLogger(Activator.class);
@Override
public void start(BundleContext context) throws Exception {
activateAll(context.getBundles());
}
private void activateAll(Bundle[] bundles) {
for (Bundle bundle : bundles) {
if (shouldStart(bundle))
try {
bundle.start();
log.info("Started "+bundle.getSymbolicName());
} catch (BundleException e) {
log.warning("Could not start "+bundle.getSymbolicName());
}
}
}
private boolean shouldStart(Bundle bundle) {
return bundle.getSymbolicName().startsWith(ADMEPIERE_PREFIX);
}
}