|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.iplanet.jato.model.DefaultModel | +--com.iplanet.jato.model.sql.ResultSetModelBase | +--com.iplanet.jato.model.sql.StoredProcModelBase
A model implementation that uses a stored procedure as its backing data store
StoredProcSchema
,
StoredProcParameterDescriptor
, Serialized FormInner classes inherited from class com.iplanet.jato.model.DefaultModel |
DefaultModel.Context, DefaultModel.RowValueArrayList |
Field Summary | |
static boolean |
DEBUG_TRACE_PROC
|
protected static boolean |
OPTION_UNILATERALLY_REGISTER_INPUT_TYPE
In general, we do not recommend setting this value to true, as it may require the values provided to the JDBC driver to be coerced to either a specific Java type or a JDBC-driver specific type (Oracle does the latter for example). |
static java.lang.String |
RESULT_PARAM_NAME
|
Fields inherited from class com.iplanet.jato.model.sql.ResultSetModelBase |
DEBUG_NEXTROW, DEBUG_POS_RESULTSET, DEBUG_SYNCROW, DEBUG_UPDATE_MODEL, OPTION_COERCE_CACHED_RESULT_SET_VALUES, OPTION_COERCE_VALUE_TYPES, SYNCROW_ALREADY_SYNCHRONIZED, SYNCROW_FOUND_DATA, SYNCROW_NO_MORE_DATA |
Fields inherited from class com.iplanet.jato.model.DefaultModel |
DEFAULT_CONTEXT_NAME, UNDEFINED_ROW_INDEX |
Constructor Summary | |
StoredProcModelBase()
Default constructor |
|
StoredProcModelBase(StoredProcSchema schema)
Creates a StoredProcModelBase object |
Method Summary | |
protected void |
afterExecute(ModelExecutionContext context,
java.sql.CallableStatement statement)
Invoked as notification that this model has just successfully completed execution. |
protected java.lang.String |
beforeExecute(ModelExecutionContext context,
java.lang.String sql)
Invoked as notification that this model is about to be executed. |
void |
clear()
Clears all values (from all rows) in this model |
void |
clearParameterValues()
Clears all cached parameter values. |
protected java.lang.String |
constructProcedureSQL()
|
java.lang.Object |
execute(ModelExecutionContext context)
Execute the model. |
java.lang.Object |
executeProcedure(ModelExecutionContext context)
Executes the model's associated stored procedure, using the provided execution context |
java.lang.String |
getDataSourceName()
Returns the logical name of the SQL datasource this model uses. |
java.sql.Connection |
getDefaultConnection()
Returns a default JDBC connection. |
java.lang.String |
getDefaultConnectionPassword()
Return the password that will be used when allocating a default JDBC connection. |
java.lang.String |
getDefaultConnectionUser()
Return the username that will be used when allocating a default JDBC connection. |
java.lang.Class |
getFieldClass(java.lang.String name)
We override this method in the subclass in order to allow lookup of a field type that is either a parameter or a result set column. |
java.util.Map |
getOtherSQLTypeMap()
|
java.lang.Object |
getParameterValue(java.lang.String name)
Returns the named parameter value. |
StoredProcSchema |
getProcedureSchema()
Returns the schema containing the procedure metadata |
RequestContext |
getRequestContext()
Returns the current request context |
java.lang.Object |
getResultParameterValue()
Returns the result parameter value from the last execution of the procedure |
java.lang.Object |
getValue(java.lang.String name)
Returns a named value from this model. |
java.lang.Object[] |
getValues(java.lang.String name)
Returns a named set of values from this model. |
protected java.lang.Object |
mapOutputParameters(java.sql.CallableStatement statement)
Copies the CallableStatement output parameters into the model's value cache. |
protected java.sql.ResultSet |
obtainResultSet(java.sql.CallableStatement statement)
Return the callable statement's result set. |
protected void |
onDatabaseError(ModelExecutionContext context,
java.sql.SQLException exception)
Invoked as notification that this model encountered a SQLException. |
protected void |
registerParameters(java.sql.CallableStatement statement)
Prepares the CallableStatement prior to execution. |
void |
removeParameterValue(java.lang.String name)
Removes the named parameter value. |
void |
setDataSourceName(java.lang.String value)
Sets the logical name of the SQL datasource this model uses. |
void |
setDefaultConnectionPassword(java.lang.String value)
Set the password that will be used when allocating a default JDBC connection. |
void |
setDefaultConnectionUser(java.lang.String value)
Set the username that will be used when allocating a default JDBC connection. |
void |
setOtherSQLTypeMap(java.util.Map value)
|
void |
setParameterValue(java.lang.String name,
java.lang.Object value)
Sets the named parameter value. |
void |
setProcedureSchema(StoredProcSchema value)
Sets the schema that is used by this model to prepare the stored procedure statement. |
void |
setRequestContext(RequestContext value)
Sets the request context |
protected void |
setResultParameterValue(java.lang.Object value)
Sets the RESULT parameter value. |
Methods inherited from class com.iplanet.jato.model.sql.ResultSetModelBase |
beforeFirst, clearResultSet, first, getFieldSchema, getLocation, getLocationOffset, getResultSet, getSize, getValueMap, hasMoreResults, hasPreviousResults, hasValue, last, next, positionResultSet, positionResultSet, previous, resolveResultSetColumnSet, setFieldSchema, setLocation, setLocationOffset, setMoreResults, setPreviousResults, setResultSet, setSize, setValue, setValues, synchronizeRow, updateModel |
Methods inherited from class com.iplanet.jato.model.DefaultModel |
addContext, appendRow, checkRowIndex, clearModelData, createValueMap, dumpValues, dumpValues, ensureRow, getContext, getContextNames, getCurrentContext, getCurrentContextName, getDefaultValue, getDefaultValueMap, getDefaultValues, getName, getNumRows, getRowIndex, getRowList, getValueMap, initializeDefaultContext, insertRow, isDefaultContext, isUseDefaultValues, removeContext, selectContext, selectDefaultContext, setDefaultValue, setDefaultValues, setName, setNumRows, setRowIndex, setRowList, setUseDefaultValues |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.iplanet.jato.model.Model |
getName, setName, setValue, setValues |
Field Detail |
public static final java.lang.String RESULT_PARAM_NAME
public static final boolean DEBUG_TRACE_PROC
protected static final boolean OPTION_UNILATERALLY_REGISTER_INPUT_TYPE
Constructor Detail |
public StoredProcModelBase()
public StoredProcModelBase(StoredProcSchema schema)
StoredProcModelBase
objectschema
- The schema containing the procedure metadataMethod Detail |
public java.lang.String getDataSourceName()
SQLModel
jdbc/MyDataSource
or
jdbc/MyApp/MyDataSource
getDataSourceName
in interface SQLModel
com.iplanet.jato.model.sql.SQLModel
public void setDataSourceName(java.lang.String value)
jdbc/MyDataSource
or
jdbc/MyApp/MyDataSource
value
- The logical datasource namepublic StoredProcSchema getProcedureSchema()
StoredProcModel
getProcedureSchema
in interface StoredProcModel
public void setProcedureSchema(StoredProcSchema value)
value
- The schema containing the procedure metadataprotected java.lang.String beforeExecute(ModelExecutionContext context, java.lang.String sql) throws ModelControlException
context
- The ModelExecutionContext specific to the current execution.sql
- The SQL program.ModelControlException
- protected void afterExecute(ModelExecutionContext context, java.sql.CallableStatement statement) throws ModelControlException
onDatabaseError
is invoked instead.context
- The ModelExecutionContext specific to the current execution.statement
- The CallableStatement that was just executed.ModelControlException
- protected void onDatabaseError(ModelExecutionContext context, java.sql.SQLException exception)
context
- The ModelExecutionContext specific to the current execution.exception
- The SQLException.public java.lang.Object execute(ModelExecutionContext context) throws ModelControlException
ExecutingModel
execute
in interface ExecutingModel
com.iplanet.jato.model.ExecutingModel
context
- The execution context that specifies detail information pertinent
to the execution of this modelModelControlException
- Thrown if an error occurs executing the modelpublic java.lang.Object executeProcedure(ModelExecutionContext context) throws java.sql.SQLException, ModelControlException
StoredProcModel
executeProcedure
in interface StoredProcModel
com.iplanet.jato.model.sql.StoredProcModel
context
- The execution context to be used during the execution of this
querygetResultParameterValue()
method.protected java.sql.ResultSet obtainResultSet(java.sql.CallableStatement statement) throws java.sql.SQLException
getResutSet()
.
If your JDBC driver requires a different technique, override this method
to retrieve the result in the proper way. Also, note that this model
implementation only supports the return of a single result set (via
this method).statement
- The most-recently executed CallableStatement
object, potentially containing a result set.public RequestContext getRequestContext()
public void setRequestContext(RequestContext value)
RequestParticipant
setRequestContext
in interface RequestParticipant
com.iplanet.jato.RequestParticipant
requestContext
- The request context of the current requestpublic java.sql.Connection getDefaultConnection() throws java.sql.SQLException
SQLModelExecutionContext
.public java.lang.String getDefaultConnectionUser()
public void setDefaultConnectionUser(java.lang.String value)
null
will result in a username & password not being used
when obtaining a default connection.
Note: this value may not be necessary if the JDBC
connection string or JDBC DataSource includes or has already been
configured to use a username & password.value
- A valid username, or null to disable use of a username
& password when obtaining a default connectionpublic java.lang.String getDefaultConnectionPassword()
public void setDefaultConnectionPassword(java.lang.String value)
value
- A valid password for the current default connection userprotected java.lang.String constructProcedureSQL()
protected void registerParameters(java.sql.CallableStatement statement) throws java.sql.SQLException
statement
- The CallableStatement prior to its execution.java.sql.SQLException
- protected java.lang.Object mapOutputParameters(java.sql.CallableStatement statement) throws java.sql.SQLException
statement
- The CallableStatement that was just executed.public java.util.Map getOtherSQLTypeMap()
public void setOtherSQLTypeMap(java.util.Map value)
public java.lang.Class getFieldClass(java.lang.String name)
getFieldClass
in class ResultSetModelBase
public java.lang.Object getValue(java.lang.String name)
getValue
in interface Model
getValue
in class DefaultModel
name
- The name of the value to returnpublic java.lang.Object[] getValues(java.lang.String name)
getValues
in interface Model
getValues
in class DefaultModel
name
- The name of the value set to returnpublic java.lang.Object getResultParameterValue()
StoredProcModel
getResultParameterValue
in interface StoredProcModel
protected void setResultParameterValue(java.lang.Object value)
value
- The value of the RESULT parameterpublic java.lang.Object getParameterValue(java.lang.String name)
StoredProcModel
getParameterValue
in interface StoredProcModel
com.iplanet.jato.model.sql.StoredProcModel
name
- The logical parameter name. This name identifies the parameter
descriptor that will be used to look up the physical parameter
name used for procedure execution.public void setParameterValue(java.lang.String name, java.lang.Object value)
StoredProcModel
setParameterValue
in interface StoredProcModel
com.iplanet.jato.model.sql.StoredProcModel
name
- The logical parameter name. This name identifies the parameter
descriptor that will be used to look up the physical parameter
name used for procedure execution.value
- The value of the IN or INOUT parameter to setpublic void removeParameterValue(java.lang.String name)
StoredProcModel
removeParameterValue
in interface StoredProcModel
com.iplanet.jato.model.sql.StoredProcModel
name
- The logical parameter name. This name identifies the parameter
descriptor that will be used to look up the physical parameter
name used for procedure execution.public void clearParameterValues()
StoredProcModel
clearParameterValues
in interface StoredProcModel
public void clear()
DefaultModel
clear
in class ResultSetModelBase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |