ODE-1060: Check for home system property

Project: http://git-wip-us.apache.org/repos/asf/ode/repo
Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/6a3c0a58
Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/6a3c0a58
Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/6a3c0a58

Branch: refs/heads/master
Commit: 6a3c0a58445fdcd2422229a926feb921e41d4fff
Parents: 49b9a1a
Author: sathwik <[email protected]>
Authored: Wed Jun 28 18:11:54 2017 +0530
Committer: sathwik <[email protected]>
Committed: Wed Jun 28 18:11:54 2017 +0530

----------------------------------------------------------------------
 .../main/java/org/apache/ode/tomee/Main.java    | 37 +++++++++++---------
 1 file changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/6a3c0a58/tomee/src/main/java/org/apache/ode/tomee/Main.java
----------------------------------------------------------------------
diff --git a/tomee/src/main/java/org/apache/ode/tomee/Main.java 
b/tomee/src/main/java/org/apache/ode/tomee/Main.java
index 852e23c..71e9eb7 100644
--- a/tomee/src/main/java/org/apache/ode/tomee/Main.java
+++ b/tomee/src/main/java/org/apache/ode/tomee/Main.java
@@ -24,25 +24,30 @@ import java.io.File;
 public class Main {
     public static void main(String[] args) {
         String home = System.getProperty("ode.server.home");
-        final TomeeLauncher launcher = new TomeeLauncher(home);
-        try {
-            launcher.initialize();
-            launcher.start();
 
-            Runtime.getRuntime().addShutdownHook(new Thread() {
-                public void run() {
-                    try {
-                        launcher.stop();
-                        System.out.println("Continer stopped");
-                    } catch (final Exception e) {
-                        e.printStackTrace();
+        if(home != null) {
+            final TomeeLauncher launcher = new TomeeLauncher(home);
+            try {
+                launcher.initialize();
+                launcher.start();
+
+                Runtime.getRuntime().addShutdownHook(new Thread() {
+                    public void run() {
+                        try {
+                            launcher.stop();
+                            System.out.println("Continer stopped");
+                        } catch (final Exception e) {
+                            e.printStackTrace();
+                        }
                     }
-                }
-            });
+                });
 
-            launcher.deploy(new File(home,"webapps/ode"), "ode");
-        } catch (Exception e) {
-            e.printStackTrace();
+                launcher.deploy(new File(home,"webapps/ode"), "ode");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            System.out.println("Cannot start the container. Kindly set system 
property ode.server.home");
         }
     }
 }
\ No newline at end of file

Reply via email to