Package eu.bandm.tools.d2d2.base
Class Main
java.lang.Object
eu.bandm.tools.d2d2.base.Main
D2d comand line tool, by static method
main(java.lang.String[])
.
Most executives for the different tasks of d2d are dislocated
as public static
methods into Tasks
, since they are also
called by programs. See there for complete use case information flow
diagrams.
Some transformations are implemeted in these both classes directly;
others are implemented de-centrally.
E.g. the reading of DTDs and .umod files as
ddf-s is done by the ModuleRegistry
"under the hood", when looking
for text format definitions.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
Set by the command line options.protected MessageReceiver<SimpleMessage<@Opt XMLDocumentIdentifier>>
Evidentprotected MessageCounter
Used for ending program execution early.static final OptionsGui
Service access point: prototype for gui-based client software. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
check_noKey
(Options options) Ensure that no key or keys option is given.protected void
checkKeyIsSet
(Options options, String txt) Check for option "-k/--key".protected void
Evidentprotected void
Evidentvoid
execute
(Options options, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg) Execute an Option model (mostly GUI-generated).boolean
Execute the CLI-parsed or GUI-generated Option model.Extract an input module name and an output file from the options (option --module and --outputfile).getKey_split
(Options options) Split the command line option "-k/--key" withsplitAndCheckKey(MessageReceiver,String)
.static Text2Udom.ErrorStrategy
initErrorStrategy
(int interactive, boolean partialDocs) Construct an eror strategy according to the command line options.protected Text2Udom.ErrorStrategy
initErrorStrategy
(Options options) Construct an eror strategy according to the command line options.protected ModuleRegistry
initModuleReg
(Options options) Construct a module registry according to the command line options.static ModuleRegistry
initModuleReg
(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, int tracelevel, Stream<String> libpath) Construct a module registry according to the command line options.static void
interpretCommandline
(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, String cli_text) Service access point: execute the value as if it were a command line suffix.protected void
Evidentprotected void
Evidentprotected void
Evidentstatic void
Create one instance, for messaging and option decoding, and callnonStatic_main(String[])
.protected String
Synthesize text for use in messages which indicates the selected "mode"void
nonStatic_interpretCommandline
(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, String cli_text) Simulate CLI input fFor programmatic use.protected void
nonStatic_main
(String[] args) Tool implementation: Decodes and checks the commandline options,protected void
Print all non-zero message numbers, per category and over all.Split one string according to the syntax[modulePath] (":"[ElementTag])?
.protected void
Evidentprotected void
Evidentprotected void
Evident
-
Field Details
-
msg_counter
Used for ending program execution early. -
debuglevel
protected int debuglevelSet by the command line options. Smaller than one suppresses all logging messages. Error messages are never suppressed. -
msg
Evident -
prototypeGui
Service access point: prototype for gui-based client software.
-
-
Constructor Details
-
Main
public Main()
-
-
Method Details
-
error
Evident -
error
Evident -
warning
Evident -
log
Evident -
logStart
Evident -
logEnd
Evident -
printErrorCounter
protected void printErrorCounter()Print all non-zero message numbers, per category and over all. -
terminateApplicationOnErrors_printUsage
protected void terminateApplicationOnErrors_printUsage()Evident -
terminateApplicationOnErrors
protected void terminateApplicationOnErrors()Evident -
modeText
Synthesize text for use in messages which indicates the selected "mode" -
get2names
Extract an input module name and an output file from the options (option --module and --outputfile). Raise error if not possible. -
check_noKey
Ensure that no key or keys option is given. -
splitAndCheckKey
@Opt public static @Opt String[] splitAndCheckKey(MessageReceiver<SimpleMessage<@Opt XMLDocumentIdentifier>> msg, String s) Split one string according to the syntax[modulePath] (":"[ElementTag])?
. Return one or two strings, or null in case of error. The first is always a definition module (mostly a dtd!). The second is the top-level element, used for identifying the "set of reachables". -
getKey_split
Split the command line option "-k/--key" withsplitAndCheckKey(MessageReceiver,String)
. Currently only used for ddf2xslt-mode.- Returns:
- an array of one or two strings, holding the target module and maybe the target top tag
-
checkKeyIsSet
Check for option "-k/--key". -
initModuleReg
public static ModuleRegistry initModuleReg(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, int tracelevel, Stream<String> libpath) Construct a module registry according to the command line options. -
initModuleReg
Construct a module registry according to the command line options. -
initErrorStrategy
Construct an eror strategy according to the command line options. -
initErrorStrategy
Construct an eror strategy according to the command line options. -
interpretCommandline
public static void interpretCommandline(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, String cli_text) Service access point: execute the value as if it were a command line suffix. -
nonStatic_interpretCommandline
public void nonStatic_interpretCommandline(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, String cli_text) Simulate CLI input fFor programmatic use. Esp. for tests. Does NOT decode the "--version" option, etc. -
main
Create one instance, for messaging and option decoding, and callnonStatic_main(String[])
. -
nonStatic_main
Tool implementation: Decodes and checks the commandline options, -
execute
Execute an Option model (mostly GUI-generated). -
execute
Execute the CLI-parsed or GUI-generated Option model. Sets up some global parameters, and calls the different worker methods. These are mostly inTasks
, for programmatic invokation.- Returns:
- whether the kind of error proposes to any cli-based caller to present the "usage()" in case of errors
-