Package org.astrogrid.samp
Class JSamp
- java.lang.Object
-
- org.astrogrid.samp.JSamp
-
public class JSamp extends java.lang.ObjectConvenience class for invoking JSAMP command-line applications.- Since:
- 23 Jul 2008
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String[]COMMAND_CLASSESKnown command class names.
-
Constructor Summary
Constructors Modifier Constructor Description privateJSamp()Private sole constructor prevents instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.Stringabbrev(java.lang.String className)Returns the abbreviated form of a given class name.private static java.lang.StringformatImpls(java.lang.Object[] options, java.lang.Class clazz)(package private) static java.lang.reflect.MethodgetMainMethod(java.lang.Class clazz)Returns themain(String[])method for a given class.private static java.lang.StringgetVersionText()Returns a string giving version details for this package.static voidmain(java.lang.String[] args)Main method.private static intrunCommand(java.lang.String className, java.lang.String[] args)Runs a command.static intrunMain(java.lang.String[] args)Does the work for the main method.private static voidsetDefaultProperty(java.lang.String key, java.lang.String value)Sets a system property to a given value unless it has already been set.
-
-
-
Method Detail
-
runMain
public static int runMain(java.lang.String[] args)
Does the work for the main method.
-
runCommand
private static int runCommand(java.lang.String className, java.lang.String[] args)Runs a command.- Parameters:
className- name of a class with amain(String[])methodargs- arguments as if passed from the command line
-
getMainMethod
static java.lang.reflect.Method getMainMethod(java.lang.Class clazz)
Returns themain(String[])method for a given class.
-
abbrev
private static java.lang.String abbrev(java.lang.String className)
Returns the abbreviated form of a given class name.- Parameters:
className- class name- Returns:
- abbreviation
-
formatImpls
private static java.lang.String formatImpls(java.lang.Object[] options, java.lang.Class clazz)
-
getVersionText
private static java.lang.String getVersionText()
Returns a string giving version details for this package.- Returns:
- version string
-
setDefaultProperty
private static void setDefaultProperty(java.lang.String key, java.lang.String value)Sets a system property to a given value unless it has already been set. If it has a prior value, that is undisturbed. Potential security exceptions are caught and dealt with.- Parameters:
key- property namevalue- suggested property value
-
main
public static void main(java.lang.String[] args)
Main method. Use -help flag for documentation.
-
-