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  ParametersExtendedImpl parameters
           
protected  ResultSetShape resultSetShape
           
protected  Statement statement
           
 
Fields inherited from class org.apache.tuscany.das.rdb.impl.BaseCommandImpl
configWrapper
 
Constructor Summary
CommandImpl(Command command)
           
CommandImpl(java.lang.String sqlString)
           
 
Method Summary
 void addParameter(ParameterExtendedImpl param)
           
 void close()
           
abstract  void execute()
          Performs the function defined by the command
abstract  commonj.sdo.DataObject executeQuery()
          Performs the function defined by the command and return the results in the root DataObject
protected  ConnectionImpl getConnection()
           
 int getGeneratedKey()
          Returns the value of the database-generated key.
 java.lang.Object getParameter(int index)
          Returns the value of the associated Parameter
 java.lang.Object getParameter(java.lang.String name)
           
 java.util.List getParameters()
           
 void setConnection(ConnectionImpl connection)
           
 void setParameter(int index, java.lang.Object value)
          Sets the value of the associated Parameter
 void setParameter(java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class org.apache.tuscany.das.rdb.impl.BaseCommandImpl
setConnection, 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
addResultDescriptor, getResultDescriptor, getResultDescriptors, printResultDescriptors, removeResultDescriptor, removeResultDescriptor, setResultDescriptors
 

Field Detail

statement

protected Statement statement

parameters

protected ParametersExtendedImpl parameters

resultSetShape

protected ResultSetShape resultSetShape
Constructor Detail

CommandImpl

public CommandImpl(java.lang.String sqlString)

CommandImpl

public CommandImpl(Command command)
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 commonj.sdo.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

setParameter

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

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

addParameter

public void addParameter(ParameterExtendedImpl param)

getParameters

public java.util.List getParameters()

getParameter

public java.lang.Object getParameter(int index)
Description copied from interface: Command
Returns the value of the associated Parameter

Specified by:
getParameter 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()

getGeneratedKey

public int getGeneratedKey()
Description copied from interface: Command
Returns the value of the database-generated key. This method is specific to an "insert" command and will be valid only after the command has been executed.

Specified by:
getGeneratedKey in interface Command
Returns:
the generated key

close

public void close()

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object value)
Specified by:
setParameter in interface Command
Parameters:
name - Name of parameter - should match exact name of database table column as appearing in Command
value - the value of the parameter

getParameter

public java.lang.Object getParameter(java.lang.String name)
Specified by:
getParameter in interface Command
Parameters:
name - the name of the parameter - should match exact name of database table column
Returns:
the value of the parameter


Copyright © 2007 Apache Software Foundation. All Rights Reserved.