scriptella.core
Class ScriptExecutor

java.lang.Object
  extended by scriptella.core.ScriptExecutor
All Implemented Interfaces:
ExecutableElement

public final class ScriptExecutor
extends java.lang.Object

<script> element executor.

Version:
1.0
Author:
Fyodor Kupolov

Field Summary
protected  boolean debug
           
protected  java.util.logging.Logger log
           
 
Constructor Summary
ScriptExecutor(ScriptEl scriptEl)
           
 
Method Summary
protected  void execute(Connection connection, Resource resource, DynamicContext ctx)
          Executes a script or a query resource using the specified connection.
 void execute(DynamicContext ctx)
          Executes the element.
 Resource getContent(DialectIdentifier dialectIdentifier)
          Returns content satisfying dialect information.
 T getElement()
          Returns scripting element specified in constructor
 Location getLocation()
          A short for getElement().
static ExecutableElement prepare(ScriptEl s)
           
protected  ContentEl prepareContent(ContentEl content)
          Prepares the content for later execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final java.util.logging.Logger log

debug

protected final boolean debug
Constructor Detail

ScriptExecutor

public ScriptExecutor(ScriptEl scriptEl)
Method Detail

execute

protected void execute(Connection connection,
                       Resource resource,
                       DynamicContext ctx)
Executes a script or a query resource using the specified connection.

Parameters:
connection - connection to use for element execution.
resource - query/script content to execute.
ctx - dynamic context to use for variables, etc.

prepare

public static ExecutableElement prepare(ScriptEl s)

getElement

public T getElement()
Returns scripting element specified in constructor

Returns:
scripting element

execute

public final void execute(DynamicContext ctx)
Description copied from interface: ExecutableElement
Executes the element.

Note: the context may be decorated by DynamicContextDecorator.

Specified by:
execute in interface ExecutableElement
Parameters:
ctx - context to use.

getContent

public Resource getContent(DialectIdentifier dialectIdentifier)
Returns content satisfying dialect information.

This method caches contents based on dialects. For now we assume dialectIdentifier is constant for element.

Parameters:
dialectIdentifier - dialect identifier.
Returns:
content for dialect. Not null.

getLocation

public Location getLocation()
A short for getElement().getLocation()

Returns:
element location.

prepareContent

protected ContentEl prepareContent(ContentEl content)
Prepares the content for later execution.

If content is dynamic, i.e. contains includes with bind variables, the properties substitutor is specified, otherwise no properties .

Parameters:
content - content to traverse.
Returns:
the same content object for convenience only.


Copyright © Copyright 2006-2009 The Scriptella Project Team.