dain 2003/09/04 22:50:15
Modified: modules/core/src/java/org/apache/geronimo Main.java
Log:
Set the geronimo.home system property based on the boot location of the vm.
Revision Changes Path
1.18 +17 -7
incubator-geronimo/modules/core/src/java/org/apache/geronimo/Main.java
Index: Main.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/Main.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Main.java 5 Sep 2003 04:49:58 -0000 1.17
+++ Main.java 5 Sep 2003 05:50:15 -0000 1.18
@@ -59,6 +59,7 @@
import java.net.URL;
import java.util.Iterator;
import java.util.Set;
+import java.io.File;
import javax.management.MBeanServer;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
@@ -70,7 +71,7 @@
import org.apache.geronimo.common.StopWatch;
import org.apache.geronimo.common.propertyeditor.PropertyEditors;
-import org.apache.geronimo.common.net.protocol.Protocols;
+import org.apache.geronimo.common.net.protocol.Protocols;
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.geronimo.jmx.JMXKernel;
@@ -87,12 +88,21 @@
if (System.getProperty(LogFactoryImpl.LOG_PROPERTY) == null) {
System.setProperty(LogFactoryImpl.LOG_PROPERTY,
"org.apache.geronimo.common.log.log4j.CachingLog4jLog");
}
-
+
// Make the common URL protocol handlers available
Protocols.appendHandlerPackage("org.apache.geronimo.common.net.protocol");
// Make sure the property editor is initialized
PropertyEditors.getEditorSearchPath();
+
+ // Set the home directory based on the start location of the Java
process
+ if (System.getProperty("geronimo.home") == null) {
+ try {
+ System.setProperty("geronimo.home", (new
File(".")).getAbsoluteFile().toURL().toString());
+ } catch (MalformedURLException e) {
+ throw new AssertionError(e);
+ }
+ }
}
private static final Log log = LogFactory.getLog("Geronimo");
@@ -113,10 +123,10 @@
/**
* Main entry point
*/
- public void run()
+ public void run()
{
StopWatch watch = new StopWatch(true);
-
+
Object[] deployArgs = {bootURL};
JMXKernel kernel = null;
ShutdownThread hook = new ShutdownThread("Shutdown-Thread",
Thread.currentThread());
@@ -158,7 +168,7 @@
log.info("Deploying Bootstrap Services from " + bootURL);
MBeanServer mbServer = kernel.getMBeanServer();
mbServer.invoke(controllerName, "deploy", deployArgs,
DEPLOY_ARG_TYPES);
-
+
log.info("Started Server in " + watch.toDuration());
} catch (Throwable e) {
log.error("Error starting Server", e);
@@ -200,7 +210,7 @@
log.info("Shutdown complete");
}
}
-
+
static String GERONIMO_HOME =
System.getProperty("geronimo.home","file:.");
/**