Don't start server if Adempiere.properties doesn't exists.

This commit is contained in:
Heng Sin Low 2010-11-04 03:54:17 +08:00
parent 470a5235a3
commit 3ce2d30129
1 changed files with 10 additions and 2 deletions

View File

@ -1,13 +1,15 @@
/**
*
*
*/
package org.adempiere.server;
import java.io.File;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.ServerContext;
import org.compiere.Adempiere;
import org.compiere.util.Ini;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
@ -25,6 +27,12 @@ public class Application implements IApplication {
/** Initialise context for the current thread*/
Properties serverContext = new Properties();
ServerContext.setCurrentInstance(serverContext);
String propertyFile = Ini.getFileName(false);
File file = new File(propertyFile);
if (!file.exists()) {
throw new IllegalStateException("Adempiere.properties file missing. Path="+file.getAbsolutePath());
}
if (!Adempiere.isStarted())
{
boolean started = Adempiere.startup(false);
@ -33,7 +41,7 @@ public class Application implements IApplication {
throw new AdempiereException("Could not start ADempiere");
}
}
return IApplication.EXIT_OK;
}