*/
package jalview.bin;
+import java.awt.GraphicsEnvironment;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.ws.jws2.Jws2Discoverer;
-//import netscape.javascript.JSObject;
/**
* Main class for Jalview Application <br>
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;
System.setSecurityManager(null);
}
+ /*
+ * @j2sNative J2S.db._DirectDatabaseCalls["compbio.dundee.ac.uk"]=null;
+ * @j2sNative J2S.db._DirectDatabaseCalls["jalview.org"]=null;
+ *
+ */
System.out
.println("Java version: " + System.getProperty("java.version"));
System.out.println("Java Home: " + System.getProperty("java.home"));
showUsage();
System.exit(0);
}
- // ?>>
+ // BH note: Only -nodisplay is official; others are deprecated?
if (aparser.contains("nodisplay") || aparser.contains("nogui")
- || aparser.contains("headless"))
+ || aparser.contains("headless")
+ || GraphicsEnvironment.isHeadless())
{
- System.setProperty("java.awt.headless", "true");
+ if (!isJS) {
+ // BH Definitely not a good idea in JavaScript;
+ // probably should not be here for Java, either.
+ System.setProperty("java.awt.headless", "true");
+ }
headless = true;
}
- // <<?
-
- // anything else!
final String jabawsUrl = aparser.getValue(ArgsParser.JABAWS);
allowServices = !("none".equals(jabawsUrl));
}
defs = aparser.getValue("setprop");
}
- if (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true"))
- {
- headless = true;
- }
System.setProperty("http.agent",
"Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
try
System.out.println("Error setting Taskbar: " + t.getMessage());
}
desktop.setVisible(true);
-
+ if (Platform.isJS())
+ Cache.setProperty("SHOW_JWS2_SERVICES", "false");
+ if (allowServices)
+ {
+ desktop.startServiceDiscovery();
+ }
if (!isJS)
/**
* Java only
* @j2sIgnore
*/
{
- if (allowServices)
- desktop.startServiceDiscovery();
if (!aparser.contains("nousagestats"))
{
startUsageStats(desktop);
createOutputFiles(aparser, format);
}
}
+ if (headless)
+ {
+ af.getViewport().getCalcManager().shutdown();
+ }
}
// extract groovy arguments before anything else.
// Once all other stuff is done, execute any groovy scripts (in order)
* @param aparser
* @param format
*/
- private void createOutputFiles(ArgsParser aparser,
- FileFormatI format)
+ private void createOutputFiles(ArgsParser aparser, FileFormatI format)
{
AlignFrame af = currentAlignFrame;
while (aparser.getSize() >= 2)
System.out.println(
"Creating image map: " + imageFile.getAbsolutePath());
continue;
- }
- if (!Platform.isJS()) /** @j2sIgnore */
- {
- // skipping outputFormat?
- System.out.println("Unknown arg: " + outputFormat);
- fname = new File(aparser.nextValue()).getAbsolutePath();
- af.saveAlignment(fname, format);
- if (af.isSaveAlignmentSuccessful())
+ default:
+ // fall through - try to parse as an alignment data export format
+ FileFormatI outFormat = null;
+ try
+ {
+ outFormat = FileFormats.getInstance().forName(outputFormat);
+ } catch (Exception formatP)
+ {
+ }
+ if (outFormat == null)
+ {
+ System.out.println("Couldn't parse " + outputFormat
+ + " as a valid Jalview format string.");
+ continue;
+ }
+ if (!outFormat.isWritable())
{
System.out.println(
- "Written alignment in " + format + " format to " + fname);
+ "This version of Jalview does not support alignment export as "
+ + outputFormat);
+ continue;
+ }
+ // record file as it was passed to Jalview so it is recognisable to the CLI
+ // caller
+ String file;
+ fname = new File(file = aparser.nextValue()).getAbsolutePath();
+ // JBPNote - yuck - really wish we did have a bean returned from this which gave
+ // success/fail like before !
+ af.saveAlignment(fname, outFormat);
+ if (!af.isSaveAlignmentSuccessful())
+ {
+ System.out.println("Written alignment in " + outputFormat
+ + " format to " + file);
+ continue;
}
else
{
- System.out.println("Error writing file " + fname + " in " + format
- + " format!!");
+ System.out.println("Error writing file " + file + " in "
+ + outputFormat + " format!!");
}
}
- break;
}
+ // ??? Should report - 'ignoring' extra args here...
while (aparser.getSize() > 0)
{
- System.out.println("Unknown arg: " + aparser.nextValue());
+ System.out.println("Ignoring extra argument: " + aparser.nextValue());
}
}