Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.ExpressionContext


     * @throws Exception if an  error is encountered
     */
    public void testCreateContext() throws Exception {
        // ensure the correct object is created
        // @todo fix parameters
        ExpressionContext context = factory.createExpressionContext(null, null);
        assertTrue("JXPathExpressionFactory createContext() should create " +
                   "JXPathExpressionContext instance",
                   (context instanceof JXPathExpressionContext));
    }   
View Full Code Here


                    Expression expression = parser.parse(expressionStr);
                    // obtain the ExpressionContext from the PipelineContext
                    // the ExpressionContext is needed in order to evaluate the
                    // expression parsed
                    ExpressionContext expressionContext =
                            getPipelineContext().getExpressionContext();

                    // evaluate the experssion
                    Value result = expression.evaluate(expressionContext);
                    if (result.getSequence().getLength() == 0) {
View Full Code Here

                               final ExpandedName element,
                               final Attributes attributes) throws SAXException {

        // create a new stack frame and execute the pending variable
        // declarations
        final ExpressionContext expressionContext =
            dynamicProcess.getPipelineContext().getExpressionContext();
        expressionContext.pushStackFrame();
        final TemplateModel model = getModel(dynamicProcess);
        model.executePendingVariableDeclarations();
        return super.startElement(dynamicProcess, element, attributes);
    }
View Full Code Here

    protected void endElementImpl(final DynamicProcess dynamicProcess,
                                  final ExpandedName element,
                                  final Object object) throws SAXException {
        super.endElementImpl(dynamicProcess, element, object);
        // remove the stack frame created for the body of the template
        final ExpressionContext expressionContext =
            dynamicProcess.getPipelineContext().getExpressionContext();
        expressionContext.popStackFrame();
    }
View Full Code Here

                                         InternalResponse response,
                                         EnvironmentContext context)
            throws IOException, MarinerContextException {

        MarinerSessionContext sessionContext = null;
        ExpressionContext expressionContext = null;
        if (context != null) {
            sessionContext = context.getCurrentSessionContext();
            expressionContext = context.getExpressionContext();
        }
        try {
View Full Code Here

            // MarinerPageContext has been allocated but before it has been
            // initialised as this is needed during the initialisation.
            environmentContext.initialise(context);
            environmentContext.initialiseSession();

            ExpressionContext exprContext =
                    environmentContext.getExpressionContext();

            // If there is an expression context then it must have been associated
            // with an enclosing request context since we are still initialising
            // this instance of MarinerServletRequestContext. We now must associate
            // the expression context with this MarinerServletRequestContext.
            //
            // An expression context can be associated with more than one request
            // context, although not concurrently. When the request context is no
            // longer needed, the expression context (if any) should be reset to
            // the enclosing request context.
            if (exprContext == null) {
                ExpressionSupport.createExpressionEnv(this,
                        volantisBean, environmentContext,
                        context.getDevicePolicyAccessor());
            } else {
                exprContext.setProperty(MarinerRequestContext.class, this,
                        false);
            }

            ContextInternals.setEnvironmentContext(this, environmentContext);
View Full Code Here

            }

            // If there is an expression context associated with this request
            // context then it must be reset so that it is re-associated with the
            // enclosing request context from which it originally came.
            ExpressionContext exprContext =
                    MCSExpressionHelper.getExpressionContext(this);
            if (exprContext != null) {
                exprContext.
                        setProperty(MarinerRequestContext.class,
                                enclosingRequestContext,
                                false);
            }
View Full Code Here

            // MarinerPageContext has been allocated but before it has been
            // initialised as this is needed during the initialisation.
            environmentContext.initialise(context);
            environmentContext.initialiseSession();

            ExpressionContext exprContext =
                    environmentContext.getExpressionContext();

            // If there is an expression context then it must have been associated
            // with an enclosing request context since we are still initialising
            // this instance of MarinerServletRequestContext. We now must associate
            // the expression context with this MarinerServletRequestContext.
            //
            // An expression context can be associated with more than one request
            // context, although not concurrently. When the request context is no
            // longer needed, the expression context (if any) should be reset to
            // the enclosing request context.
            if (exprContext == null) {
                ExpressionSupport.createExpressionEnv(this,
                        volantisBean, environmentContext,
                        context.getDevicePolicyAccessor());
            } else {
                exprContext.setProperty(MarinerRequestContext.class, this,
                        false);
            }

            ContextInternals.setEnvironmentContext(this, environmentContext);
View Full Code Here

            }

            // If there is an expression context associated with this request
            // context then it must be reset so that it is re-associated with the
            // enclosing request context from which it originally came.
            ExpressionContext exprContext =
                    MCSExpressionHelper.getExpressionContext(this);
            if (exprContext != null) {
                exprContext.
                        setProperty(MarinerRequestContext.class,
                                enclosingRequestContext,
                                false);
            }
View Full Code Here

    /**
     * Tests that the search string is found where expected.
     */
    public void testSearchPresent() throws Exception {
        ExpressionContext context = createExpressionContext();
        ExpressionFactory factory = context.getFactory();
        Function indexOf = new IndexOfFunction();
        Sequence sequence = createStringSequence(factory,
                new String[]{"a", "dog", "and", "a", "duck"});
        Value search = factory.createStringValue("a");
        Value retVal = indexOf.invoke(context, new Value[]{sequence, search});
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.ExpressionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.