public class PipeBindings extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
PipeBindings.JsDate
interface mapping a javascript date
|
| Modifier and Type | Field and Description |
|---|---|
static String |
NAME_BINDING
add ${name.pipeName} binding allowing to retrieve pipeName's current resource name
|
static String |
NASHORNSCRIPTENGINE |
static String |
NN_ADDITIONALBINDINGS |
static String |
PATH_BINDING
add ${path.pipeName} binding allowing to retrieve pipeName's current resource path
|
static String |
PN_ADDITIONALSCRIPTS |
| Constructor and Description |
|---|
PipeBindings(org.apache.sling.api.resource.Resource resource)
public constructor, built from pipe's resource
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBinding(String name,
Object value)
add a binding
|
void |
addBindings(Map bindings)
adds additional bindings (global variables to use in child pipes expressions)
|
void |
addScript(org.apache.sling.api.resource.ResourceResolver resolver,
String path)
add a script file to the engine
|
protected String |
computeECMA5Expression(String expr)
Doesn't look like nashorn likes template strings :-(
|
void |
copyBindings(PipeBindings original)
copy bindings
|
protected Object |
evaluate(String expr)
evaluate a given expression
|
Bindings |
getBindings()
return registered bindings
|
org.apache.sling.api.resource.Resource |
getExecutedResource(String name)
return Pipe
name's output binding |
String |
instantiateExpression(String expr)
Expression is a function of variables from execution context, that
we implement here as a String
|
Object |
instantiateObject(String expr)
Instantiate object from expression
|
boolean |
isBindingDefined(String name)
check if a given bindings is defined or not
|
void |
updateBindings(Pipe pipe,
org.apache.sling.api.resource.Resource resource)
Update current resource of a given pipe, and appropriate binding
|
void |
updateStaticBindings(String name,
org.apache.sling.api.resource.Resource resource)
Update all the static bindings related to a given resource
|
public static final String NASHORNSCRIPTENGINE
public static final String NN_ADDITIONALBINDINGS
public static final String PN_ADDITIONALSCRIPTS
public static final String PATH_BINDING
public static final String NAME_BINDING
public PipeBindings(org.apache.sling.api.resource.Resource resource)
throws ScriptException
resource - pipe's configuration resourceScriptException - in case scripts associated with the bindings are not assessablepublic void addBinding(String name, Object value)
name - binding's namevalue - binding's valuepublic void addBindings(Map bindings)
bindings - key/values bindings to add to the existing bindingspublic void addScript(org.apache.sling.api.resource.ResourceResolver resolver,
String path)
resolver - resolver with which the file should be readpath - path of the script fileprotected String computeECMA5Expression(String expr)
expr - ECMA like expression blah${'some' + 'ecma' + 'expression'}public void copyBindings(PipeBindings original)
original - original bindings to copyprotected Object evaluate(String expr) throws ScriptException
expr - ecma like expressionScriptException - in case the script fails, an exception is thrown (to let call code the opportunity to stop the execution)public Bindings getBindings()
public org.apache.sling.api.resource.Resource getExecutedResource(String name)
name's output bindingname - name of the pipepublic String instantiateExpression(String expr)
expr - ecma like expressionpublic Object instantiateObject(String expr)
expr - ecma expressionpublic boolean isBindingDefined(String name)
name - name of the bindingname is registeredpublic void updateBindings(Pipe pipe, org.apache.sling.api.resource.Resource resource)
pipe - pipe we'll extract the output binding fromresource - current resource in the pipe executionpublic void updateStaticBindings(String name, org.apache.sling.api.resource.Resource resource)
name - name under which static bindings should be recordedresource - resource from which static bindings will be builtCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.