org.inria.ns.reflex.modules.rdbms
Class QueryAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.core.AbstractSetAction
          extended by org.inria.ns.reflex.modules.rdbms.QueryAction
All Implemented Interfaces:
Computable, Executable, Presentable, Unwrappable, NamespaceContextFactory
Direct Known Subclasses:
SelectAction, UpdateAction

public abstract class QueryAction
extends AbstractSetAction
implements Unwrappable

QueryAction

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.core.AbstractAction
AbstractAction.ParameterAdapter, AbstractAction.UselessAction
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Unwrappable
Unwrappable.Unwrapper
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
NO_VALUE
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Fields inherited from interface org.inria.ns.reflex.structures.Unwrappable
UNWRAPPER
 
Constructor Summary
QueryAction(Expression value, String statement, Element element, AbstractAction parent)
           
 
Method Summary
 Object getComputedValue(DataSet dataSet)
          Perform the query.
 PreparedStatement getStatement(Connection connection)
          Get a prepared statement from this query.
abstract  Object runQuery(PreparedStatement statement)
          Perform the statement.
 Object unwrap()
          Return the statement wrapped by this instance.
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
addProperty, getComputedName, getName, getValue, runAction, scope, unmarshalScope
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractAction
addAction, addFallbackAction, createContext, getCanonicalPath, getFallbackAction, getLocalFallbackAction, getLogger, getNamespaceContext, getNode, getParent, recover, recover, removeFallbackAction, reorganize, run, runActions, toPrettyString, toPrettyString, toString, unmarshal
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryAction

public QueryAction(Expression value,
                   String statement,
                   Element element,
                   AbstractAction parent)
            throws XMLException
Parameters:
value -
element -
parent -
Throws:
XMLException
Method Detail

getComputedValue

public Object getComputedValue(DataSet dataSet)
                        throws ExecutionException,
                               XPathException
Perform the query.

Specified by:
getComputedValue in interface Computable
Specified by:
getComputedValue in class AbstractSetAction
Parameters:
dataSet - The set of datas used when the name is computed.
Returns:
The computed value of the property.
Throws:
ExecutionException - If the computation can't be performed.
XPathException
See Also:
AbstractSetAction.getComputedValue(org.inria.ns.reflex.processor.DataSet)

runQuery

public abstract Object runQuery(PreparedStatement statement)
                         throws SQLException
Perform the statement.

Parameters:
statement - The statement to perform.
Returns:
The result of the statement :
  • the number of rows affected by the query,
  • a set of browsable result.
Throws:
SQLException - When the query fails to run.

getStatement

public PreparedStatement getStatement(Connection connection)
                               throws SQLException
Get a prepared statement from this query.

Parameters:
connection - The connection in use.
Returns:
A prepared statement for the connection given.
Throws:
SQLException - If this query can't be parsed.

unwrap

public Object unwrap()
Return the statement wrapped by this instance.

Specified by:
unwrap in interface Unwrappable
Returns:
This statement.
See Also:
Unwrappable.unwrap()