public class Main extends Object implements Shell, Runnable
Executable
, in effect using it as the
entry point of a JVM application. The path to the document file can be
supplied as the first argument. If it's not supplied,
defaultDocumentName
is used instead.
The executable's standard output is directed to the system standard output. Note that this output is not captured or buffered, and sent directly as the executable runs.
executable
, document
, and application
are available as global services to executables. See
ExecutableService
, DocumentService
and
ApplicationService
.
Constructor and Description |
---|
Main(LanguageManager languageManager,
ParserManager parserManager,
File basePath,
boolean prepare,
String initialDocumentName,
String defaultDocumentName,
String preferredExtension,
String documentServiceName,
String applicationServiceName,
Writer writer,
Writer errorWriter,
String[] arguments)
Constructor.
|
Main(String[] arguments)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
flushWriters()
Tries to flush writers.
|
String |
getApplicationServiceName()
The name of the application service exposed to the executable.
|
String[] |
getArguments()
The arguments sent to
main(String[]) . |
String |
getDefaultDocumentName()
If the path to the document to run if not supplied as the first argument
to
main(String[]) , this is used instead. |
String |
getDocumentServiceName()
The name of the document service exposed to the executable.
|
Writer |
getErrorWriter()
The error writer to use for
ExecutionContext instances. |
ExecutionController |
getExecutionController()
An optional
ExecutionController to be used with executables. |
LanguageManager |
getLanguageManager()
The
LanguageManager used to get language adapters for
executables. |
CopyOnWriteArrayList<DocumentSource<Executable>> |
getLibrarySources()
The additional document sources to use.
|
Logger |
getLogger()
The logger.
|
ParserManager |
getParserManager()
The
ParserManager used to get parsers for executables. |
DocumentSource<Executable> |
getSource()
Used to load the executables.
|
Writer |
getWriter()
The writer to use for
ExecutionContext instances. |
boolean |
isPrepare()
Whether or not executables are prepared.
|
static void |
main(String[] arguments)
Delegates to an
Executable file specified by the first argument,
or to defaultDocumentName if not specified. |
void |
run() |
void |
setExecutionController(ExecutionController executionController) |
void |
setLogger(Logger logger) |
void |
setSource(DocumentSource<Executable> documentSource) |
public Main(String[] arguments)
arguments
- Supplied arguments (usually from a command line)public Main(LanguageManager languageManager, ParserManager parserManager, File basePath, boolean prepare, String initialDocumentName, String defaultDocumentName, String preferredExtension, String documentServiceName, String applicationServiceName, Writer writer, Writer errorWriter, String[] arguments)
languageManager
- The language managerparserManager
- The parser managerbasePath
- The base path for the document sourceprepare
- Whether to prepare the executablesinitialDocumentName
- The name of the document to rundefaultDocumentName
- The name to use for document names that point to a directory
rather than a file.preferredExtension
- An extension to prefer if more than one file with the same name is
in a directorydocumentServiceName
- The name of the document service exposed to the executableapplicationServiceName
- The name of the application service exposed to the executablewriter
- The writer used for ExecutionContext
instanceserrorWriter
- The error used for ExecutionContext
instancesarguments
- Supplied arguments (usually from a command line)public static void main(String[] arguments)
Executable
file specified by the first argument,
or to defaultDocumentName
if not specified.arguments
- Supplied arguments (usually from a command line)public String getDefaultDocumentName()
main(String[])
, this is used instead. Defaults to "instance".public Writer getWriter()
ExecutionContext
instances.public Writer getErrorWriter()
ExecutionContext
instances.public void setExecutionController(ExecutionController executionController)
executionController
- The execution controllergetExecutionController()
public void setSource(DocumentSource<Executable> documentSource)
documentSource
- The document sourcegetSource()
public String getDocumentServiceName()
public String getApplicationServiceName()
public void flushWriters()
getWriter()
,
getErrorWriter()
public String[] getArguments()
Shell
main(String[])
.getArguments
in interface Shell
public Logger getLogger()
Shell
getLogger
in interface Shell
Shell.setLogger(Logger)
public void setLogger(Logger logger)
setLogger
in interface Shell
logger
- The loggerShell.getLogger()
public LanguageManager getLanguageManager()
Shell
LanguageManager
used to get language adapters for
executables.getLanguageManager
in interface Shell
public ParserManager getParserManager()
Shell
ParserManager
used to get parsers for executables.getParserManager
in interface Shell
public boolean isPrepare()
Shell
public DocumentSource<Executable> getSource()
Shell
DocumentFileSource
set for the current directory, with no validity checking.public CopyOnWriteArrayList<DocumentSource<Executable>> getLibrarySources()
Shell
getLibrarySources
in interface Shell
public ExecutionController getExecutionController()
Shell
ExecutionController
to be used with executables.
Useful for exposing your own global variables to executables.getExecutionController
in interface Shell
Copyright © 2009-2015 Three Crickets LLC.