All Packages This Package Previous Next
Class sqlj.runtime.profile.util.DataCustomizer
java.lang.Object
|
+----sqlj.runtime.profile.util.DataCustomizer
- public class DataCustomizer
- extends Object
A data customizer object provides a framework for customizing a profile
data object. For each data member in the original profile data object,
a "customizeXXX" method is called. Subclasses will override the
"customizeXXX" methods that they want to provide with special behavior,
and leave all other methods to the default implementation which keeps
the data member as it originally appeared.
If no subclass overrides any method to customize part of the profile
data object, then the original profile data object is used unchanged.
This object keeps track of which data members were changed and were not
changed to only create a new profile data object (or entry info or type
info object) when the original has been modified. Thus, data will be
shared with the original profile whenever possible.
If a new profile data, entry info or type info object is required,
the reference implementation (package jsq.runtime.profile.ref) of these
classes is used. Subclasses may also override the "newXXX" methods to
create their own profile data, entry info or type info object instead of
the reference implementations.
-
PARAM
- Constant used to indicate a type info object that represents an entry
parameter.
-
RESULT
- Constant used to indicate a type info object that represents an entry
result.
-
DataCustomizer()
-
-
customizeData(ProfileData)
- Returns a customized version of the the passed profile data object.
-
customizeDescriptor(ProfileData, EntryInfo, int)
- Returns a customized version of the descriptor component of the passed
entry info object, which appears at index "entryNum" in profile data
object "data".
-
customizeEntry(ProfileData, EntryInfo, int)
- Returns a customized version of the passed entry info object,
which appears at index "entryNum" in profile data object "data".
-
customizeExecType(ProfileData, EntryInfo, int)
- Returns a customized version of the execute type component of the passed
entry info object, which appears at index "entryNum" in profile data
object "data".
-
customizeJavaTypeName(ProfileData, EntryInfo, int, TypeInfo, int, int)
- Returns a customized version of the java type name component of the
passed type info object, which appears at index "typeNum" in the entry
info object "entry", which appears at index "entryNum" in profile data
object "data".
-
customizeLineNumber(ProfileData, EntryInfo, int)
- Returns a customized version of the source file line number component
of the passed entry info object, which appears at index "entryNum" in
profile data object "data".
-
customizeMarkerIndex(ProfileData, EntryInfo, int, TypeInfo, int, int)
- Returns a customized version of the marker index component of the
passed type info object, which appears at index "typeNum" in the entry
info object "entry", which appears at index "entryNum" in profile data
object "data".
-
customizeMode(ProfileData, EntryInfo, int, TypeInfo, int, int)
- Returns a customized version of the mode component of the passed
type info object, which appears at index "typeNum" in the entry info
object "entry", which appears at index "entryNum" in profile data
object "data".
-
customizeName(ProfileData, EntryInfo, int, TypeInfo, int, int)
- Returns a customized version of the name component of the passed
type info object, which appears at index "typeNum" in the entry info
object "entry", which appears at index "entryNum" in profile data
object "data".
-
customizeResultSetName(ProfileData, EntryInfo, int)
- Returns a customized version of the result set name component of the
passed entry info object, which appears at index "entryNum" in profile
data object "data".
-
customizeResultSetType(ProfileData, EntryInfo, int)
- Returns a customized version of the result set type component of the
passed entry info object, which appears at index "entryNum" in profile
data object "data".
-
customizeRole(ProfileData, EntryInfo, int)
- Returns a customized version of the role component of the passed
entry info object, which appears at index "entryNum" in profile data
object "data".
-
customizeSourceFile(ProfileData)
- Returns a customized version of the source file component of the
passed profile data object.
-
customizeSQLString(ProfileData, EntryInfo, int)
- Returns a customized version of the sql string component of the passed
entry info object, which appears at index "entryNum" in profile data
object "data".
-
customizeSQLType(ProfileData, EntryInfo, int, TypeInfo, int, int)
- Returns a customized version of the sql type component of the passed
type info object, which appears at index "typeNum" in the entry info
object "entry", which appears at index "entryNum" in profile data
object "data".
-
customizeStatementType(ProfileData, EntryInfo, int)
- Returns a customized version of the statement type component of the
passed entry info object, which appears at index "entryNum" in profile
data object "data".
-
customizeType(ProfileData, EntryInfo, int, TypeInfo, int, int)
- Returns a customized version of the passed type info object, which
appears at index "typeNum" in the entry info object "entry", which
appears at index "entryNum" in profile data object "data".
-
main(String[])
- The testing entry point for a data customizer.
-
newEntryInfo(ProfileData, EntryInfo, int, String, int, int, int, int, Object, TypeInfo[], TypeInfo[], int, String)
- Creates and returns a new entry info object whose data corresponds
to the values passed.
-
newProfileData(ProfileData, EntryInfo[], Profile, String)
- Creates and returns a new profile data object whose data corresponds
to the values passed.
-
newTypeInfo(ProfileData, EntryInfo, int, TypeInfo, int, int, String, int, String, int, int)
- Creates and returns a new type info object whose data corresponds
to the values passed.
RESULT
public static final int RESULT
- Constant used to indicate a type info object that represents an entry
result.
PARAM
public static final int PARAM
- Constant used to indicate a type info object that represents an entry
parameter.
DataCustomizer
public DataCustomizer()
customizeData
public ProfileData customizeData(ProfileData data)
- Returns a customized version of the the passed profile data object.
A profile data object is customized by customizing each of its components.
If a component has changed, the newProfileData method is called to
create a new profile data instance and populate it with the changed
data. Otherwise, the original profile data object is returned.
- Parameters:
- data - the profile data object to customize.
- Returns:
- a customized profile data object.
- See Also:
- newProfileData
customizeSourceFile
public String customizeSourceFile(ProfileData data)
- Returns a customized version of the source file component of the
passed profile data object. By default, the current source file
component of the data is returned. Subclasses should override this
method if nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the source file
to customize.
- Returns:
- a customized source file
- See Also:
- getSourceFile
newProfileData
public ProfileData newProfileData(ProfileData origData,
EntryInfo entries[],
Profile profile,
String sourceFile)
- Creates and returns a new profile data object whose data corresponds
to the values passed. By default, the reference implementation of the
profile data class is used. Subclasses whould override if another
class is to be substituted instead.
- Parameters:
- origData - the original profile data object.
- entries - the new entires for the profile data object.
- profile - the profile associated with the new profile data object.
- sourceFile - the customized name of the source file for this profile
- Returns:
- a new profile data object.
- See Also:
- ProfileDataImpl
customizeEntry
public EntryInfo customizeEntry(ProfileData data,
EntryInfo entry,
int entryNum)
- Returns a customized version of the passed entry info object,
which appears at index "entryNum" in profile data object "data".
An entry info object is customized by customizing each of its components.
If a component has changed, the newEntryInfo method is called to
create a new entry info instance and populate it with the changed
data. Otherwise, the original entry info object is returned.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object to customize.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- Returns:
- a customized entry info object.
- See Also:
- newEntryInfo
newEntryInfo
public EntryInfo newEntryInfo(ProfileData origData,
EntryInfo origEntry,
int entryNum,
String sqlString,
int stmtType,
int execType,
int role,
int resultSetType,
Object desc,
TypeInfo params[],
TypeInfo results[],
int lineNumber,
String resultSetName)
- Creates and returns a new entry info object whose data corresponds
to the values passed. By default, the reference implementation of the
entry info class is used. Subclasses whould override if another
class is to be substituted instead.
- Parameters:
- origData - the original profile data object.
- origEntry - the original entry info object.
- entryNum - the index at which this entry appears in the profile data.
- sqlString - the new text of the sql operation
- stmtType - the new statement type of the entry
- execType - the new exceute type of the entry
- role - the new role of the entry
- resultSetType - the new result set type of the entry
- desc - the new descriptor of the entry
- params - the new set of parameters for the entry
- results - the new set of results for the entry
- lineNumber - the new source file line number for the entry
- resultSetName - the new result set name for the entry
- Returns:
- a new entry info object.
- See Also:
- EntryInfoImpl
customizeSQLString
public String customizeSQLString(ProfileData data,
EntryInfo entry,
int entryNum)
- Returns a customized version of the sql string component of the passed
entry info object, which appears at index "entryNum" in profile data
object "data". By default, the current sql string component of the
entry is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the sql string to customize.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- Returns:
- a customized sql string
- See Also:
- getSQLString
customizeResultSetName
public String customizeResultSetName(ProfileData data,
EntryInfo entry,
int entryNum)
- Returns a customized version of the result set name component of the
passed entry info object, which appears at index "entryNum" in profile
data object "data". By default, the current result set name component
of the entry is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the result set name to
customize.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- Returns:
- a customized result set name
- See Also:
- getResultSetName
customizeStatementType
public int customizeStatementType(ProfileData data,
EntryInfo entry,
int entryNum)
- Returns a customized version of the statement type component of the
passed entry info object, which appears at index "entryNum" in profile
data object "data". By default, the current statement type component
of the entry is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the statement type to
customize.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- Returns:
- a customized statement type
- See Also:
- getStatementType
customizeExecType
public int customizeExecType(ProfileData data,
EntryInfo entry,
int entryNum)
- Returns a customized version of the execute type component of the passed
entry info object, which appears at index "entryNum" in profile data
object "data". By default, the current execute type component of the
entry is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the execute type to
customize.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- Returns:
- a customized execute type
- See Also:
- getExecuteType
customizeRole
public int customizeRole(ProfileData data,
EntryInfo entry,
int entryNum)
- Returns a customized version of the role component of the passed
entry info object, which appears at index "entryNum" in profile data
object "data". By default, the current role component of the
entry is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the role to customize.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- Returns:
- a customized role
- See Also:
- getRole
customizeResultSetType
public int customizeResultSetType(ProfileData data,
EntryInfo entry,
int entryNum)
- Returns a customized version of the result set type component of the
passed entry info object, which appears at index "entryNum" in profile
data object "data". By default, the current result set type component
of the entry is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the result set type to
customize.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- Returns:
- a customized result set type
- See Also:
- getResultSetType
customizeDescriptor
public Object customizeDescriptor(ProfileData data,
EntryInfo entry,
int entryNum)
- Returns a customized version of the descriptor component of the passed
entry info object, which appears at index "entryNum" in profile data
object "data". By default, the current descriptor component of the
entry is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the descriptor to customize.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- Returns:
- a customized descriptor
- See Also:
- getDescriptor
customizeLineNumber
public int customizeLineNumber(ProfileData data,
EntryInfo entry,
int entryNum)
- Returns a customized version of the source file line number component
of the passed entry info object, which appears at index "entryNum" in
profile data object "data". By default, the current line number of
the entry is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the line number to customize.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- Returns:
- a customized line number
- See Also:
- getLineNumber
customizeType
public TypeInfo customizeType(ProfileData data,
EntryInfo entry,
int entryNum,
TypeInfo type,
int typeNum,
int typeRole)
- Returns a customized version of the passed type info object, which
appears at index "typeNum" in the entry info object "entry", which
appears at index "entryNum" in profile data object "data". The
"typeRole" parameter describes the way in which the type to customize
appears in the original entry info (either as a parameter or result).
A type info object is customized by customizing each of its
components. If a component has changed, the newTypeInfo method is
called to create a new type info instance and populate it with the
changed data. Otherwise, the original type info object is returned.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the type.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- type - the type info object to customize.
- typeNum - the index at whic the type appears in the entry either
as a result or parameter.
- typeRole - is RESULT if the type is a result, PARAM if the type
is a parameter in the corresponding entry.
- Returns:
- a customized type info object.
- See Also:
- newTypeInfo, RESULT, PARAM
newTypeInfo
public TypeInfo newTypeInfo(ProfileData origData,
EntryInfo origEntry,
int entryNum,
TypeInfo origType,
int typeNum,
int typeRole,
String javaType,
int sqlType,
String name,
int mode,
int markerIndex)
- Creates and returns a new type info object whose data corresponds
to the values passed. By default, the reference implementation of the
type info class is used. Subclasses whould override if another
class is to be substituted instead.
- Parameters:
- origData - the original profile data object.
- origEntry - the original entry info object.
- entryNum - the index at which this entry appears in the profile data.
- type - the type info object to customize.
- typeNum - the index at which the type appears in the entry either
as a result or parameter.
- typeRole - is RESULT if the type is a result, PARAM if the type
is a parameter in the corresponding entry.
- javaType - the name of the new java type of the type
- sqlType - the new sql type of the type
- name - the new name of the type
- mode - the new mode of the type
- markerIndex - the new marker index of the type
- Returns:
- a new type info object.
- See Also:
- TypeInfoImpl, RESULT, PARAM
customizeSQLType
public int customizeSQLType(ProfileData data,
EntryInfo entry,
int entryNum,
TypeInfo type,
int typeNum,
int typeRole)
- Returns a customized version of the sql type component of the passed
type info object, which appears at index "typeNum" in the entry info
object "entry", which appears at index "entryNum" in profile data
object "data". The "typeRole" parameter describes the way in which
the type to customize appears in the original entry info (either as a
parameter or result). By default, the current sql type component of
the type is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the type.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- type - the type info object to customize.
- typeNum - the index at whic the type appears in the entry either
as a result or parameter.
- typeRole - is RESULT if the type is a result, PARAM if the type
is a parameter in the corresponding entry.
- Returns:
- a customized sql type
- See Also:
- getSQLType
customizeJavaTypeName
public String customizeJavaTypeName(ProfileData data,
EntryInfo entry,
int entryNum,
TypeInfo type,
int typeNum,
int typeRole)
- Returns a customized version of the java type name component of the
passed type info object, which appears at index "typeNum" in the entry
info object "entry", which appears at index "entryNum" in profile data
object "data". The "typeRole" parameter describes the way in which
the type to customize appears in the original entry info (either as a
parameter or result). By default, the current java type name
component of the type is returned. Subclasses should override this
method if nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the type.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- type - the type info object to customize.
- typeNum - the index at whic the type appears in the entry either
as a result or parameter.
- typeRole - is RESULT if the type is a result, PARAM if the type
is a parameter in the corresponding entry.
- Returns:
- a customized java type name
- See Also:
- getJavaTypeName
customizeName
public String customizeName(ProfileData data,
EntryInfo entry,
int entryNum,
TypeInfo type,
int typeNum,
int typeRole)
- Returns a customized version of the name component of the passed
type info object, which appears at index "typeNum" in the entry info
object "entry", which appears at index "entryNum" in profile data
object "data". The "typeRole" parameter describes the way in which
the type to customize appears in the original entry info (either as a
parameter or result). By default, the current name component of
the type is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the type.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- type - the type info object to customize.
- typeNum - the index at whic the type appears in the entry either
as a result or parameter.
- typeRole - is RESULT if the type is a result, PARAM if the type
is a parameter in the corresponding entry.
- Returns:
- a customized name
- See Also:
- getName
customizeMode
public int customizeMode(ProfileData data,
EntryInfo entry,
int entryNum,
TypeInfo type,
int typeNum,
int typeRole)
- Returns a customized version of the mode component of the passed
type info object, which appears at index "typeNum" in the entry info
object "entry", which appears at index "entryNum" in profile data
object "data". The "typeRole" parameter describes the way in which
the type to customize appears in the original entry info (either as a
parameter or result). By default, the current mode component of
the type is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the type.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- type - the type info object to customize.
- typeNum - the index at whic the type appears in the entry either
as a result or parameter.
- typeRole - is RESULT if the type is a result, PARAM if the type
is a parameter in the corresponding entry.
- Returns:
- a customized mode
- See Also:
- getMode
customizeMarkerIndex
public int customizeMarkerIndex(ProfileData data,
EntryInfo entry,
int entryNum,
TypeInfo type,
int typeNum,
int typeRole)
- Returns a customized version of the marker index component of the
passed type info object, which appears at index "typeNum" in the entry
info object "entry", which appears at index "entryNum" in profile data
object "data". The "typeRole" parameter describes the way in which
the type to customize appears in the original entry info (either as a
parameter or result). By default, the current marker index component
of the type is returned. Subclasses should override this method if
nondefault behavior is desired.
- Parameters:
- data - the profile data object containing the entry.
- entry - the entry info object containing the type.
- entryNum - the 0-based index at which the entry occurs within the
profile data.
- type - the type info object to customize.
- typeNum - the index at whic the type appears in the entry either
as a result or parameter.
- typeRole - is RESULT if the type is a result, PARAM if the type
is a parameter in the corresponding entry.
- Returns:
- a customized marker index
- See Also:
- getMarkerIndex
main
public static void main(String args[]) throws Exception
- The testing entry point for a data customizer. This call is used for
unit testing only. It verifies that running the default customizer on
a particular profile produces an unchanged profile. It outputs
"failed" on failure, "success" on success. Outputs usage if no
arguments passed.
- Throws: Exception
- if an error occurs.
All Packages This Package Previous Next