AdaptorContext.py :  » Database » Modeling-Framework » Modeling-0.9 » Modeling » interfaces » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Database » Modeling Framework 
Modeling Framework » Modeling 0.9 » Modeling » interfaces » AdaptorContext.py
# -*- coding: iso-8859-1 -*-
#-----------------------------------------------------------------------------
# Modeling Framework: an Object-Relational Bridge for python
#
# Copyright (c) 2001-2004 Sbastien Bigaret <sbigaret@users.sourceforge.net>
# All rights reserved.
#
# This file is part of the Modeling Framework.
#
# This code is distributed under a "3-clause BSD"-style license;
# see the LICENSE file for details.
#-----------------------------------------------------------------------------


"""
AdaptorContext API

  Notifications
    AdaptorContextBeginTransactionNotification
      object: the AdaptorContext which posted the notification
      userInfo: /

    AdaptorContextCommitTransactionNotification
      object: the AdaptorContext which posted the notification
      userInfo: /

    AdaptorContextRollbackTransactionNotification
      object: the AdaptorContext which posted the notification
      userInfo: /
                          
  __TBD:  AdaptorContext.Delegate

  CVS information

    $Id: AdaptorContext.py 932 2004-07-20 06:21:57Z sbigaret $
  
"""
__version__='$Revision: 932 $'[11:-2]

try:
  from Interface import Base
except:
  class Base:
    pass

def defaultDelegate():
  """
  """
  
def setDefaultDelegate(aDelegate):
  """
  """

class IAdaptorContext(Base):
  """
  
  Provided and shouldnt be overriden:
      hasOpenTransaction
      transactionDidBegin
      transactionDidCommit
      transactionDidRollback

  Should be overriden:
      beginTransaction
      commitTransaction
      createAdaptorChannel
      rollbackTransaction

  """
  def __init__(self, anAdaptor):
    """
    Initializes the new AdaptorContext.

    Concrete AdaptorContexts should have no need to override this method ; if
    they do, this method should be called prior to any other code-statements.
    """

  def adaptor(self):
    """
    Returns the Adaptor to which this instance is bound
    
    Concrete AdaptorContexts should not override this method.
    """

  def adaptorChannelDidClose(self, aChannel):
    """
    Called automatically by the AdaptorContext's channels. You should never
    call this method except if you implement a concrete Adaptor Layer.

    If the closed channel was the last one among the registered channels()
    being opened, this method can choose to close its connection to the
    database.

    Concrete implementation should specify whether it takes particular actions
    before closing the connection to the database server (such as committing
    or rolling-back any begun transactions).

    See also: AdaptorChannel.closeChannel()
    """
    

  def __addChannel__(self, aChannel):
    """
    Private method ; you should never call this method --except if you
    are implementing a concrete AdaptorContext.

    Concrete AdaptorContext should use this method to register the new
    channels it creates in 'createAdaptorChannel()' ; it should not be
    overriden.
    """
    
  def beginTransaction(self):
    """

    abstract
    """

  def channels(self):
    """
    Returns the channels created by and registered to the AdaptorContext

    Concrete AdaptorContexts should not override this method.
    """

  def commitTransaction(self):
    """
    """

  def createAdaptorChannel(self):
    """
    Implemented by concrete AdaptorContexts to Instanciate a new concrete
    AdaptorChannel, adds it to the list of channels(), and returns that
    AdaptorChannel.

    Implementation should call the private method __addChannel__() to register
    the newly created channel before returning it.
    
    abstract
    """

  def delegate(self):
    """
    Returns the object's delegate
    """

  def handleDroppedConnection(self):
    """
    """

  def hasBusyChannels(self):
    """
    Sends all its channels() a 'isFetchInProgress()' message ; if at least one
    of them returned true, the method itself returns 1 (true), otherwise
    returns 0 (false)
    """

  def hasOpenChannels(self):
    """
    Returns 0 (false) if none of its AdaptorChannels returned true to the
    'isOpen()' message, 0 (false) otherwise
    """

  def hasOpenTransaction(self):
    """
    """

  def rollbackTransaction(self):
    """
    """

  def setDelegate(self, aDelegate):
    """
    Sets the object's delegate
    """

  def transactionDidBegin(self):
    """
    """

  def transactionDidCommit(self):
    """
    """

  def transactionDidRollback(self):
    """
    """
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.