|
WebObjects 5.4.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.webobjects.jdbcadaptor.JDBCPlugIn
public class JDBCPlugIn
JDBCPlugIn is used to customize the JDBCAdaptor for a particular database and its JDBC driver. The JDBCPlugIn for a model can be specified in the model's connection dictionary. If it's left unspecified, the adaptor takes a guess.
JDBCPlugIn.plugInNameForURL(java.lang.String)| Nested Class Summary | |
|---|---|
protected static class |
JDBCPlugIn.LobEntry
|
| Field Summary | |
|---|---|
protected static String |
DefaultPlugInClassName
|
protected static String |
DefaultPlugInSuffix
|
| Constructor Summary | |
|---|---|
JDBCPlugIn(JDBCAdaptor adaptor)
Create a new JDBCPlugIn. |
|
| Method Summary | |
|---|---|
JDBCAdaptor |
adaptor()
Returns the JDBCAdaptor associated with this plugin. |
void |
assignTypeForAttribute(EOAttribute attribute)
The adaptor invokes this method to allow the JDBCPlugIn to customize the newly created attribute. |
boolean |
canDescribeStoredProcedure(String spName)
Deprecated. |
Properties |
connectionPropertiesForConnectionDictionary(NSDictionary connectionDictionary)
Returns a Properties object that should be used for setting up a connection environment. |
String |
connectionURL()
Returns the JDBC URL to use for connecting to the database. |
EOAttribute |
createAttributeForRow(NSDictionary row)
Deprecated. |
EOSQLExpressionFactory |
createExpressionFactory()
Creates a new JDBCExpresionFactory using the plugin's response to adaptor(). |
EOSchemaSynchronizationFactory |
createSchemaSynchronizationFactory()
Creates a new EOSynchronizationFactory using the plugin's response to adaptor(). |
EOSynchronizationFactory |
createSynchronizationFactory()
Deprecated. since 5.4 |
NSDictionary |
databaseInformation()
Deprecated. |
String |
databaseProductName()
Returns a string identifying the database. |
String |
defaultDriverName()
Returns a fully qualified name of the JDBC driver class that this plugin prefers to use. |
Class |
defaultExpressionClass()
Returns the Java Class to use as the expression class. |
EOSQLExpressionFactory |
expressionFactory()
Returns the JDBCExpressionFactory, creating a new one if necessary. |
Object |
fetchBLOB(ResultSet rs,
int column,
EOAttribute attribute,
boolean materialize)
Fetch a BLOB. |
Object |
fetchCLOB(ResultSet rs,
int column,
EOAttribute attribute,
boolean materialize)
Fetch a CLOB. |
boolean |
isDroppedConnectionException(JDBCAdaptorException exception)
Returns true if exception is considered a
"dropped" connection; otherwise false. |
boolean |
isPseudoColumnName(String columnName)
Determines if the column is a "pseudo" column. |
NSDictionary |
jdbcInfo()
Returns database-specific information about the JDBC data source. |
int |
jdbcTypeForUnknownExternalType(String externalType,
int precision,
int scale)
Returns a JDBC type that might be more useful than Types.OTHER. |
String |
name()
Returns the plugin's name. |
NSArray |
newPrimaryKeys(int count,
EOEntity entity,
JDBCChannel channel)
Generates a batch of new primary keys for entity. |
String |
newPrimaryKeySelectString(String pkTableName,
String entityRootName)
The statement for selecting the primary key for a given entity. |
static String |
plugInNameForURL(String url)
Returns the class name of the JDBCPlugIn that should be used with the given JDBC URL url. |
Object |
plugInValueForValue(Object value,
EOAttribute attribute)
Allows the plugIn to influence the value seen by JDBCAdaptor.fetchedValueForValue. |
String |
primaryKeyLockString(String pkTableName,
String entityRootName)
|
String |
primaryKeyTableCreateString(String pkTableName,
EOSQLExpression getRowExpr,
EOAttribute primAttribute)
The statement for creating the primaryKeyTable can be overridden here. |
String |
primaryKeyTableName()
Default returns "EO_PK_TABLE". |
static void |
removePlugInNameForSubprotocol(String subprotocol)
Removes any special internal mapping associated with subprotocol that might have been used to guess a plugin an
appropriate plugin. |
String |
schemaNameForEntity(EOEntity entity)
Return the schema associated with entity. |
EOSchemaSynchronizationFactory |
schemaSynchronizationFactory()
Returns the EOSynchronizationFactory, creating a new one if necessary. |
static void |
setPlugInNameForSubprotocol(String pluginName,
String subprotocol)
Sets the internal mapping of subprotocol to
pluginName for guessing which plugin to use. |
String |
sqlStatementForGettingProcedureNames()
Deprecated. |
String |
sqlStatementForGettingTableNames()
Deprecated. |
String |
sqlStatementForTableNamed(String tablename)
Deprecated. |
String |
storedProcedureCatalogPattern()
The standard reverse engineering implementation for stored procedures calls this method to get the catalog pattern used with the JDBC method getProcedures. |
EOStoredProcedure |
storedProcedureNamed(String spName,
JDBCChannel channel,
NSDictionary jdbcTypeDictionary)
Deprecated. |
String |
storedProcedureSchemaPattern()
The standard reverse engineering implementation for stored procedures calls this method to get the schema pattern used with the JDBC method getProcedures. |
EOSynchronizationFactory |
synchronizationFactory()
Deprecated. since 5.4 |
String[] |
tableTypes()
Return an array of Strings to use for describing the table types in the JDBC getTables method call. |
void |
updateLOBs(JDBCChannel channel,
JDBCExpression expr,
NSDictionary row,
EOEntity entity)
Update LOBs (BLOBs and CLOBs). |
String |
wildcardPatternForAttributes()
Return the String to use for describing the column pattern in the JDBC getColumns method call. |
String |
wildcardPatternForSchema()
Return the String to use for describing the schema pattern in the JDBC getTables method call. |
String |
wildcardPatternForTables()
Return the String to use for describing the table pattern in the JDBC getTables method call. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String DefaultPlugInSuffix
protected static final String DefaultPlugInClassName
| Constructor Detail |
|---|
public JDBCPlugIn(JDBCAdaptor adaptor)
| Method Detail |
|---|
public JDBCAdaptor adaptor()
public String name()
public String connectionURL()
JDBCAdaptor.connectionDictionaryURL()public Properties connectionPropertiesForConnectionDictionary(NSDictionary connectionDictionary)
JDBCAdaptor.username(),
JDBCAdaptor.password()
public static void setPlugInNameForSubprotocol(String pluginName,
String subprotocol)
subprotocol to
pluginName for guessing which plugin to use. The
subprotocol is the second term in a JDBC URL.
pluginName - a String naming the plugin classsubprotocol - a JDBC subprotocolJDBCPlugIn.removePlugInNameForSubprotocol(java.lang.String)public static void removePlugInNameForSubprotocol(String subprotocol)
subprotocol that might have been used to guess a plugin an
appropriate plugin.
subprotocol - a JDBC subprotocolJDBCPlugIn.setPlugInNameForSubprotocol(java.lang.String, java.lang.String)public static String plugInNameForURL(String url)
url. The method considers the subprotocol
of the url and looks for a match that was established by
setPlugInNameForSubprotocol. If there is no match, it
uses a default mapping of the form: "com.webobjects.jdbcadaptor.SubPlugIn",
where Sub is replaced by the capitalized subprotocol string.
For example, the URL "jdbc:oracle:thin:@myserver:1521:sid" maps to
"com.webobjects.jdbcadaptor.OraclePlugIn". The default mapping can be
overridden at start-up by the following Java Properties:jdbcadaptor.plugin.subprotocols - a colon-separated
list of subprotocols that might have designated pluginsjdbcadaptor.SUB.plugin - for a
subprotocol SUB, the property defines the class name of the
default plugin; SUB must be listed in
jdbcadaptor.plugin.subprotocols
JDBCPlugIn.setPlugInNameForSubprotocol(java.lang.String, java.lang.String)public String databaseProductName()
public String defaultDriverName()
@Deprecated public NSDictionary databaseInformation()
public Class defaultExpressionClass()
JDBCExpression,
JDBCAdaptor.defaultExpressionClass()public EOSQLExpressionFactory createExpressionFactory()
adaptor(). Subclasses rarely need to override this.
JDBCPlugIn.expressionFactory()public EOSQLExpressionFactory expressionFactory()
JDBCPlugIn.createExpressionFactory()public EOSchemaSynchronizationFactory createSchemaSynchronizationFactory()
adaptor(). The default EOSynchronizationFactory supports
only basic SQL table generation. Subclasses need to override this method
to support schema synchronization.
JDBCPlugIn.synchronizationFactory()public EOSchemaSynchronizationFactory schemaSynchronizationFactory()
JDBCPlugIn.createSynchronizationFactory()@Deprecated public EOSynchronizationFactory createSynchronizationFactory()
adaptor(). The default EOSynchronizationFactory supports
only basic SQL table generation. Subclasses need to override this method
to support schema synchronization.
JDBCPlugIn.synchronizationFactory()@Deprecated public EOSynchronizationFactory synchronizationFactory()
JDBCPlugIn.createSynchronizationFactory()public String primaryKeyTableName()
JDBCPlugIn.newPrimaryKeys(int, com.webobjects.eoaccess.EOEntity, com.webobjects.jdbcadaptor.JDBCChannel)public String wildcardPatternForAttributes()
getColumns method call. This is used for reverse
engineering. The default implementation returns "%".
public String wildcardPatternForTables()
getTables method call. This is used for reverse
engineering. The default implementation returns "%".
public String wildcardPatternForSchema()
getTables method call. This is used for reverse
engineering. The default implementation returns null.
public String schemaNameForEntity(EOEntity entity)
entity. This is used as
an argument to the JDBC method getColumns when reverse
engineering. The default implementation gets the schema from the
externalName of the entity.
EOEntity.externalName()public String[] tableTypes()
getTables method call. This is used for reverse
engineering. The default implementation returns
{"TABLE", "VIEW", "ALIAS", "SYNONYM"}.
@Deprecated public String sqlStatementForGettingTableNames()
getTables.
Subclasses might override this method.
@Deprecated public boolean canDescribeStoredProcedure(String spName)
true if the plugin has a private way of describing
the stored procedure named spName when reverse
engineering. The default implementation returns false
indicating that the adaptor should use the normal JDBC API to reverse
engineer the the stored procedure.
spName - the name of a stored procedure
@Deprecated
public EOStoredProcedure storedProcedureNamed(String spName,
JDBCChannel channel,
NSDictionary jdbcTypeDictionary)
canDescribeStoredProcedure returns true,
this method is called to reverse engineer the stored procedure. The
default implementation returns null. Most plugins do not
need to override this.
spName - the name of a stored procedurechannel - a JDBCChannel (already connected)jdbcTypeDictionary - an NSDictionary describing the external types@Deprecated public String sqlStatementForGettingProcedureNames()
null to
indicate that the JDBC API should be used for reverse engineering stored
procedures. Subclasses can implement a private scheme for reverse
engineering stored procedures by returning a SQL statement to be used for
fetching stored procedures names. The SQL statement should return a
result set with one column named 'name'.
public String storedProcedureCatalogPattern()
getProcedures. The default implementation returns
null.
JDBCPlugIn.storedProcedureSchemaPattern()public String storedProcedureSchemaPattern()
getProcedures. The default implementation returns
null.
JDBCPlugIn.storedProcedureCatalogPattern()@Deprecated public String sqlStatementForTableNamed(String tablename)
@Deprecated public EOAttribute createAttributeForRow(NSDictionary row)
public String newPrimaryKeySelectString(String pkTableName,
String entityRootName)
SELECT PK FROM EO_PK_TABLE WHERE NAME = 'MOVIE' FOR UPDATE
public String primaryKeyLockString(String pkTableName,
String entityRootName)
public String primaryKeyTableCreateString(String pkTableName,
EOSQLExpression getRowExpr,
EOAttribute primAttribute)
CREATE TABLE (NAME CHAR(40), PK INTEGER)
public NSArray newPrimaryKeys(int count,
EOEntity entity,
JDBCChannel channel)
entity. It
should return an NSArray of NSDictionary where each dictionary
corresponds to a unique primary key value. The count of the NSArray
should match count. The JDBChannel channel
is already open and ready to use. If the primary key contains multiple
attributes or is not of kind number, then the default implementation
returns null. The default implementation uses a table named according to
primaryKeyTableName containing the table name and the last
primary key inserted in this table. If the row for a table name is not
present, then it is automatically created. If the
primaryKeyTableName table does not exists then it is
automatically created. Subclasses should override the default
implementation if they want to provide a more efficient mechanism for
generating primary keys.
count - the batch sizeentity - the entity requesting primary keyschannel - an open JDBCChannelJDBCPlugIn.primaryKeyTableName(),
EOEntity.primaryKeyAttributes()
public Object fetchBLOB(ResultSet rs,
int column,
EOAttribute attribute,
boolean materialize)
throws SQLException
null.
rs - the current ResultSetcolumn - the column index corresponding to the BLOBattribute - the attribute mapped to the BLOBmaterialize - a boolean that determines if the BLOB should be fully
"materialized" (if true) or left as a
reference (if false)
SQLExceptionJDBCPlugIn.updateLOBs(com.webobjects.jdbcadaptor.JDBCChannel, com.webobjects.jdbcadaptor.JDBCExpression, com.webobjects.foundation.NSDictionary, com.webobjects.eoaccess.EOEntity)
public Object fetchCLOB(ResultSet rs,
int column,
EOAttribute attribute,
boolean materialize)
throws SQLException
null.
rs - the current ResultSetcolumn - the column index corresponding to the CLOBattribute - the attribute mapped to the CLOBmaterialize - a boolean that determines if the CLOB should be fully
"materialized" (if true) or left as a
reference (if false)
SQLExceptionJDBCPlugIn.updateLOBs(com.webobjects.jdbcadaptor.JDBCChannel, com.webobjects.jdbcadaptor.JDBCExpression, com.webobjects.foundation.NSDictionary, com.webobjects.eoaccess.EOEntity)
public void updateLOBs(JDBCChannel channel,
JDBCExpression expr,
NSDictionary row,
EOEntity entity)
channel - an open JDBCChannelexpr - the JDBCExpression used to perform the insert or updaterow - an NSDictionary of the row values used in the insert or updateentity - the entity of the row that was inserted or updatedJDBCPlugIn.fetchBLOB(java.sql.ResultSet, int, com.webobjects.eoaccess.EOAttribute, boolean),
JDBCPlugIn.fetchCLOB(java.sql.ResultSet, int, com.webobjects.eoaccess.EOAttribute, boolean)public NSDictionary jdbcInfo()
public int jdbcTypeForUnknownExternalType(String externalType,
int precision,
int scale)
Types.OTHER. Some JDBC drivers return
Types.OTHER for external types that actually match better
to a well known type. This method provides the plugin a chance to
substitute a better JDBC type when reverse engineering. The default
implementation specifically recognizes BLOB and
CLOB external types as mapping to Types.BLOB
and Types.CLOB. If no better type is known, the method
should return Types.OTHER.
public void assignTypeForAttribute(EOAttribute attribute)
attribute - an EOAttributeEOAdaptor.assignExternalTypeForAttribute(com.webobjects.eoaccess.EOAttribute),
EOAdaptorChannel.describeResults()public boolean isPseudoColumnName(String columnName)
CREATE TABLE statement, but was
created automatically by the database. These columns usually should not
be considered for reverse engineering.
true if the column should not be reverse
engineered; false otherwisepublic boolean isDroppedConnectionException(JDBCAdaptorException exception)
true if exception is considered a
"dropped" connection; otherwise false. The adaptor will
try to reconnect automatically from a dropped connection. The decision is
based on the SQLState of the underlying SQLException that
is wrapped by the JDBCAdaptorException. For any other type of Exception,
this method returns false.
true if exception is a "dropped"
connection; otherwise false
public Object plugInValueForValue(Object value,
EOAttribute attribute)
JDBCAdaptor.fetchedValueForValue. By default, it returns
NSKeyValueCoding.NullValue if value is
null; otherwise, value is returned unchanged.
value - the original valueattribute - the attribute corresponding to the database column in which
value would be stored
fetchedValueForValueJDBCAdaptor.fetchedValueForValue(java.lang.Object, com.webobjects.eoaccess.EOAttribute)
|
Last updated June 2008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||