|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.jdbcadaptor.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.
plugInNameForURL(java.lang.String)
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() . |
EOSynchronizationFactory |
createSynchronizationFactory()
Creates a new EOSynchronizationFactory using the plugin's response to adaptor() . |
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 |
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 . |
NSArray |
newPrimaryKeys(int count,
EOEntity entity,
JDBCChannel channel)
Generates a batch of new primary keys for entity . |
String |
newPrimaryKeySelectString(String pkTableName,
String entityRootName)
|
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 |
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 . |
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()
Returns the EOSynchronizationFactory, creating a new one if necessary. |
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 DefaultPlugInClassName
protected static final String DefaultPlugInSuffix
Constructor Detail |
public JDBCPlugIn(JDBCAdaptor adaptor)
Method Detail |
public JDBCAdaptor adaptor()
public void assignTypeForAttribute(EOAttribute attribute)
attribute
- an EOAttributeEOAdaptor.assignExternalTypeForAttribute(com.webobjects.eoaccess.EOAttribute)
,
EOAdaptorChannel.describeResults()
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 procedurepublic Properties connectionPropertiesForConnectionDictionary(NSDictionary connectionDictionary)
JDBCAdaptor.username()
,
JDBCAdaptor.password()
public String connectionURL()
JDBCAdaptor.connectionDictionaryURL()
public EOAttribute createAttributeForRow(NSDictionary row)
public EOSQLExpressionFactory createExpressionFactory()
adaptor()
. Subclasses rarely need to override
this.
expressionFactory()
public EOSynchronizationFactory createSynchronizationFactory()
adaptor()
. The default
EOSynchronizationFactory supports only basic SQL table
generation. Subclasses need to override this method to support
schema synchronization.
synchronizationFactory()
public NSDictionary databaseInformation()
public String databaseProductName()
public String defaultDriverName()
public Class defaultExpressionClass()
JDBCExpression
,
JDBCAdaptor.defaultExpressionClass()
public EOSQLExpressionFactory expressionFactory()
createExpressionFactory()
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
)
SQLException
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
)
SQLException
updateLOBs(com.webobjects.jdbcadaptor.JDBCChannel, com.webobjects.jdbcadaptor.JDBCExpression, com.webobjects.foundation.NSDictionary, com.webobjects.eoaccess.EOEntity)
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 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 String newPrimaryKeySelectString(String pkTableName, String entityRootName)
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 JDBCChannelprimaryKeyTableName()
,
EOEntity.primaryKeyAttributes()
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
setPlugInNameForSubprotocol(java.lang.String, java.lang.String)
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
fetchedValueForValue
JDBCAdaptor.fetchedValueForValue(java.lang.Object, com.webobjects.eoaccess.EOAttribute)
public String primaryKeyLockString(String pkTableName, String entityRootName)
public String primaryKeyTableName()
newPrimaryKeys(int, com.webobjects.eoaccess.EOEntity, com.webobjects.jdbcadaptor.JDBCChannel)
public static void removePlugInNameForSubprotocol(String subprotocol)
subprotocol
that might have been used
to guess a plugin an appropriate plugin.
subprotocol
- a JDBC subprotocolsetPlugInNameForSubprotocol(java.lang.String, java.lang.String)
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 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 subprotocolremovePlugInNameForSubprotocol(java.lang.String)
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 sqlStatementForGettingTableNames()
getTables
. Subclasses might override
this method.
public String sqlStatementForTableNamed(String tablename)
public String storedProcedureCatalogPattern()
getProcedures
. The default
implementation returns null
.
storedProcedureSchemaPattern()
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 typespublic String storedProcedureSchemaPattern()
getProcedures
. The default
implementation returns null
.
storedProcedureCatalogPattern()
public EOSynchronizationFactory synchronizationFactory()
createSynchronizationFactory()
public String[] tableTypes()
getTables
method call. This is used
for reverse engineering. The default implementation returns
{"TABLE", "VIEW", "ALIAS", "SYNONYM"}
.
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 updatedfetchBLOB(java.sql.ResultSet, int, com.webobjects.eoaccess.EOAttribute, boolean)
,
fetchCLOB(java.sql.ResultSet, int, com.webobjects.eoaccess.EOAttribute, boolean)
public String wildcardPatternForAttributes()
getColumns
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 wildcardPatternForTables()
getTables
method call. This is used
for reverse engineering. The default implementation returns
"%".
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |