public abstract class AbstractLanguageLauncher extends Launcher
Launcher.AbortException, Launcher.VersionAction, Launcher.VMType
Modifier and Type | Field and Description |
---|---|
protected static boolean |
IS_LIBPOLYGLOT |
Constructor and Description |
---|
AbstractLanguageLauncher() |
Modifier and Type | Method and Description |
---|---|
protected Launcher.AbortException |
abortUnrecognizedArgument(String argument)
This is called to abort execution when an argument can neither be recognized by the launcher
or as an option for the polyglot engine.
|
protected String[] |
getDefaultLanguages()
The return value specifies what languages should be available by default when not using
polyglot.
|
protected abstract String |
getLanguageId()
Returns the language id of the language launched by this
launcher.
|
protected abstract void |
launch(org.graalvm.polyglot.Context.Builder contextBuilder)
Launch the scripts as required by the arguments received during the previous call to
AbstractLanguageLauncher.preprocessArguments(List, Map) . |
protected void |
launch(String[] args)
This starts the launcher.
|
protected abstract List<String> |
preprocessArguments(List<String> arguments,
Map<String,String> polyglotOptions)
Process command line arguments by either saving the necessary state or adding it to the
polyglotOptions . |
protected void |
printVersion()
Prints version information on stdout.
|
protected void |
printVersion(org.graalvm.polyglot.Engine engine) |
protected void |
runVersionAction(Launcher.VersionAction action,
org.graalvm.polyglot.Engine engine) |
protected void |
validateArguments(Map<String,String> polyglotOptions)
Validates arguments after all arguments have been parsed.
|
abort, abort, abort, abort, abort, abort, abortInvalidArgument, abortInvalidArgument, collectArguments, exit, exit, getDefaultVMType, getMainClass, isAOT, isGraalVMAvailable, printHelp, printPolyglotVersions
protected final void launch(String[] args)
public static void main(String[] args) { new MyLauncher().launch(args); }
args
- the command line arguments.protected Launcher.AbortException abortUnrecognizedArgument(String argument)
argument
- the argument that was not recognized.protected abstract List<String> preprocessArguments(List<String> arguments, Map<String,String> polyglotOptions)
polyglotOptions
. Any unrecognized arguments should be accumulated and returned as a
list.
Arguments that are translated to polyglot options should be removed from the list. Other
arguments should not be removed.arguments
- the command line arguments that were passed to the launcher.polyglotOptions
- a map where polyglot options can be set. These will be uses when
creating the Engine
.protected void validateArguments(Map<String,String> polyglotOptions)
polyglotOptions
- the options that will be used to create engine.protected abstract void launch(org.graalvm.polyglot.Context.Builder contextBuilder)
AbstractLanguageLauncher.preprocessArguments(List, Map)
.contextBuilder
- a context builder configured with the
proper language and polyglot options.protected abstract String getLanguageId()
protected void printVersion()
Launcher
printVersion
in class Launcher
protected void printVersion(org.graalvm.polyglot.Engine engine)
protected void runVersionAction(Launcher.VersionAction action, org.graalvm.polyglot.Engine engine)
protected String[] getDefaultLanguages()