|
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.eoaccess.EOAdaptor com.webobjects.jdbcadaptor.JDBCAdaptor
JDBCAdaptor is a concrete subclass of EOAdaptor that use JDBC for connecting to a database. It can be customized for a particular database and JDBC driver by using a JDBCPlugIn. Application code rarely needs to interact directly with an adaptor and should not normally use adaptor-specific API. All the useful API resides in EOAdaptor and the other generic EOAccess framework classes.
EOAdaptor
,
JDBCPlugIn
Nested Class Summary |
Nested classes inherited from class com.webobjects.eoaccess.EOAdaptor |
EOAdaptor.Delegate |
Field Summary | |
static String |
DataSourceJndiNameKey
Key for JNDI datasource name |
static String |
DriverKey
Key labeling the JDBC driver class name in the connection dictionary. |
static String |
JDBCInfoKey
Connection dictionary key labeling database-specific information contained in an NSDictionary, commonly referred to as "JDBC info". |
static String |
PasswordKey
Key labeling the password in the connection dictionary. |
static String |
PlugInKey
Key labeling the plugin class name in the connection dictionary. |
static String |
TypeInfoKey
Key labeling the NSDictionary of external type information in the JDBC info dictionary. |
static String |
URLKey
Key labeling the JDBC URL String in the connection dictionary. |
static String |
UsernameKey
Key labeling the user name in the connection dictionary. |
Constructor Summary | |
JDBCAdaptor(String name)
Create a JDBCAdaptor. |
Method Summary | |
void |
assertConnectionDictionaryIsValid()
Checks that the connectionary dictionary is valid by attempting to make a connection. |
void |
assignExternalTypeForAttribute(EOAttribute attribute)
Assigns an appropriate external type to the attribute . |
boolean |
canServiceModel(EOModel model)
Returns true if the adaptor is compatible with the model ;
false otherwise. |
protected String |
connectionDictionaryURL()
Returns the JDBC URL from the adaptor's connection dictionary. |
Properties |
connectionProperties()
Returns a Properties object specifying connection information. |
String |
connectionURL()
Returns the JDBC URL that should be used for connecting to the database as specified by the plugin. |
EOAdaptorContext |
createAdaptorContext()
Returns a new JDBCContext for this adaptor. |
EOAttribute |
createAttribute(String name,
String columnName,
int columnType,
String externalType,
int precision,
int scale,
int isNullable)
Returns a new EOAttribute based on the arguments. |
Class |
defaultExpressionClass()
Returns the expression class to use for this adaptor. |
String |
driverName()
Returns the JDBC driver's name. |
EOSQLExpressionFactory |
expressionFactory()
Returns the expression factory to use for this adaptor. |
String |
externalTypeForJDBCType(int type)
Returns the name of an external type that matches the given JDBC type type . |
NSArray |
externalTypesWithModel(EOModel model)
Returns an NSArray of external type names for the model . |
Object |
fetchedValueForValue(Object value,
EOAttribute attribute)
Calls super with the result of the plugIn's plugInValueForValue . |
protected static NSDictionary |
getJDBCInfoWithConnectionDictionary(NSDictionary connectionDictionary)
|
void |
handleDroppedConnection()
Handles cleaning up when a connection is dropped. |
boolean |
isDroppedConnectionException(Exception exception)
Returns true if exception is a
JDBCAdaptorException and it is considered a "dropped"
connection; otherwise false . |
boolean |
isValidQualifierType(String typeName,
EOModel model)
An abstract method that should be implemented by subclasses to return true if an attribute of type typeName
can be used in a qualifier (an SQL WHERE clause) sent to the database server,
false otherwise. |
protected NSDictionary |
jdbcInfo()
Returns an NSDictionary of database-specific information. |
String |
password()
Returns the password from the adaptor's connection dictionary. |
JDBCPlugIn |
plugIn()
Returns the JDBCPlugIn to use with this adaptor's connection dictionary. |
void |
setConnectionDictionary(NSDictionary dictionary)
Sets the adaptor's connection dictionary to dictionary ,
which must only contain String, NSData, NSDictionary, and NSArray
objects. |
static String |
stringRepresentationForJDBCType(int columnType)
|
EOSchemaGeneration |
synchronizationFactory()
Returns the EOSynchronizationFactory to use for this adaptor. |
protected NSDictionary |
typeInfo()
Returns an NSDictionary of external type information. |
protected static NSDictionary |
typeInfoForModel(EOModel model)
|
String |
username()
Returns the user name from the adaptor's connection dictionary. |
protected int |
varcharMaxLength()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String DataSourceJndiNameKey
public static final String DriverKey
public static final String JDBCInfoKey
jdbcInfo()
public static final String PasswordKey
public static final String PlugInKey
public static final String TypeInfoKey
public static final String URLKey
public static final String UsernameKey
Constructor Detail |
public JDBCAdaptor(String name)
EOAdaptor.adaptorWithModel(com.webobjects.eoaccess.EOModel)
,
EOAdaptor.adaptorWithName(java.lang.String)
Method Detail |
public void assertConnectionDictionaryIsValid()
assertConnectionDictionaryIsValid
in class EOAdaptor
JDBCAdaptorException
public void assignExternalTypeForAttribute(EOAttribute attribute)
attribute
. The
attribute should already have a value class, scale and precision. This method
is invoked when reverse engineering or switching adaptors.
assignExternalTypeForAttribute
in class EOAdaptor
attribute
- The attribute for which to set a corresponding
external type.EOAdaptor.assignExternalInfoForEntireModel(EOModel model)
public boolean canServiceModel(EOModel model)
true
if the adaptor is compatible with the model
;
false
otherwise.
The decision is made by matching the connection dictionary of the adaptor against
that of the model
considering the following keys: URLKey
,
UsernameKey
, PasswordKey
, DriverKey
,
and PlugInKey
.
canServiceModel
in class EOAdaptor
model
- A model.
true
if this adaptor instance can service
database access requests for this model.URLKey
,
UsernameKey
,
PasswordKey
,
DriverKey
,
PlugInKey
protected String connectionDictionaryURL()
public Properties connectionProperties()
JDBCPlugIn.connectionPropertiesForConnectionDictionary(com.webobjects.foundation.NSDictionary)
public String connectionURL()
JDBCPlugIn.connectionURL()
public EOAdaptorContext createAdaptorContext()
createAdaptorContext
in class EOAdaptor
EOAdaptor.contexts()
public EOAttribute createAttribute(String name, String columnName, int columnType, String externalType, int precision, int scale, int isNullable)
name
- the name of the attributecolumnType
- the JDBC type for the attributeexternalType
- the external type for the attributeprecision
- the precision (or width) of the attributescale
- the scale of the attributeisNullable
- boolean indicating if the attribute allows NULL
public Class defaultExpressionClass()
defaultExpressionClass
in class EOAdaptor
JDBCPlugIn.defaultExpressionClass()
,
JDBCExpression
public String driverName()
JDBCPlugIn.defaultDriverName()
public EOSQLExpressionFactory expressionFactory()
expressionFactory
in class EOAdaptor
JDBCPlugIn.expressionFactory()
,
JDBCExpressionFactory
public String externalTypeForJDBCType(int type)
type
.
public NSArray externalTypesWithModel(EOModel model)
model
. This information
is often cached in the connection dictionary of the model
,
but the adaptor can also fetch it at runtime.
externalTypesWithModel
in class EOAdaptor
model
- An optional argument that can be used to supplement
the adaptor's set of database types with additional,
user-defined database types.
public Object fetchedValueForValue(Object value, EOAttribute attribute)
super
with the result of the plugIn's plugInValueForValue
.
This allows a PlugIn to influence the value. The basic behavior is the same
as EOAdaptor.fetchedValueForValue
.
fetchedValueForValue
in class EOAdaptor
value
- The original value.attribute
- The attribute corresponding to the database column
in which value
would be stored.
value
, or the new value.JDBCPlugIn.plugInValueForValue(java.lang.Object, com.webobjects.eoaccess.EOAttribute)
protected static NSDictionary getJDBCInfoWithConnectionDictionary(NSDictionary connectionDictionary) throws JDBCAdaptorException
JDBCAdaptorException
public void handleDroppedConnection()
handleDroppedConnection
in class EOAdaptor
EOAdaptor.Delegate.reconnectionDictionaryForAdaptor(EOAdaptor adaptor)
,
EOAdaptorContext.handleDroppedConnection()
public boolean isDroppedConnectionException(Exception exception)
true
if exception
is a
JDBCAdaptorException and it 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
.
isDroppedConnectionException
in class EOAdaptor
exception
- An exception object.
true
if exception
is a
"dropped" connection; otherwise false
EOAdaptor.handleDroppedConnection()
,
EOAdaptor.Delegate.reconnectionDictionaryForAdaptor(
EOAdaptor adaptor)
public boolean isValidQualifierType(String typeName, EOModel model)
EOAdaptor
true
if an attribute of type typeName
can be used in a qualifier (an SQL WHERE clause) sent to the database server,
false
otherwise. typeName
is the name of a type as
required by the database server. model
is an optional argument
that can be used to supplement the adaptor's set of type mappings with
additional mappings for user-defined database types.
isValidQualifierType
in class EOAdaptor
typeName
- The name of a type as determined by the database server.model
- A model.
true
if an attribute of type
typeName
can be used in a qualifier.protected NSDictionary jdbcInfo()
JDBCPlugIn.jdbcInfo()
,
typeInfo()
public String password()
public JDBCPlugIn plugIn()
EOAdaptor.connectionDictionary()
,
PlugInKey
public void setConnectionDictionary(NSDictionary dictionary) throws IllegalArgumentException
EOAdaptor
dictionary
,
which must only contain String, NSData, NSDictionary, and NSArray
objects. Connection information can not be changed while the adaptor
is connected. Throws an exception if there are any open channels
when this method is invoked.
Subclasses of EOAdaptor don't need to override this method.
A subclass that does override this method must incorporate the
superclass's version by calling super
.
setConnectionDictionary
in class EOAdaptor
dictionary
- The adaptor's connection dictionary.
IllegalArgumentException
- if there are any
open channels when this method is called.EOAdaptor.connectionDictionary()
,
EOAdaptor.hasOpenChannels()
,
EOAdaptor.assertConnectionDictionaryIsValid()
public static String stringRepresentationForJDBCType(int columnType)
public EOSchemaGeneration synchronizationFactory()
synchronizationFactory
in class EOAdaptor
JDBCPlugIn.synchronizationFactory()
,
EOSynchronizationFactory
protected NSDictionary typeInfo()
jdbcInfo()
protected static NSDictionary typeInfoForModel(EOModel model)
public String username()
protected int varcharMaxLength()
|
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 |