com.ibm.websphere.sdo.jdbc
Interface JDBCMediatorAccessBean

All Superinterfaces:
MediatorAccessBean

public interface JDBCMediatorAccessBean
extends MediatorAccessBean

Service Data Objects - JDBCMediatorAccessBean.

This interface defines the wrapper to a JDBC SDO Mediator and it's Metadata.
A Mediator has the following responsibilities:


Field Summary
static int ASCENDING
          Use ascending order for list ordering
static int BIGDECIMAL
           
static int BLOB
           
static int BOOLEAN
           
static int BYTE
           
static int BYTES
           
static int CLOB
           
static int DATE
           
static int DESCENDING
          Use descending order for list ordering
static int DOUBLE
           
static int FLOAT
           
static int INTEGER
           
static int LONG
           
static int OBJECT
           
static int SHORT
           
static int STRING
           
static int TIME
           
static int TIMESTAMP
           
static int UNSORTED
          Use unsorted orders for list ordering
 
Method Summary
 void addOrderBy(java.lang.String name, int direction)
          Adds an orderBy to order results by a property in a given direction.
 void autoGenerateKey(DataObjectAccessBean dataObject)
          Populates all the columns of the Primary key with values from the Key generator.
 void clearFilter(java.lang.String tableName)
          Removes all filters set on the table tableName
 void clearOrderby()
          Removes all orderBy clauses set through the addOrderBy API
 com.ibm.websphere.wdo.mediator.rdb.metadata.FilterArgument createFilterArgument(java.lang.String name, int type)
          Creates a new Filter Argument to be added to a Filter on a table
 DataGraphAccessBean firstPage()
          Moves to the first page of DataObjects
 com.ibm.websphere.wdo.mediator.rdb.metadata.Filter getFilter(java.lang.String tableName)
          Returns the Filter associated with a give table
 java.lang.Long getNextGeneratedKey()
          Get the next Key Value from the Auto Key Generator The Auto Key Generator is set up in your DataObject's Metadata.
 int getPageSize()
          Return the desired number of DataObjects to return per page.
 boolean isFirstPage()
          Return true if the last DataGraph returned from this mediator was the first page of this data set.
 boolean isLastPage()
          Return true if the last DataGraph returned from this mediator was the first page of this data set.
 DataGraphAccessBean lastPage()
          Moves to the first page of DataObjects
 DataGraphAccessBean nextPage()
          Resets the position of the DataList so that on the next iteration, the next page of DataObjects will be returned.
 DataGraphAccessBean previousPage()
          Resets the position of the DataList so that on the next iteration, the previous page of DataObjects will be returned.
 void removeOrderBy(java.lang.String name)
          Removes an Order By added for a given property
 void setAutoCloseConnection(boolean autoclose)
          By default the connection is opened before any fill or flush operation.
 void setConnectionName(java.lang.String name)
          Set the connection name There are two ways a data source can be specified as a string.
 void setConnectionWrapper(com.ibm.websphere.wdo.mediator.rdb.ConnectionWrapper wrapper)
          Set the DataDase conenction as a ConnectionWrapper object
 com.ibm.websphere.wdo.mediator.rdb.metadata.Filter setFilter(java.lang.String tableName, java.lang.String predicate, java.lang.String[] argNames, int[] argTypes)
          Create a new Filter of the a given database table The filter can be any valid SQL where clause.
 void setPageSize(int size)
          Specify the desired number of DataObjects per page.
 
Methods inherited from interface com.ibm.websphere.sdo.MediatorAccessBean
applyChanges, close, createEmptyGraph, fetchGraph, getMetadata, getParams, getSchema, setMetadata, setMetadataFileName, setParams
 

Field Detail

INTEGER

public static final int INTEGER

BOOLEAN

public static final int BOOLEAN

BYTE

public static final int BYTE

SHORT

public static final int SHORT

STRING

public static final int STRING

DOUBLE

public static final int DOUBLE

LONG

public static final int LONG

FLOAT

public static final int FLOAT

OBJECT

public static final int OBJECT

BIGDECIMAL

public static final int BIGDECIMAL

DATE

public static final int DATE

TIME

public static final int TIME

TIMESTAMP

public static final int TIMESTAMP

BLOB

public static final int BLOB

CLOB

public static final int CLOB

BYTES

public static final int BYTES

UNSORTED

public static final int UNSORTED
Use unsorted orders for list ordering

ASCENDING

public static final int ASCENDING
Use ascending order for list ordering

DESCENDING

public static final int DESCENDING
Use descending order for list ordering
Method Detail

addOrderBy

public void addOrderBy(java.lang.String name,
                       int direction)
                throws java.io.IOException,
                       com.ibm.websphere.wdo.mediator.exception.MediatorException
Adds an orderBy to order results by a property in a given direction. Orderby is added to the front of the order-by list; If name previously existed in Order By List, it is moved to the front of the order-by list.
Parameters:
name - name of column to order by.
direction - directional order to sort by: DataListAccessBean.UNSORTED, DataListAccessBean.ASCENDING, DataListAccessBean.DESCENDING
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

autoGenerateKey

public void autoGenerateKey(DataObjectAccessBean dataObject)
                     throws com.ibm.websphere.wdo.mediator.exception.MediatorException,
                            java.io.IOException
Populates all the columns of the Primary key with values from the Key generator. The Auto Key Generator is set up in your DataObject's Metadata.
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

clearFilter

public void clearFilter(java.lang.String tableName)
                 throws java.io.IOException,
                        com.ibm.websphere.wdo.mediator.exception.MediatorException
Removes all filters set on the table tableName
Parameters:
tableName -  
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

clearOrderby

public void clearOrderby()
                  throws java.io.IOException,
                         com.ibm.websphere.wdo.mediator.exception.MediatorException
Removes all orderBy clauses set through the addOrderBy API
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

createFilterArgument

public com.ibm.websphere.wdo.mediator.rdb.metadata.FilterArgument createFilterArgument(java.lang.String name,
                                                                                       int type)
Creates a new Filter Argument to be added to a Filter on a table
Parameters:
name -  
type -  
Returns:
FilterArgument

firstPage

public DataGraphAccessBean firstPage()
                              throws com.ibm.websphere.wdo.mediator.exception.MediatorException,
                                     java.io.IOException
Moves to the first page of DataObjects
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

getFilter

public com.ibm.websphere.wdo.mediator.rdb.metadata.Filter getFilter(java.lang.String tableName)
                                                             throws java.io.IOException,
                                                                    com.ibm.websphere.wdo.mediator.exception.MediatorException
Returns the Filter associated with a give table
Parameters:
tableName -  
Returns:
Filter
Throws:
java.io.IOException -  
com.ibm.websphere.wdo.mediator.exception.MediatorException -  

getNextGeneratedKey

public java.lang.Long getNextGeneratedKey()
                                   throws com.ibm.websphere.wdo.mediator.exception.MediatorException,
                                          java.io.IOException
Get the next Key Value from the Auto Key Generator The Auto Key Generator is set up in your DataObject's Metadata.
Returns:
the next key value from the auto key generator
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

getPageSize

public int getPageSize()
Return the desired number of DataObjects to return per page. If page size is less than 1 server side paging is not enabled
Returns:
the targeted page size

isFirstPage

public boolean isFirstPage()
Return true if the last DataGraph returned from this mediator was the first page of this data set.
Returns:
boolean

isLastPage

public boolean isLastPage()
Return true if the last DataGraph returned from this mediator was the first page of this data set.
Returns:
boolean

lastPage

public DataGraphAccessBean lastPage()
                             throws com.ibm.websphere.wdo.mediator.exception.MediatorException,
                                    java.io.IOException
Moves to the first page of DataObjects
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

nextPage

public DataGraphAccessBean nextPage()
                             throws com.ibm.websphere.wdo.mediator.exception.MediatorException,
                                    java.io.IOException
Resets the position of the DataList so that on the next iteration, the next page of DataObjects will be returned. Pagination is usually implemented by sorting the output, and remembering the values of the sort columns of the first/last DataObject of each page. When fetching the DataObjects for a page, the DataList will append a clause along the lines of "<sort column value>GTR <previous page sort col value>"
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

previousPage

public DataGraphAccessBean previousPage()
                                 throws com.ibm.websphere.wdo.mediator.exception.MediatorException,
                                        java.io.IOException
Resets the position of the DataList so that on the next iteration, the previous page of DataObjects will be returned.
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

removeOrderBy

public void removeOrderBy(java.lang.String name)
                   throws java.io.IOException,
                          com.ibm.websphere.wdo.mediator.exception.MediatorException
Removes an Order By added for a given property
Parameters:
name - name of column to be removed from order-by list.
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  
java.io.IOException -  

setAutoCloseConnection

public void setAutoCloseConnection(boolean autoclose)
By default the connection is opened before any fill or flush operation. Pass false to this method to to overdie this behavor and the client becomes resposible for closing the DB connection.
Parameters:
autoclose -  

setConnectionName

public void setConnectionName(java.lang.String name)
Set the connection name There are two ways a data source can be specified as a string. The first way is through a JNDI relative path, assuming a container supporting JNDI. For example, with the absolute JNDI resource path java:comp/env/jdbc/ myDatabase, the JNDI relative path to the data source resource would simply be jdbc/myDatabase, given that java:comp/env is the standard JNDI root for a J2EE application. The second way is by specifying the parameters needed by the JDBC DriverManager class, using the following syntax url,driver,user,password For example, jdbc:mysql://localhost/,org.gjt.mm.mysql.Driver,admin,password where the database has been setup for access without any username or password. If the ‘,’ character occurs in any of the JDBC parameters, it can be escaped by ‘\’. The character ‘\’ itself can be escaped in the same way. While the JDBC DriverManager class provides a low cost way to use SQL actions, it is not recommended to use it other than for prototyping purposes because it does not provide connection management features one can expect from a properly designed DataSource object.
Parameters:
name -  

setConnectionWrapper

public void setConnectionWrapper(com.ibm.websphere.wdo.mediator.rdb.ConnectionWrapper wrapper)
Set the DataDase conenction as a ConnectionWrapper object
Parameters:
wrapper -  

setFilter

public com.ibm.websphere.wdo.mediator.rdb.metadata.Filter setFilter(java.lang.String tableName,
                                                                    java.lang.String predicate,
                                                                    java.lang.String[] argNames,
                                                                    int[] argTypes)
                                                             throws java.io.IOException,
                                                                    com.ibm.websphere.wdo.mediator.exception.MediatorException
Create a new Filter of the a given database table The filter can be any valid SQL where clause. Variable arguments are ?s in the cluase. Each argument needs to be defined as Filter Arguments To filter a CUSTOMER table to only NAMEs that start with an S you would do: setFilter("CUSTOMER", "NAME LIKE s%", new String[0], new int[0]); To filter a CUSTOMER table to only a NAME passed in by a variable you would do: setFilter("CUSTOMER", "NAME = ?", {"arg1"}, {JDBCMediatorAccessBean.STRING}); To resolve this argument you would get it in the params Map i.e. getParams().put("arg1", "John");
Parameters:
tableName -  
predicate -  
argNames -  
argTypes -  
Returns:
@throws IOException
Throws:
com.ibm.websphere.wdo.mediator.exception.MediatorException -  

setPageSize

public void setPageSize(int size)
Specify the desired number of DataObjects per page. The resultSet cannot stop between two DataObjects with identical values in the sort columns, so more DataObjects may be returned
Parameters:
targetPagesize - the desired number of DataObjects per page