Example usage for org.apache.commons.jxpath JXPathContext getVariables

List of usage examples for org.apache.commons.jxpath JXPathContext getVariables

Introduction

In this page you can find the example usage for org.apache.commons.jxpath JXPathContext getVariables.

Prototype

public Variables getVariables() 

Source Link

Document

Returns the variable pool associated with the context.

Usage

From source file:org.xchain.namespaces.test.AvtEnumCommand.java

public boolean execute(JXPathContext context) throws Exception {
    QName variableName = getName(context);
    Object variableValue = getValue(context);

    // set the value of the expression to the variable name.
    // context.getVariables().declareVariable(getName(), getCompiledSelect().getValue(context));
    ((ScopedQNameVariables) context.getVariables()).declareVariable(variableName, variableValue, Scope.request);

    if (log.isDebugEnabled()) {
        log.debug("Setting variable name '" + variableName + "' to value '" + variableValue + "'.");
    }//from   ww  w. j  a  v a2s  .c  om

    // return false and allow other chains to execute.
    return false;
}

From source file:org.xchain.namespaces.test.ExecutionStackTraceCommand.java

public boolean execute(JXPathContext context) throws Exception {
    QName variableName = getName(context);
    List<ExecutionTraceElement> executionStackTrace = Execution.getExecutionTrace();

    // set the value of the expression to the variable name.
    ((ScopedQNameVariables) context.getVariables()).declareVariable(variableName, executionStackTrace,
            Scope.request);//from w w  w.  ja  v a2  s.  c  o  m

    // return false and allow other chains to execute.
    return false;
}

From source file:org.xchain.StandAloneExecutor.java

/**
 * Calls configure context passing in the properties configuration
 */// w  ww.jav a  2  s.co m
public void configureContext(JXPathContext context, Map<QName, Object> variables) {
    ScopedQNameVariables contextVariables = (ScopedQNameVariables) context.getVariables();

    for (Entry<QName, Object> entry : variables.entrySet()) {
        contextVariables.declareVariable(entry.getKey(), entry.getValue());
    }
}

From source file:org.xchain.StandAloneHibernateExecutor.java

/**
 * Add the Hibernate config as a variable
 *///from  w  ww  . j  a v  a  2  s  .  c  o m
public void configureContext(JXPathContext context, Map<QName, Object> variables) {
    super.configureContext(context, variables);

    context.getVariables().declareVariable("configuration", hibernateConfig);
}

From source file:org.xchain.test.basic.BasicTestCommand.java

public boolean execute(JXPathContext context) throws Exception {
    ((ScopedQNameVariables) context.getVariables()).declareVariable(TestBasic.VARIABLE_NAME,
            TestBasic.VARIABLE_VALUE, Scope.request);
    return false;
}

From source file:org.xchain.test.locator.GetLocatorCommand.java

public boolean execute(JXPathContext context) throws Exception {
    ((ScopedQNameVariables) context.getVariables()).declareVariable(getVariable(context),
            ((Locatable) this).getLocator(), Scope.request);
    return false;
}

From source file:org.xchain.test.namespace.CopyNamespaceCommand.java

public boolean execute(JXPathContext context) throws Exception {
    ((ScopedQNameVariables) context.getVariables()).declareVariable(getVariable(context),
            context.getNamespaceURI(getPrefix(context)), Scope.request);
    return false;
}