This class provides methods to access procedure parameters, config values and process the output of a step result from the current run context.
getRuntimeParameters()
A simplified accessor for the step parameters and config values. This method returns a StepParameters instance built from parameters and config values.
Usage
Assume procedure form.xml contains 'query' and 'location' parameters and config contains 'credential', 'proxy_credential', 'contentType' and 'userAgent'. See this snippet as to how you can retrieve runtime parameters.
StepParameters simpleParams = context.getRuntimeParameters()
Now, you can access both configuration and step parameters from a single object:
// Step parameters String query = simpleParams.getParameter('query').getValue() String location = simpleParams.getParameter('location').getValue() // Config values String contentType = simpleParams.getParameter('contentType').getValue() String userAgent = simpleParams.getParameter('userAgent').getValue() Credential cred = simpleParams.getCredential('credential') Credential proxyCred = simpleParams.getCredential('proxy_credential')
Or:
Map paramsMap = context.getRuntimeParameters().getAsMap() // Step parameters String query = paramsMap['query'] String location = paramsMap['location'] // Config values String contentType = paramsMap['contentType'] String userAgent = paramsMap['userAgent'] Credential cred = paramsMap['credential'] Credential proxyCred = paramsMap['proxy_credential']
getStepParameters()
Returns a StepParameters object which can be used to access current step parameters. This method does not require parameters.
getConfigValues()
This method returns a Config object, which represents plugin configuration. This method does not require parameters.
newStepResult()
This method returns a StepResult object which can be used to process the output returned by a procedure or pipeline stage.
newRESTClient()
Initializes a REST object, providing the configuration values to it.
For now, this method supports following components and tools:
-
- Proxy
-
Proxy can be automatically be enabled by making sure that following parameters are present in the configuration: +
-
credential with the proxy_credential name.
-
regular parameter with httpProxyUrl name + If configuration has all fields above, the proxy parameters will be set on the HTTPBuilder instance. If the 'proxy_credential' is not empty, the 'Proxy-Authorization' header will be added to every request.
-
-
Basic Authorization Basic authorization can be automatically applied to all REST requests. In order to enable it make sure that the following parameters are present in your plugin configuration:
-
'authScheme' parameter with value "basic"
-
credential with name "basic_credential"
-