JAL-3690 Let's enable web services (seriously this time)
[jalview.git] / src / jalview / bin / Jalview.java
index cdd8cc1..1b72940 100755 (executable)
@@ -112,21 +112,21 @@ public class Jalview
      */
     {
       // grab all the rights we can for the JVM
-           Policy.setPolicy(new Policy()
-           {
-             @Override
-             public PermissionCollection getPermissions(CodeSource codesource)
-             {
-               Permissions perms = new Permissions();
-               perms.add(new AllPermission());
-               return (perms);
-             }
-       
-             @Override
-             public void refresh()
-             {
-             }
-           });
+      Policy.setPolicy(new Policy()
+      {
+        @Override
+        public PermissionCollection getPermissions(CodeSource codesource)
+        {
+          Permissions perms = new Permissions();
+          perms.add(new AllPermission());
+          return (perms);
+        }
+  
+        @Override
+        public void refresh()
+        {
+        }
+      });
     }
   }
 
@@ -139,8 +139,8 @@ public class Jalview
   class FeatureFetcher
   {
     /*
-     * TODO: generalise to track all jalview events to orchestrate batch processing
-     * events.
+     * TODO: generalise to track all jalview events to orchestrate batch
+     * processing events.
      */
 
     private int queued = 0;
@@ -202,14 +202,14 @@ public class Jalview
    */
   public static void main(String[] args)
   {
-//     setLogging(); // BH - for event debugging in JavaScript
+//  setLogging(); // BH - for event debugging in JavaScript
     instance = new Jalview();
     instance.doMain(args);
 }
 
   private static void logClass(String name) 
-  {    
-         // BH - for event debugging in JavaScript
+  {  
+    // BH - for event debugging in JavaScript
       ConsoleHandler consoleHandler = new ConsoleHandler();
       consoleHandler.setLevel(Level.ALL);
       Logger logger = Logger.getLogger(name);
@@ -229,21 +229,21 @@ public class Jalview
       System.out.println("not in js");
     }
 
-         // BH - for event debugging in JavaScript (Java mode only)
+    // BH - for event debugging in JavaScript (Java mode only)
     if (!Platform.isJS())
     /**
      * Java only
      * 
      * @j2sIgnore
      */
-       {
-               Logger.getLogger("").setLevel(Level.ALL);
+    {
+      Logger.getLogger("").setLevel(Level.ALL);
         logClass("java.awt.EventDispatchThread");
         logClass("java.awt.EventQueue");
         logClass("java.awt.Component");
         logClass("java.awt.focus.Component");
         logClass("java.awt.focus.DefaultKeyboardFocusManager"); 
-       }       
+    }  
 
   }
   
@@ -439,6 +439,9 @@ public class Jalview
       }
 
       desktop.setVisible(true);
+      if (Platform.isJS())
+        Cache.setProperty("SHOW_JWS2_SERVICES", "false");
+      desktop.startServiceDiscovery();
 
       if (!Platform.isJS())
       /**
@@ -447,7 +450,6 @@ public class Jalview
        * @j2sIgnore
        */
       {
-        desktop.startServiceDiscovery();
         if (!aparser.contains("nousagestats"))
         {
           startUsageStats(desktop);
@@ -774,6 +776,10 @@ public class Jalview
           System.out.println("Unknown arg: " + aparser.nextValue());
         }
       }
+      if (headless)
+      {
+        af.getViewport().getCalcManager().shutdown();
+      }
     }
     AlignFrame startUpAlframe = null;
     // We'll only open the default file if the desktop is visible.