springpython.database.transaction
index
/home/gturnquist/spring-python-1.1.x/src/springpython/database/transaction.py

Copyright 2006-2008 SpringSource (http://springsource.com), All Rights Reserved
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
 
    http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

 
Modules
       
inspect
logging
re
types

 
Classes
       
__builtin__.object
PlatformTransactionManager
ConnectionFactoryTransactionManager
TransactionCallback
TransactionCallbackWithoutResult
TransactionDefinition
DefaultTransactionDefinition
TransactionTemplate
TransactionStatus
DefaultTransactionStatus
exceptions.Exception(exceptions.BaseException)
TransactionException
TransactionPropagationException
springpython.aop.MethodInterceptor(__builtin__.object)
TransactionalInterceptor
springpython.aop.ProxyFactoryObject(springpython.aop.ProxyFactory, springpython.aop.AopProxy)
TransactionProxyFactoryObject
springpython.context.ObjectPostProcessor(__builtin__.object)
AutoTransactionalObject

 
class AutoTransactionalObject(springpython.context.ObjectPostProcessor)
    This object is used to automatically scan objects in an IoC container, and if @Transaction
is found applied to any of the object's methods, link it with a TransactionManager.
 
 
Method resolution order:
AutoTransactionalObject
springpython.context.ObjectPostProcessor
__builtin__.object

Methods defined here:
__init__(self, tx_manager)
post_process_after_initialization(self, obj, obj_name)
This setup is run after all objects in the container have been created.

Methods inherited from springpython.context.ObjectPostProcessor:
post_process_before_initialization(self, obj, obj_name)

Data descriptors inherited from springpython.context.ObjectPostProcessor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ConnectionFactoryTransactionManager(PlatformTransactionManager)
    This transaction manager is based upon using a connection factory to control transactions. Since
connection factories are tied to vendor-specific databases, this allows delegation of various
transactional functions on a per-vendor basis.
 
 
Method resolution order:
ConnectionFactoryTransactionManager
PlatformTransactionManager
__builtin__.object

Methods defined here:
__init__(self, connection_factory)
commit(self, status)
getTransaction(self, definition)
According to PEP 249, commits and rollbacks silently start new transactions. Until a more
robust transaction manager is implemented to handle save points and so forth, this must suffice.
rollback(self, status)

Data descriptors inherited from PlatformTransactionManager:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class DefaultTransactionDefinition(TransactionDefinition)
    
Method resolution order:
DefaultTransactionDefinition
TransactionDefinition
__builtin__.object

Methods defined here:
__init__(self, isolation='ISOLATION_DEFAULT', name='', propagation='PROPAGATION_REQUIRED', timeout='TIMEOUT_DEFAULT', read_only=False)

Data descriptors inherited from TransactionDefinition:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class DefaultTransactionStatus(TransactionStatus)
    
Method resolution order:
DefaultTransactionStatus
TransactionStatus
__builtin__.object

Data descriptors inherited from TransactionStatus:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class PlatformTransactionManager(__builtin__.object)
    This interface is used to define the operations necessary in handling transactions.
 
  Methods defined here:
commit(self, status)
getTransaction(self, definition)
rollback(self, status)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class TransactionCallback(__builtin__.object)
    This interface defines the basic action needed to plug into the TransactionTemplate
 
  Methods defined here:
do_in_transaction(self, status)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class TransactionCallbackWithoutResult(TransactionCallback)
    This abstract class implements the TransactionCallback, but assumes no value is being returned.
 
 
Method resolution order:
TransactionCallbackWithoutResult
TransactionCallback
__builtin__.object

Methods defined here:
__init__(self)
do_in_transaction(self, status)
do_in_tx_without_result(self, status)

Data descriptors inherited from TransactionCallback:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class TransactionDefinition(__builtin__.object)
     Methods defined here:
__init__(self, isolation=None, name=None, propagation=None, timeout=None, read_only=None)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class TransactionException(exceptions.Exception)
    
Method resolution order:
TransactionException
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class TransactionPropagationException(TransactionException)
    
Method resolution order:
TransactionPropagationException
TransactionException
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors inherited from TransactionException:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class TransactionProxyFactoryObject(springpython.aop.ProxyFactoryObject)
    This class acts like the target object, and routes function calls through a
transactional interceptor.
 
 
Method resolution order:
TransactionProxyFactoryObject
springpython.aop.ProxyFactoryObject
springpython.aop.ProxyFactory
springpython.aop.AopProxy
__builtin__.object

Methods defined here:
__init__(self, tx_manager, target, tx_attributes)

Methods inherited from springpython.aop.ProxyFactoryObject:
__str__(self)

Methods inherited from springpython.aop.ProxyFactory:
__setattr__(self, name, value)
getProxy(self)
Generate an AopProxy given the current target and list of interceptors. Any changes to the factory after
proxy creation do NOT propagate to the proxies.

Data descriptors inherited from springpython.aop.ProxyFactory:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from springpython.aop.AopProxy:
__getattr__(self, name)
If any of the parameters are local objects, they are immediately retrieved. Callables cause the dispatch method
to be return, which forwards callables through the interceptor stack. Target attributes are retrieved directly from
the target object.

 
class TransactionStatus(__builtin__.object)
     Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class TransactionTemplate(DefaultTransactionDefinition)
    This utility class is used to simplify defining transactional blocks. Any exceptions thrown inside the
transaction block will be propagated to whom ever is calling the template execute method.
 
 
Method resolution order:
TransactionTemplate
DefaultTransactionDefinition
TransactionDefinition
__builtin__.object

Methods defined here:
__init__(self, tx_manager)
execute(self, transactionCallback)
Execute the action specified by the given callback object within a transaction.
setTxAttributes(self, tx_attributes)

Data descriptors inherited from TransactionDefinition:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class TransactionalInterceptor(springpython.aop.MethodInterceptor)
    This interceptor is used by the TransactionProxyFactoryObject in order to wrap
method calls with transactions.
 
 
Method resolution order:
TransactionalInterceptor
springpython.aop.MethodInterceptor
__builtin__.object

Methods defined here:
__init__(self, tx_manager, tx_attributes)
invoke(self, invocation)

Data descriptors inherited from springpython.aop.MethodInterceptor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
transactional(tx_attributes=None)
This decorator is actually a utility function that returns an embedded decorator, in order
to handle whether it was called in any of the following ways:
 
@transactional()
def foo():
    pass
 
@transactional
def foo():
    pass
 
The first two ways get parsed by Python as:
 
foo = transactional("some contextual string")(foo)      # first way
foo = transactional()(foo)                              # second way
 
Since this is expected, they are granted direct access to the embedded transactional_wrapper.
 
However, the third way ends up getting parsed by Python as:
 
foo = Transactional(foo)
 
This causes context to improperly get populated with a function instead of a string. This
requires recalling this utility like:
 
return Transactional()(context)

 
Data
        logger = <logging.Logger instance>