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

Class IAdaptor

Base --+
       |
      IAdaptor


Implemented in base class:
    assignExternalInfoForEntireModel
    connectionDictionary
    contexts
    delegate
    hasOpenChannels
    name
    setDelegate
    setExpressionClassForAdaptor
    
Implemented, can be overriden (better not, if possible)
    setConnectionDictionary
Should be overriden:
    assertConnectionDictionaryIsValid
    assignExternalInfoForAttribute
    assignExternalInfoForEntity
    createAdaptorContext
    defaultExpressionClass
    externalTypesWithModel
    internalTypeForExternalType
    fetchedValueForDataValue
    fetchedValueForDateValue
    fetchedValueForNumberValue
    fetchedValueForStringValue
    fetchedValueForValue
    isValidQualifierType
    schemaGenerationFactory
    
Additionnally the class defines the following static methods, none of which
should be overriden by subclasses:
  - adaptorWithModel
  - adaptorWithName
  - defaultDelegate
  - expressionClassForAdaptor
  - setDefaultDelegate
  - setExpressionClassForAdaptor



Methods 'abstract'==no default implementation, concrete subclasses should
                    override them

Method Summary
  __init__(self, name)
__TBD...
  administrativeConnectionDictionaryForAdaptor(self, anAdaptor)
  assertConnectionDictionaryIsValid(self)
  assignExternalInfoForAttribute(self, anAttribute)
  assignExternalInfoForEntireModel(self, aModel)
  assignExternalInfoForEntity(self, anEntity)
  assignExternalTypeForAttribute(self, anAttribute)
  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 See: createAdaptorContext()
  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()
  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.
  expressionFactory(self)
  externalTypesWithModel(self, aModel)
  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)
  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)
  isDroppedConnectionException(self, exception)
  isValidQualifierType(self, typeName, aModel)
  name(self)
Returns the name that was used when the concrete Adaptor was instanciated.
  prototypeAttributes(self)
  schemaGenerationFactory(self)
Returns the appropriate SchemaGeneration object for the Adaptor.
  setConnectionDictionary(self, connectionDictionary)
Sets the connectionDictionary.
  setDelegate(self, aDelegate)
Sets the delegate

Method Details

__init__(self, name)
(Constructor)

__TBD
Defaults:
  - delegate=defaultDelegate() [...]
  - no contexts
  - empty connectionDictionary

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 See: 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()

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.

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.

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()

name(self)

Returns the name that was used when the concrete Adaptor was instanciated. See: adaptorWithName(), adaptorWithModel()

schemaGenerationFactory(self)

Returns the appropriate SchemaGeneration object for the Adaptor.

Subclasses should override this method without calling it

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

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