Tuscany DAS for Relational Databases

org.apache.tuscany.das.rdb.impl
Class CommandImpl

java.lang.Object
  extended by org.apache.tuscany.das.rdb.impl.BaseCommandImpl
      extended by org.apache.tuscany.das.rdb.impl.CommandImpl
All Implemented Interfaces:
Command
Direct Known Subclasses:
ReadCommandImpl, WriteCommandImpl

public abstract class CommandImpl
extends BaseCommandImpl
implements Command


Field Summary
protected static boolean debug
           
protected  Parameters parameters
           
protected  ResultSetShape resultSetShape
           
protected  Statement statement
           
 
Fields inherited from class org.apache.tuscany.das.rdb.impl.BaseCommandImpl
configWrapper
 
Fields inherited from interface org.apache.tuscany.das.rdb.Command
FACTORY
 
Constructor Summary
CommandImpl(String sqlString)
           
 
Method Summary
 void addParameter(int index, int direction, Type sdoType)
          Adds a Parameter to the command
 void addParameter(int index, Type sdoType)
          Adds a Parameter to the command
 void addParameter(Parameter param)
           
 void addParameter(String name, int direction, Type sdoType)
          Adds a Parameter to the command
 void addParameter(String name, Type sdoType)
          Adds a Parameter to the command
 void close()
          Cleans up and realeases all resources associated with this command.
abstract  void execute()
          Performs the function defined by the command
abstract  DataObject executeQuery()
          Performs the function defined by the command and return the results in the root DataObject
protected  ConnectionImpl getConnection()
           
 Parameter getParameter(int index)
          Returns the Parameter at index
 Parameter getParameter(String name)
          Returns the parameter associated with "name"
 List getParameters()
           
 Object getParameterValue(int index)
          Returns the value of the associated Parameter
 Object getParameterValue(String name)
          Returns the value of the associated Parameter
 void setConnection(ConnectionImpl connection)
           
 void setParameterType(int index, Type dataType)
          Sets the "type" of the associated Parameter
 void setParameterType(String name, Type dataType)
          Sets the "type" of the associated Parameter
 void setParameterValue(int index, Object value)
          Sets the value of the associated Parameter
 void setParameterValue(String name, Object value)
          Sets the value of the named Parameter
 void setResultSetShape(ResultSetShape shape)
          Defines the structure of the ResultSet returned by the JDBC Driver when this command is executed.
 
Methods inherited from class org.apache.tuscany.das.rdb.impl.BaseCommandImpl
addCollisionColumn, addConverter, addGeneratedPrimaryKey, addPrimaryKey, addPrimaryKey, addRelationship, addRelationship, setConnection, setConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.tuscany.das.rdb.Command
setConnection, setConnection, setDataObjectModel
 

Field Detail

statement

protected Statement statement

parameters

protected Parameters parameters

debug

protected static final boolean debug
See Also:
Constant Field Values

resultSetShape

protected ResultSetShape resultSetShape
Constructor Detail

CommandImpl

public CommandImpl(String sqlString)
Method Detail

execute

public abstract void execute()
Description copied from interface: Command
Performs the function defined by the command

Specified by:
execute in interface Command

executeQuery

public abstract DataObject executeQuery()
Description copied from interface: Command
Performs the function defined by the command and return the results in the root DataObject

Specified by:
executeQuery in interface Command
Returns:
the root DataObject

setParameterValue

public void setParameterValue(String name,
                              Object value)
Description copied from interface: Command
Sets the value of the named Parameter

Specified by:
setParameterValue in interface Command
Parameters:
name - the name of this Parameter
value - the value for the Parameter

setParameterValue

public void setParameterValue(int index,
                              Object value)
Description copied from interface: Command
Sets the value of the associated Parameter

Specified by:
setParameterValue in interface Command
Parameters:
index - the index of the Parameter
value - the value for the Parameter

setParameterType

public void setParameterType(String name,
                             Type dataType)
Description copied from interface: Command
Sets the "type" of the associated Parameter

Specified by:
setParameterType in interface Command

setParameterType

public void setParameterType(int index,
                             Type dataType)
Description copied from interface: Command
Sets the "type" of the associated Parameter

Specified by:
setParameterType in interface Command
Parameters:
index - the index of the Parameter

addParameter

public void addParameter(int index,
                         Type sdoType)
Description copied from interface: Command
Adds a Parameter to the command

Specified by:
addParameter in interface Command
Parameters:
index - the index of the parameter
sdoType - the commonj.sdo.Type of the Parameter

addParameter

public void addParameter(int index,
                         int direction,
                         Type sdoType)
Description copied from interface: Command
Adds a Parameter to the command

Specified by:
addParameter in interface Command
Parameters:
index - the index of the parameter
direction - the direction of the Parameter. Either Parameter.IN, Parameter.OUT or Parameter.INOUT
sdoType - specifies the type as a commonj.sdo.Type from SDODataTypes

addParameter

public void addParameter(String name,
                         Type sdoType)
Description copied from interface: Command
Adds a Parameter to the command

Specified by:
addParameter in interface Command
Parameters:
name - the index of the parameter
sdoType - the commonj.sdo.Type of the Parameter

addParameter

public void addParameter(String name,
                         int direction,
                         Type sdoType)
Description copied from interface: Command
Adds a Parameter to the command

Specified by:
addParameter in interface Command
Parameters:
name - the name associated with the Parameter
direction - the direction of the Parameter. Either Parameter.IN, Parameter.OUT or Parameter.INOUT
sdoType - specifies the type as a commonj.sdo.Type from SDODataTypes

addParameter

public void addParameter(Parameter param)

getParameter

public Parameter getParameter(String name)
Description copied from interface: Command
Returns the parameter associated with "name"

Specified by:
getParameter in interface Command
Parameters:
name - the name of the parameter
Returns:
the associated parameter

getParameter

public Parameter getParameter(int index)
Description copied from interface: Command
Returns the Parameter at index

Specified by:
getParameter in interface Command
Parameters:
index - the index of the Parameter
Returns:
the associated Parameter

getParameters

public List getParameters()

getParameterValue

public Object getParameterValue(String name)
Description copied from interface: Command
Returns the value of the associated Parameter

Specified by:
getParameterValue in interface Command
Parameters:
name - the name of the Parameter
Returns:
the value of the Parameter

getParameterValue

public Object getParameterValue(int index)
Description copied from interface: Command
Returns the value of the associated Parameter

Specified by:
getParameterValue in interface Command
Parameters:
index - the index of the Parameter
Returns:
the value of the Parameter

setConnection

public void setConnection(ConnectionImpl connection)
Specified by:
setConnection in class BaseCommandImpl

getConnection

protected ConnectionImpl getConnection()

setResultSetShape

public void setResultSetShape(ResultSetShape shape)
Description copied from interface: Command
Defines the structure of the ResultSet returned by the JDBC Driver when this command is executed. If the shape is not specified then the shape is taken from the ResultSetMetatadta instance provided by the JDBC Driver.

This method is prvided primarily to support platforms (such as Oracle) that do not provide complete support for ResultSetMetadata

Specified by:
setResultSetShape in interface Command
Parameters:
shape - the specified result set shape
See Also:
ResultSetShape

close

public void close()
Description copied from interface: Command
Cleans up and realeases all resources associated with this command. This should be called when the application is done with this command.

Specified by:
close in interface Command

Tuscany DAS for Relational Databases

-