org.apache.tuscany.das.rdb
Interface Command

All Known Implementing Classes:
CommandImpl, DeleteCommandImpl, InsertCommandImpl, OptimisticWriteCommandImpl, ReadCommandImpl, SPCommandImpl, UpdateCommandImpl, WriteCommandImpl

public interface Command

A Command is used to execute a read or write to a database


Method Summary
 void addResultDescriptor(ResultDescriptor resultDescriptor)
          Add/replace based on columnIndex (>=0)embedded in resultDescriptor else add at end
 void execute()
          Performs the function defined by the command
 commonj.sdo.DataObject executeQuery()
          Performs the function defined by the command and return the results in the root DataObject
 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)
           
 ResultDescriptor getResultDescriptor(int columnIndex)
          Return resultDescriptor if exact match for columnIndex(>=0) found else return null;
 java.util.List getResultDescriptors()
           
 void printResultDescriptors(java.io.OutputStream ostrm)
          Utility method
 ResultDescriptor removeResultDescriptor(int columnIndex)
          remove ResultDescriptor at given columnIndex(>=0) and return same.
 ResultDescriptor removeResultDescriptor(ResultDescriptor resultDescriptor)
          Remove resultDescriptor only if matched for index(>=0), name, type, schema name and table name and return same, else return null For -ve index, ignore index and if unique match for rest of the attriutes, remove/return, if multiple matches found, throw RuntimeException
 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)
           
 void setResultDescriptors(java.util.List resultDescriptorList)
          Allow set of ResultDescriptor when command is created on-the-fly
 

Method Detail

execute

void execute()
Performs the function defined by the command


executeQuery

commonj.sdo.DataObject executeQuery()
Performs the function defined by the command and return the results in the root DataObject

Returns:
the root DataObject

setParameter

void setParameter(int index,
                  java.lang.Object value)
Sets the value of the associated Parameter

Parameters:
index - the index of the Parameter
value - the value for the Parameter

getParameter

java.lang.Object getParameter(int index)
Returns the value of the associated Parameter

Parameters:
index - the index of the Parameter
Returns:
the value of the Parameter

setParameter

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

getParameter

java.lang.Object getParameter(java.lang.String name)
Parameters:
name - the name of the parameter - should match exact name of database table column
Returns:
the value of the parameter

getGeneratedKey

int getGeneratedKey()
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.

Returns:
the generated key

setResultDescriptors

void setResultDescriptors(java.util.List resultDescriptorList)
Allow set of ResultDescriptor when command is created on-the-fly

Parameters:
resultDescriptorList -

getResultDescriptors

java.util.List getResultDescriptors()

addResultDescriptor

void addResultDescriptor(ResultDescriptor resultDescriptor)
Add/replace based on columnIndex (>=0)embedded in resultDescriptor else add at end

Parameters:
resultDescriptor -

removeResultDescriptor

ResultDescriptor removeResultDescriptor(int columnIndex)
remove ResultDescriptor at given columnIndex(>=0) and return same. If not present return null. For -ve index, return null

Parameters:
columnIndex -
Returns:

removeResultDescriptor

ResultDescriptor removeResultDescriptor(ResultDescriptor resultDescriptor)
Remove resultDescriptor only if matched for index(>=0), name, type, schema name and table name and return same, else return null For -ve index, ignore index and if unique match for rest of the attriutes, remove/return, if multiple matches found, throw RuntimeException

Parameters:
resultDescriptor -
Returns:

getResultDescriptor

ResultDescriptor getResultDescriptor(int columnIndex)
Return resultDescriptor if exact match for columnIndex(>=0) found else return null;

Parameters:
columnIndex -
Returns:

printResultDescriptors

void printResultDescriptors(java.io.OutputStream ostrm)
                            throws java.io.IOException
Utility method

Parameters:
ostrm -
Throws:
java.io.IOException


Copyright © 2007 Apache Software Foundation. All Rights Reserved.