public class GogoCommands extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
GogoCommands.Options
Options for a pipe execution
|
protected class |
GogoCommands.Token
Pipe token, used to hold information of a "sub pipe" configuration
|
Modifier and Type | Field and Description |
---|---|
protected static String |
INPUT |
protected static String |
KEY_EXPR |
protected static String |
KEY_NAME |
protected static String |
KEY_PATH |
protected static String |
KEY_VALUE_SEP |
protected static String |
PARAMS |
protected static String |
SEPARATOR |
Constructor and Description |
---|
GogoCommands() |
Modifier and Type | Method and Description |
---|---|
void |
build(String... cmds)
build command handler
|
protected void |
computeMaps()
builds utility maps
|
void |
execute(String path,
String... options)
execute command handler
|
protected ExecutionResult |
executeInternal(org.apache.sling.api.resource.ResourceResolver resolver,
String path,
String... optionTokens)
internal execution command handler
|
protected void |
finishToken(GogoCommands.Token currentToken,
List<String> currentList)
ends up processing of current token
|
protected Map<String,PipeExecutor> |
getExecutorMap() |
protected Map<String,Method> |
getMethodMap() |
protected GogoCommands.Options |
getOptions(List<String> tokens) |
protected GogoCommands.Options |
getOptions(String[] tokens) |
void |
help()
help command handler
|
protected boolean |
isConfExpected(Method method) |
protected boolean |
isExpressionExpected(Method method) |
protected boolean |
isWithoutExpectedParameter(Method method) |
protected PipeBuilder |
parse(org.apache.sling.api.resource.ResourceResolver resolver,
String... cmds) |
protected List<GogoCommands.Token> |
parseTokens(String... commands) |
void |
run(String... cmds)
run command handler
|
protected static final String SEPARATOR
protected static final String PARAMS
protected static final String INPUT
protected static final String KEY_VALUE_SEP
protected static final String KEY_NAME
protected static final String KEY_PATH
protected static final String KEY_EXPR
public void run(String... cmds) throws Exception
cmds
- string tokens coming with run commandException
- in case anything went wrongpublic void build(String... cmds) throws Exception
cmds
- string tokens coming with build commandException
- in case anything went wrongpublic void execute(String path, String... options) throws Exception
path
- pipe pathoptions
- string tokens coming with run commandException
- in case anything went wrongprotected ExecutionResult executeInternal(org.apache.sling.api.resource.ResourceResolver resolver, String path, String... optionTokens) throws Exception
resolver
- resolver with which pipe will be executedpath
- pipe path to execute, INPUT
for getting last token's output as path for things like build some / pipe | execute -optionTokens
- different options tokensException
- exception in case something goes wrongpublic void help()
protected PipeBuilder parse(org.apache.sling.api.resource.ResourceResolver resolver, String... cmds) throws InvocationTargetException, IllegalAccessException
resolver
- resource resolver with which pipe will build the pipecmds
- list of commands for building the pipeInvocationTargetException
- can happen in case the mapping with PB api went wrongIllegalAccessException
- can happen in case the mapping with PB api went wrongprotected void computeMaps()
protected Map<String,PipeExecutor> getExecutorMap()
protected boolean isExpressionExpected(Method method)
method
- corresponding PB apiprotected boolean isConfExpected(Method method)
method
- corresponding PB apiprotected boolean isWithoutExpectedParameter(Method method)
method
- corresponding PB apiprotected List<GogoCommands.Token> parseTokens(String... commands)
commands
- full list of command tokensprotected void finishToken(GogoCommands.Token currentToken, List<String> currentList)
currentToken
- token being processedcurrentList
- list of argument that have been collected so farprotected GogoCommands.Options getOptions(String[] tokens)
tokens
- array of tokensprotected GogoCommands.Options getOptions(List<String> tokens)
tokens
- list of toeknsCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.