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

View File

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

View File

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

View File

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

View File

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

View File

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