org.jpox.store
Interface DatastoreAdapter

All Superinterfaces:
ExpressionConversionAdapter, ExpressionLogicSetAdapter, ExpressionMethodAdapter, ExpressionOperatorAdapter, ExpressionPatternAdapter, ExpressionSupportedFeaturesAdapter
All Known Subinterfaces:
RDBMSAdapter
All Known Implementing Classes:
AbstractDatastoreAdapter, DatabaseAdapter

public interface DatastoreAdapter
extends ExpressionConversionAdapter, ExpressionOperatorAdapter, ExpressionMethodAdapter, ExpressionSupportedFeaturesAdapter, ExpressionPatternAdapter, ExpressionLogicSetAdapter

Definition of a datastore adapter.

Version:
$Revision: 1.26 $

Field Summary
static int IDENTIFIER_LOWER_CASE
          Representation of an identifier specified in lower case.
static int IDENTIFIER_LOWER_CASE_QUOTED
          Representation of an identifier specified in "lower case"
static int IDENTIFIER_MIXED_CASE
          Representation of an identifier specified in Mixed Case.
static int IDENTIFIER_MIXED_CASE_QUOTED
          Representation of an identifier specified in "Mixed Case".
static int IDENTIFIER_UPPER_CASE
          Representation of an identifier specified in UPPER CASE
static int IDENTIFIER_UPPER_CASE_QUOTED
          Representation of an identifier specified in "UPPER CASE"
 
Method Summary
 void closeConnection(java.sql.Connection conn)
          Method to close a Connection to the datastore.
 long getAdapterTime(java.sql.Timestamp time)
          Utility to return the adapter time in case there are rounding issues with millisecs etc.
 java.sql.Connection getConnection(javax.sql.DataSource[] ds, java.lang.String userName, java.lang.String password, int isolationLevel)
          Accessor for a Connection to the datastore.
 int getDatastoreMajorVersion()
          Accessor for the datastore major version number.
 int getDatastoreMinorVersion()
          Accessor for the datastore minor version number.
 Dictionary getDictionary()
          Accessor for the Dictionary.
 int getIdentifierCase()
          Accessor for the case that the identifiers will be stored in
 java.lang.String getIdentifierInAdapterCase(java.lang.String identifier)
          Convenience accessor for the passed identifier in the correct case and quoting.
 java.lang.String getIdentifierQuoteString()
          Accessor for the quote string to use when quoting identifiers.
 JavaTypeMapping getMapping(java.lang.Class c, boolean serialised, boolean embedded, StoreManager storeMgr, ClassLoaderResolver clr)
          Accessor for the mapping for the specified class.
 JavaTypeMapping getMapping(java.lang.Class c, boolean serialised, boolean embedded, java.lang.String fieldName, StoreManager storeMgr)
          Accessor for the mapping for the specified class.
 JavaTypeMapping getMapping(java.lang.Class c, StoreManager storeMgr)
          Accessor for the mapping for the specified class.
 JavaTypeMapping getMapping(java.lang.Class c, StoreManager storeMgr, ClassLoaderResolver clr)
          Convenience accessor for the mapping for the specified class.
 MappingManager getMappingManager()
          Accessor for the Mapping Manager for field mapping management.
 java.lang.String getVendorID()
          Accessor for the Vendor ID for this datastore.
 void initialiseDatastore(java.lang.Object conn)
          Creates the auxiliary functions/procedures in the schema
 boolean isAutoIncrementingDataType(java.lang.String columnDef)
          Verifies if the given columnDef is auto incremented by the datastore.
 boolean isReservedKeyword(java.lang.String word)
          Method to check if a word is reserved for this datastore.
 void loadDatastoreMapping(PluginManager mgr, ClassLoaderResolver clr)
          Load the datastore mappings declared as Plug-in
 NumericExpression modOperator(ScalarExpression operand1, ScalarExpression operand2)
          Method to generate a modulus expression.
 QueryExpression newQueryStatement(DatastoreContainerObject container, ClassLoaderResolver clr)
          Accessor for a new query statement.
 QueryExpression newQueryStatement(DatastoreContainerObject container, DatastoreIdentifier rangeVar, ClassLoaderResolver clr)
          Accessor for a new query statement.
 boolean supportsAutoIncrementFields()
          Whether this datastore adapter support auto-incrementing fields.
 boolean supportsQueryFetchSizeLowerThanOne()
          Whether the datastore supports setting a fetch size lower than one.
 boolean supportsSequences()
          Whether this datastore adapter supports sequences.
 java.lang.String toString()
          Method to return this object as a string.
 
Methods inherited from interface org.jpox.store.expression.ExpressionConversionAdapter
toNumericExpression, toStringExpression, toStringExpression
 
Methods inherited from interface org.jpox.store.expression.ExpressionOperatorAdapter
concatOperator, getOperatorConcat
 
Methods inherited from interface org.jpox.store.expression.ExpressionMethodAdapter
absMethod, acosMethod, asinMethod, atanMethod, ceilMethod, cosMethod, endsWithMethod, expMethod, floorMethod, getDayMethod, getHourMethod, getMinuteMethod, getMonthMethod, getSecondMethod, getYearMethod, indexOfMethod, lengthMethod, logMethod, sinMethod, sqrtMethod, startsWithMethod, substringMethod, substringMethod, tanMethod, trimMethod
 
Methods inherited from interface org.jpox.store.expression.ExpressionSupportedFeaturesAdapter
supportsBooleanComparison, supportsEscapeExpressionInLikePredicate
 
Methods inherited from interface org.jpox.store.expression.ExpressionPatternAdapter
getEscapeCharacter, getEscapedPatternExpression, getEscapePatternExpression, getPatternExpressionAnyCharacter, getPatternExpressionZeroMoreCharacters
 
Methods inherited from interface org.jpox.store.expression.ExpressionLogicSetAdapter
cartersianProduct
 

Field Detail

IDENTIFIER_UPPER_CASE

public static final int IDENTIFIER_UPPER_CASE
Representation of an identifier specified in UPPER CASE

See Also:
Constant Field Values

IDENTIFIER_UPPER_CASE_QUOTED

public static final int IDENTIFIER_UPPER_CASE_QUOTED
Representation of an identifier specified in "UPPER CASE"

See Also:
Constant Field Values

IDENTIFIER_LOWER_CASE

public static final int IDENTIFIER_LOWER_CASE
Representation of an identifier specified in lower case.

See Also:
Constant Field Values

IDENTIFIER_LOWER_CASE_QUOTED

public static final int IDENTIFIER_LOWER_CASE_QUOTED
Representation of an identifier specified in "lower case"

See Also:
Constant Field Values

IDENTIFIER_MIXED_CASE

public static final int IDENTIFIER_MIXED_CASE
Representation of an identifier specified in Mixed Case.

See Also:
Constant Field Values

IDENTIFIER_MIXED_CASE_QUOTED

public static final int IDENTIFIER_MIXED_CASE_QUOTED
Representation of an identifier specified in "Mixed Case".

See Also:
Constant Field Values
Method Detail

getMappingManager

public MappingManager getMappingManager()
Accessor for the Mapping Manager for field mapping management.

Returns:
The Mapping Manager.

getVendorID

public java.lang.String getVendorID()
Accessor for the Vendor ID for this datastore.

Returns:
Vendor id for this datastore

loadDatastoreMapping

public void loadDatastoreMapping(PluginManager mgr,
                                 ClassLoaderResolver clr)
Load the datastore mappings declared as Plug-in

Parameters:
mgr - the PluginManager
clr - the ClassLoaderResolver

isReservedKeyword

public boolean isReservedKeyword(java.lang.String word)
Method to check if a word is reserved for this datastore.

Parameters:
word - The word
Returns:
Whether it is reserved

initialiseDatastore

public void initialiseDatastore(java.lang.Object conn)
Creates the auxiliary functions/procedures in the schema

Parameters:
conn - the connection to the datastore

getConnection

public java.sql.Connection getConnection(javax.sql.DataSource[] ds,
                                         java.lang.String userName,
                                         java.lang.String password,
                                         int isolationLevel)
                                  throws java.sql.SQLException
Accessor for a Connection to the datastore.

Parameters:
ds - The data source. Possible to have more than one datasource for failover
userName - The username for the datastore
password - The password for the datastore
isolationLevel - The level of transaction isolation
Returns:
The Connection
Throws:
java.sql.SQLException - Thrown when an error occurs in the creation.

closeConnection

public void closeConnection(java.sql.Connection conn)
                     throws java.sql.SQLException
Method to close a Connection to the datastore.

Parameters:
conn - The connection
Throws:
java.sql.SQLException - Thrown if error occurs on the close.

getIdentifierCase

public int getIdentifierCase()
Accessor for the case that the identifiers will be stored in

Returns:
The identifier case

getIdentifierQuoteString

public java.lang.String getIdentifierQuoteString()
Accessor for the quote string to use when quoting identifiers.

Returns:
The quote string for the identifier

getIdentifierInAdapterCase

public java.lang.String getIdentifierInAdapterCase(java.lang.String identifier)
Convenience accessor for the passed identifier in the correct case and quoting.

Parameters:
identifier - The identifier
Returns:
The quoted and cased identifier

newQueryStatement

public QueryExpression newQueryStatement(DatastoreContainerObject container,
                                         ClassLoaderResolver clr)
Accessor for a new query statement.

Parameters:
container - The table to query
clr - the ClassLoaderResolver
Returns:
The Query Statement

newQueryStatement

public QueryExpression newQueryStatement(DatastoreContainerObject container,
                                         DatastoreIdentifier rangeVar,
                                         ClassLoaderResolver clr)
Accessor for a new query statement.

Parameters:
container - The table to query
rangeVar - A range variable for the query
clr - the ClassLoaderResolver
Returns:
The Query Statement

getMapping

public JavaTypeMapping getMapping(java.lang.Class c,
                                  StoreManager storeMgr)
Accessor for the mapping for the specified class.

Parameters:
c - Java type
storeMgr - the StoreManager
Returns:
The mapping for the class.

getMapping

public JavaTypeMapping getMapping(java.lang.Class c,
                                  boolean serialised,
                                  boolean embedded,
                                  java.lang.String fieldName,
                                  StoreManager storeMgr)
Accessor for the mapping for the specified class.

Parameters:
c - Java type
serialised - Whether the type is serialised
embedded - Whether the type is embedded
fieldName - Name of field (for logging only)
storeMgr - the StoreManager
Returns:
The mapping for the class.

getMapping

public JavaTypeMapping getMapping(java.lang.Class c,
                                  StoreManager storeMgr,
                                  ClassLoaderResolver clr)
Convenience accessor for the mapping for the specified class. Simply directs the request to the same method taking serialised and embedded as false.

Parameters:
c - Class to query
storeMgr - The Store Manager
clr - The ClassLoaderResolver
Returns:
The mapping for the class.

getMapping

public JavaTypeMapping getMapping(java.lang.Class c,
                                  boolean serialised,
                                  boolean embedded,
                                  StoreManager storeMgr,
                                  ClassLoaderResolver clr)
Accessor for the mapping for the specified class.

Parameters:
c - Class to query
serialised - Whether the type is serialised
embedded - Whether the type is embedded
storeMgr - The Store Manager
clr - The ClassLoaderResolver
Returns:
The mapping for the class.

getDictionary

public Dictionary getDictionary()
Accessor for the Dictionary.

Returns:
Returns the dictionary.

getAdapterTime

public long getAdapterTime(java.sql.Timestamp time)
Utility to return the adapter time in case there are rounding issues with millisecs etc.

Parameters:
time - The timestamp
Returns:
The time in millisecs

getDatastoreMajorVersion

public int getDatastoreMajorVersion()
Accessor for the datastore major version number.

Returns:
Major version number

getDatastoreMinorVersion

public int getDatastoreMinorVersion()
Accessor for the datastore minor version number.

Returns:
Minor version number

modOperator

public NumericExpression modOperator(ScalarExpression operand1,
                                     ScalarExpression operand2)
Method to generate a modulus expression. The binary % operator is said to yield the remainder of its operands from an implied division; the left-hand operand is the dividend and the right-hand operand is the divisor.

Specified by:
modOperator in interface ExpressionOperatorAdapter
Parameters:
operand1 - the left expression
operand2 - the right expression
Returns:
The Expression for modulus

isAutoIncrementingDataType

public boolean isAutoIncrementingDataType(java.lang.String columnDef)
Verifies if the given columnDef is auto incremented by the datastore.

Parameters:
columnDef - the datastore type name
Returns:
true when the columnDef has values auto incremented by the datastore

supportsAutoIncrementFields

public boolean supportsAutoIncrementFields()
Whether this datastore adapter support auto-incrementing fields. The column could be things like "AUTOINCREMENT", "IDENTITY", "SERIAL" in SQL.

Returns:
whether autoincrementing fields are supported.

supportsSequences

public boolean supportsSequences()
Whether this datastore adapter supports sequences.

Returns:
whether sequences are supported.

supportsQueryFetchSizeLowerThanOne

public boolean supportsQueryFetchSizeLowerThanOne()
Whether the datastore supports setting a fetch size lower than one. Usually, the datastore should ignore settting fetch size lower than one.

Returns:
whether we support fetch size lower than one

toString

public java.lang.String toString()
Method to return this object as a string.

Returns:
String version of this object.


Copyright © -2007 . All Rights Reserved.