Package Modeling :: Module Adaptor :: Class Adaptor
[show private | hide private]
[frames | no frames]

Class Adaptor

Known Subclasses:
AbstractDBAPI2Adaptor

See interfaces.Adaptor for details
Method Summary
  __init__(self, name)
See interfaces.Adaptor for details
  __unimplemented__(self)
  adaptorWithModel(aModel)
Returns the adaptor associated to the supplied model: it extracts the name of the adaptor to be used with the model then calls adaptorWithModel() Raises ValueError is parameter 'aModel' is None or if its adaptorName is empty. (Static method)
  adaptorWithName(aName)
Returns the adaptor. (Static method)
  administrativeConnectionDictionaryForAdaptor(self, anAdaptor)
See interfaces.Adaptor for details
  assertConnectionDictionaryIsValid(self)
See interfaces.Adaptor for details
  assignExternalInfoForAttribute(self, anAttribute)
See interfaces.Adaptor for details
  assignExternalInfoForEntireModel(self, aModel)
See interfaces.Adaptor for details
  assignExternalInfoForEntity(self, anEntity)
See interfaces.Adaptor for details
  assignExternalTypeForAttribute(self, anAttribute)
See interfaces.Adaptor for details
  canServiceModel(self, aModel)
Compares 'aModel' 's connectionDictionary with self's and returns the result
  connectionDictionary(self)
Returns the connectionDictionary
  contexts(self)
Returns all AdaptorContexts created and registered with this Adaptor
  createAdaptorContext(self)
Instanciates a new AdaptorContext, registers it in the list of contexts() then returns it.
  createDatabaseWithAdministrativeConnectionDictionary(self, administrativeConnectionDictionary)
Connects to the database with the supplied connection dictionary and creates the database specified by the Adaptor's connectionDictionary()
  defaultDelegate()
Returns the default delegate. (Static method)
  defaultExpressionClass(self)
Returns the default expression class to be used along with this adaptor.
  delegate(self)
Returns the delegate for that Adaptor ; when initialized the delegate is the one returned by defaultDelegate()
  dropDatabaseWithAdministrativeConnectionDictionary(self, administrativeConnectionDictionary)
Adaptor's implementation does nothing
  expressionClass(self)
Returns the expression class to be used with the Adaptor.
  expressionClassForAdaptor(adaptor)
Returns the expression class to be used by adaptor, or None if none was previously set with 'setExpressionClassForAdaptor()'. (Static method)
  expressionFactory(self)
See interfaces.Adaptor for details
  externalTypesWithModel(self, aModel)
See interfaces.Adaptor for details
  fetchedValueForDataValue(self, value, anAttribute)
Adaptor's implementation returns 'value' without any modification
  fetchedValueForDateValue(self, value, anAttribute)
Adaptor's implementation returns 'value' without any modification
  fetchedValueForNumberValue(self, value, anAttribute)
Adaptor's implementation returns 'value', possibly modified if 'anAttribute' corresponds to a SQL 'NUMERIC' field with a scale lower than the number of digits in the fractional part.
  fetchedValueForStringValue(self, value, anAttribute)
Adaptor's implementation returns 'value' without modification
  fetchedValueForValue(self, value, anAttribute)
This method examine 'anAttribute' and, according to its externalType, forwards the message to one of the methods fetchedValueForDataValue(), fetchedValueForDateValue(), fetchedValueForNumberValue() or fetchedValueForStringValue().
  handleDroppedConnection(self)
Unimplemented yet
  hasOpenChannels(self)
Forwards the messages to all contexts() and returns 1 (true value) if at least one of these returned a true value, return 0 (false value) otherwise.
  internalTypeForExternalType(self, extType, aModel)
See interfaces.Adaptor for details
  isDroppedConnectionException(self, exception)
See interfaces.Adaptor for details
  isValidQualifierType(self, typeName, aModel)
See interfaces.Adaptor for details
  name(self)
Returns the name that was used when the concrete Adaptor was instanciated.
  prototypeAttributes(self)
See interfaces.Adaptor for details
  schemaGenerationFactory(self)
See interfaces.Adaptor for details
  setConnectionDictionary(self, connectionDictionary)
Sets the connectionDictionary.
  setDefaultDelegate(delegate)
Sets the default delegate which is assigned to Adaptor instances when they are initialized. (Static method)
  setDelegate(self, aDelegate)
Sets the delegate (not used yet)
  setExpressionClassForAdaptor(sqlExpression, adaptor)
Sets the SQLExpression to use in conjonction with a particular adaptor. (Static method)

Class Variable Summary
tuple __implements__ = (<class Modeling.interfaces.Adaptor.IAd...
str __raise_exception__ = 'AbstractMethod'
str __raise_msg__ = 'Left intentionally unimplemented in thi...

Instance Method Details

__init__(self, name)
(Constructor)

See interfaces.Adaptor for details

administrativeConnectionDictionaryForAdaptor(self, anAdaptor)

See interfaces.Adaptor for details

assertConnectionDictionaryIsValid(self)

See interfaces.Adaptor for details

assignExternalInfoForAttribute(self, anAttribute)

See interfaces.Adaptor for details

assignExternalInfoForEntireModel(self, aModel)

See interfaces.Adaptor for details

assignExternalInfoForEntity(self, anEntity)

See interfaces.Adaptor for details

assignExternalTypeForAttribute(self, anAttribute)

See interfaces.Adaptor for details

canServiceModel(self, aModel)

Compares 'aModel' 's connectionDictionary with self's and returns the result

connectionDictionary(self)

Returns the connectionDictionary

See also: setConnectionDictionary()

contexts(self)

Returns all AdaptorContexts created and registered with this Adaptor

See also: createAdaptorContext()

createAdaptorContext(self)

Instanciates a new AdaptorContext, registers it in the list of contexts() then returns it.

abstract

Subclasses should override this method to add the appropriate AdaptorContext to the private attribute 'self._contexts' and return it, without calling this method.

createDatabaseWithAdministrativeConnectionDictionary(self, administrativeConnectionDictionary)

Connects to the database with the supplied connection dictionary and creates the database specified by the Adaptor's connectionDictionary()

Adaptor's implementation does nothing.

Subclasses should implement this method without calling this.

defaultExpressionClass(self)

Returns the default expression class to be used along with this adaptor. See 'expressionClass()' for an explanation on how the expression class is actually determined for an Adaptor.

Subclasses should override this method without calling Adaptor's.

delegate(self)

Returns the delegate for that Adaptor ; when initialized the delegate is the one returned by defaultDelegate()

dropDatabaseWithAdministrativeConnectionDictionary(self, administrativeConnectionDictionary)

Adaptor's implementation does nothing

expressionClass(self)

Returns the expression class to be used with the Adaptor.

The mechanism used needs a little explanation. First, a concrete Adaptor
comes with (or reuse) a concrete expressionClass (SQLExpression) -- the
method 'defaultExpressionClass()' returns that concrete expression class.
This is also the default value returned by this method.

However, you may need to substitute that default expression class with one
of your own (for example, you may want to subclass that expr.class to
change part of its behaviour). This is what the static method
'setExpressionClassForAdaptor()' does: when called, it registers your
custom expression class for use with a given adaptor. Any subsequent call
to this method --'expressionClass()'-- then returns the registered
expr. class instead of the default one.

To summarize it:
- if 'expressionClassForAdaptor(self)' returns None, the method returns
  'self.defaultExpressionClass()'
- otherwise, it returns 'expressionClassForAdaptor(self)'

Subclasses should not override this method.

expressionFactory(self)

See interfaces.Adaptor for details

externalTypesWithModel(self, aModel)

See interfaces.Adaptor for details

fetchedValueForDataValue(self, value, anAttribute)

Adaptor's implementation returns 'value' without any modification

fetchedValueForDateValue(self, value, anAttribute)

Adaptor's implementation returns 'value' without any modification

fetchedValueForNumberValue(self, value, anAttribute)

Adaptor's implementation returns 'value', possibly modified if 'anAttribute' corresponds to a SQL 'NUMERIC' field with a scale lower than the number of digits in the fractional part.

For example, the float '4.675' will be converted to '4.68' if 'anAttribute' has a scale of 2.

fetchedValueForStringValue(self, value, anAttribute)

Adaptor's implementation returns 'value' without modification

fetchedValueForValue(self, value, anAttribute)

This method examine 'anAttribute' and, according to its externalType, forwards the message to one of the methods fetchedValueForDataValue(), fetchedValueForDateValue(), fetchedValueForNumberValue() or fetchedValueForStringValue().

The purpose here is to return a value, derived from 'value', which reflects the value as it is actually stored by a database-backend. This is used by the snapshotting mechanisms in the framework (optimistic locking).

See these methods for a description of their actions.

handleDroppedConnection(self)

Unimplemented yet

hasOpenChannels(self)

Forwards the messages to all contexts() and returns 1 (true value) if at least one of these returned a true value, return 0 (false value) otherwise. See: setConnectionDictionary()

internalTypeForExternalType(self, extType, aModel)

See interfaces.Adaptor for details

isDroppedConnectionException(self, exception)

See interfaces.Adaptor for details

isValidQualifierType(self, typeName, aModel)

See interfaces.Adaptor for details

name(self)

Returns the name that was used when the concrete Adaptor was instanciated.

See also: adaptorWithName(), adaptorWithModel()

prototypeAttributes(self)

See interfaces.Adaptor for details

schemaGenerationFactory(self)

See interfaces.Adaptor for details

setConnectionDictionary(self, connectionDictionary)

Sets the connectionDictionary.

Raises ValueError if hasOpenChannels() returns true --in this case the connectionDictionary is not set.

setDelegate(self, aDelegate)

Sets the delegate (not used yet)

Static Method Details

adaptorWithModel(aModel)

Returns the adaptor associated to the supplied model: it extracts the name of the adaptor to be used with the model then calls adaptorWithModel() Raises ValueError is parameter 'aModel' is None or if its adaptorName is empty.

Raises AdaptorImportError if the adaptor cannot be loaded.

adaptorWithName(aName)

Returns the adaptor.

Raises AdaptorImportError if the adaptor cannot be loaded.

defaultDelegate()

Returns the default delegate.

See also: setDefaultDelegate()

expressionClassForAdaptor(adaptor)

Returns the expression class to be used by adaptor, or None if none was previously set with 'setExpressionClassForAdaptor()'.

setDefaultDelegate(delegate)

Sets the default delegate which is assigned to Adaptor instances when they are initialized.

setExpressionClassForAdaptor(sqlExpression, adaptor)

Sets the SQLExpression to use in conjonction with a particular adaptor. Parameters 'sqlExpression' and 'adaptor' can be either instances or classes.

Class Variable Details

__implements__

Type:
tuple
Value:
(<class Modeling.interfaces.Adaptor.IAdaptor at 0xb76e5aac>,)          

__raise_exception__

Type:
str
Value:
'AbstractMethod'                                                       

__raise_msg__

Type:
str
Value:
'Left intentionally unimplemented in this class, subclass should overr\
ide this method'                                                       

Generated by Epydoc 2.1 on Sat Mar 4 13:36:27 2006 http://epydoc.sf.net