retrieve and init vamsas session from vdoc at URL
[jalview.git] / src / jalview / bin / Jalview.java
index a2ef369..ed51cee 100755 (executable)
@@ -86,9 +86,9 @@ public class Jalview
                       + "-nousagestats\tTurn off google analytics tracking for this session.\n"
                       + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
 //                      + "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)"
-                      + "-dasserver nickname=URL\tAdd and enable a das server with given nickname (alphanumeric or underscores only) for retrieval of features for all alignments.\n"
-                      +"\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
-                      +"\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
+                      + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n"
+                      +"\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
+                      +"\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
                       + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
 //                      + "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
 //                      + "-vses vamsas-session\tJoin session with given URN\n"
@@ -219,9 +219,14 @@ public class Jalview
       boolean inSession = false;
       if (vamsasImport!=null)
       {
-        try {
-          inSession = desktop.vamsasImport(new File(vamsasImport));
-            
+          try {
+            String viprotocol = Jalview.checkProtocol(vamsasImport);
+            if (viprotocol == jalview.io.FormatAdapter.FILE) {
+              inSession = desktop.vamsasImport(new File(vamsasImport));
+            } else if (viprotocol == jalview.io.FormatAdapter.URL) {
+              inSession = desktop.vamsasImport(new URL(vamsasImport));
+            }
+          
           } catch (Exception e)
           {
             System.err.println("Exeption when importing "+vamsasImport+" as a vamsas document.");
@@ -231,8 +236,8 @@ public class Jalview
             System.err.println("Failed to import "+vamsasImport+" as a vamsas document.");
           } else {
             System.out.println("Imported Successfully into new session "+desktop.getVamsasApplication().getCurrentSession());
-        }
-      } 
+          }
+      }
       if (vamsasSession!=null) {
         if (vamsasImport!=null) {
        // close the newly imported session and import the Jalview specific remnants into the new session later on.