|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.wiki.plugin.util.CommandLineParser
public class CommandLineParser
The CommandLineParser provides a plugin command line parser that also provides parsing of the "body" as a balanced query or assertion expression. It accepts either an existing parameter Map or a "{}" delimited plugin command line. All methods are static.
Parses the initial, required part of the plugin command line with four permitted variants:
'[{XYZ name='value' [Monster] eats [Sandwich]}]'
or: '[{XYZPlugin name='value' [Monster] eats [Sandwich]}]'
or: '[{java.package.path.XYZPlugin name='value' [Monster] eats [Sandwich]}]'
or: '[{INSERT java.package.path.XYZPlugin name='value' [Monster] eats [Sandwich]}]'
NOTE: This doesn't actually validate the plugin identifier because we can safely assume it must match one of the forms of the plugin name or it wouldn't have been called in the first place.
A parameter Map containing the name-value pairs, where each element in the
Map can be obtained via the Map.get(Object) method. In
addition to the named elements, there are two additional outputs:
| Field Summary | |
|---|---|
static String |
PARAM_BODY
The identifier for the body parameter, _body. |
static String |
PARAM_EXPRESSION
The identifier for the expression parameter, _expression. |
| Fields inherited from interface org.ceryle.wiki.plugin.util.PluginConstants |
|---|
ACL, AOP, APOS_ENT, ASTERISK, BCL, BOP, BR, CAPCL, CAPOP, CLATT, COLON, COMMA, DIV_class, DIV_style, DIVCL, DOT, EQ, EQQUO, EQSQUO, FALSE, FORMCL, FORMOP, GET, ICL, INPUTOP, IOP, LABELCL, LABELFOR, LABELOP, LCURL, LICL, LIOP, LPAR, LSBR, MT, NBSP, NL, OLCL, OLOP, P_class, PCL, PLUGCL, PLUGO, POP, POST, QUO, QUOCL, QUOETCL, RCURL, RPAR, RSBR, SEMI, SP, SPAN_class, SPANCL, SPANOP, SQUO, TABLECL, TABLEOP, TDCL, TDOP, THCL, THOP, TRCL, TROP, TRUE, TTCL, TTOP, ULCL, ULOP, UNDER |
| Constructor Summary | |
|---|---|
CommandLineParser()
|
|
| Method Summary | |
|---|---|
static Map |
parse(WikiEngine engine,
Map params)
Process the incoming parameter Map map, returning a newly-parsed replacement parameter Map. |
static Map |
parse(WikiEngine engine,
String commandline)
Process the incoming plugin command line commandline, creating a parameter Map that includes both a _body parameter containing all post-argument content as a String, and a _expression parameter, a balanced Stack of tokens. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PARAM_BODY
public static final String PARAM_EXPRESSION
| Constructor Detail |
|---|
public CommandLineParser()
| Method Detail |
|---|
public static Map parse(WikiEngine engine,
Map params)
throws PluginException
engine - the WikiEngine providing support to the plugin.params - the incoming parameter Map containing the _cmdline parameter source
PluginException - if a parsing error occursparse(WikiEngine,String)
public static Map parse(WikiEngine engine,
String commandline)
throws PluginException
engine - the WikiEngine providing support to the plugin.commandline - the incoming command line to be parsed
PluginException - if a parsing error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||