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

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

Introduction

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

Prototype

public abstract Pointer getContextPointer();

Source Link

Document

Returns a Pointer for the context bean.

Usage

From source file:org.xchain.framework.lifecycle.Execution.java

/**
 * <p>Signals that the execute method of a command has been called.  If this command is registered with a catalog, then
 * a new local context is created based on the current context that was passed in.</p>
 *
 * <p>NOTE: This command is used by the engineering framework and should not be called directly by
 * command implementations.</p>/*w w w .  j  a  v  a  2  s .c o m*/
 *
 * @param command the command that is being executed.
 * @param context the current local context or the global context.
 * @return the current local context.  If the command is registered with a catalog, then the context returned is
 * the new local context for this command.  Otherwise, the context returned will be the same as the context passed in.
 */
public static JXPathContext startCommandExecute(Command command, JXPathContext context) {
    JXPathContext localContext = null;

    // push this command onto the stack.
    executionContextStack.push(new CommandExecutionContext(command));

    if (isLocalContextBoundary(command)) {
        // create the new local context.
        localContext = new ScopedJXPathContextImpl(executionContextTl.get(), context.getContextBean(),
                context.getContextPointer(), Scope.chain);

        // push the local context.
        chainContextStack.push(localContext);

        startExecutionTrace(command);
    } else if (!(context instanceof ScopedJXPathContextImpl)) {
        throw new IllegalStateException("Initial call to command that is not registered with a catalog.");
    }

    updateExecutionTraceLocation();

    // get the local context.
    context = getCurrentContext();
    if (command instanceof EngineeredCommand) {
        // Define prefix mappings for engineered commands.
        definePrefixMappings(context, (EngineeredCommand) command);
    }

    // return the context.
    return context;
}