[Zope3-checkins] SVN: Zope3/branches/srichter-blow-services/src/zope/app/ Initial stab an BBB.

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Feb 4 13:02:01 EST 2005


Log message for revision 29043:
  Initial stab an BBB.
  

Changed:
  U   Zope3/branches/srichter-blow-services/src/zope/app/component/__init__.py
  U   Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/__init__.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/browser/
  A   Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/interfaces.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/registration.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site.py
  U   Zope3/branches/srichter-blow-services/src/zope/app/component/interfaces/registration.py
  U   Zope3/branches/srichter-blow-services/src/zope/app/component/registration.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/registration/
  A   Zope3/branches/srichter-blow-services/src/zope/app/registration/__init__.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/registration/interfaces.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/registration/registration.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/site/folder.py
  U   Zope3/branches/srichter-blow-services/src/zope/app/site/interfaces.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/site/service.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/site/servicecontainer.py

-=-
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/__init__.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/__init__.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -19,14 +19,7 @@
 import zope.component
 from zope.app import zapi
 
-##############################################################################
-# BBB: Goes away in 3.3
-import bbb
-bbb.install()
-del bbb
-##############################################################################
 
-
 _marker = object()
 
 def getNextSiteManager(context):

Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/__init__.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/__init__.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -1,8 +1,8 @@
 
 
-def install():
+import sys
+import localservice
+import interfaces
+import registration
 
-    import sys
-    import localservice
-
-    sys.modules['zope.app.component.localservice'] = localservice
+sys.modules['zope.app.component.localservice'] = localservice

Added: Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/interfaces.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/interfaces.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/interfaces.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -0,0 +1,256 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Various BBB interfaces
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+from zope.interface import Interface
+
+class IRegistrationStack(Interface):
+    """A stack of registrations for a set of parameters
+
+    A service will have a registry containing registry stacks
+    for specific parameters.  For example, an adapter service will
+    have a registry stack for each given used-for and provided
+    interface.
+
+    The registry stack works like a stack: the first element is
+    active; when it is removed, the element after it is automatically
+    activated.  An explicit None may be present (at most once) to
+    signal that nothing is active.  To deactivate an element, it is
+    moved to the end.
+    """
+
+    def register(registration):
+        """Register the given registration without activating it.
+
+        Do nothing if the registration is already registered.
+        """
+
+    def unregister(registration):
+        """Unregister the given registration.
+
+        Do nothing if the registration is not registered.
+
+        Implies deactivate() if the registration is active.
+        """
+
+    def registered(registration):
+        """Is the registration registered?
+
+        Return a boolean indicating whether the registration has been
+        registered.
+        """
+
+    def activate(registration):
+        """Make the registration active.
+
+        The activated() method is called on the registration.  If
+        another registration was previously active, its deactivated()
+        method is called first.
+
+        If the argument is None, the currently active registration if
+        any is disabled and no new registration is activated.
+
+        Raises a ValueError if the given registration is not registered.
+        """
+
+    def deactivate(registration):
+        """Make the registration inactive.
+
+        If the registration is active, the deactivated() method is
+        called on the registration.  If this reveals a registration
+        that was previously active, that registration's activated()
+        method is called.
+
+        Raises a ValueError if the given registration is not registered.
+
+        The call has no effect if the registration is registered but
+        not active.
+        """
+
+    def active():
+        """Return the active registration, if any.
+
+        Otherwise, returns None.
+        """
+
+    def info():
+        """Return a sequence of registration information.
+
+        The sequence items are mapping objects with keys:
+
+        active -- A boolean indicating whether the registration is
+                  active.
+
+        registration -- The registration object.
+        """
+
+    def __nonzero__(self):
+        """The registry is true iff it has no registrations."""
+
+
+class IBBBRegistry(Interface):
+
+    def queryRegistrationsFor(registration, default=None):
+        """Return an IRegistrationStack for the registration.
+
+        Data on the registration is used to decide which registry to
+        return. For example, a service manager will use the
+        registration name attribute to decide which registry
+        to return.
+
+        Typically, an object that implements this method will also
+        implement a method named queryRegistrations, which takes
+        arguments for each of the parameters needed to specify a set
+        of registrations.
+
+        The registry must be in the context of the registry.
+
+        """
+
+    def createRegistrationsFor(registration):
+        """Create and return an IRegistrationStack for the registration.
+
+        Data on the registration is used to decide which regsitry to
+        create. For example, a service manager will use the
+        registration name attribute to decide which regsitry
+        to create.
+
+        Typically, an object that implements this method will also
+        implement a method named createRegistrations, which takes
+        arguments for each of the parameters needed to specify a set
+        of registrations.
+
+        Calling createRegistrationsFor twice for the same registration
+        returns the same registry.
+
+        The registry must be in the context of the registry.
+
+        """
+
+
+class IBBBRegisterableContainer(Interface):
+
+    def getRegistrationManager():
+        """Get a registration manager.
+
+        Find a registration manager.  Clients can get the
+        registration manager without knowing its name. Normally,
+        folders have one registration manager. If there is more than
+        one, this method will return one; which one is undefined.
+
+        An error is raised if no registration manager can be found.
+        """
+
+    def findModule(name):
+        """Find the module of the given name.
+
+        If the module can be find in the folder or a parent folder
+        (within the site manager), then return it, otherwise, delegate
+        to the module service.
+
+        This must return None when the module is not found.
+        """
+
+    def resolve(name):
+        """Resolve a dotted object name.
+
+        A dotted object name is a dotted module name and an object
+        name within the module.
+
+        TODO: We really should switch to using some other character than
+        a dot for the delimiter between the module and the object
+        name.
+        """    
+
+
+class IBBBRegistered(Interface):
+    """An object that can keep track of its configured uses.
+
+    The object need not implement this functionality itself, but must at
+    least support doing so via an adapter.
+    """
+
+    def addUsage(location):
+        """Add a usage by location.
+
+        The location is the physical path to the registration object that
+        configures the usage.
+        """
+    def removeUsage(location):
+        """Remove a usage by location.
+
+        The location is the physical path to the registration object that
+        configures the usage.
+        """
+    def usages():
+        """Return a sequence of locations.
+
+        A location is a physical path to a registration object that
+        configures a usage.
+        """
+
+
+class IBBBSiteManager(Interface):
+    """Service Managers act as containers for Services.
+
+    If a Service Manager is asked for a service, it checks for those it
+    contains before using a context-based lookup to find another service
+    manager to delegate to.  If no other service manager is found they defer
+    to the ComponentArchitecture ServiceManager which contains file based
+    services.
+    """
+
+    def queryRegistrations(name, default=None):
+        """Return an IRegistrationStack for the registration name.
+
+        queryRegistrationsFor(cfg, default) is equivalent to
+        queryRegistrations(cfg.name, default)
+        """
+
+    def createRegistrationsFor(registration):
+        """Create and return an IRegistrationRegistry for the registration
+        name.
+
+        createRegistrationsFor(cfg, default) is equivalent to
+        createRegistrations(cfg.name, default)
+        """
+
+    def listRegistrationNames():
+        """Return a list of all registered registration names.
+        """
+
+    def queryActiveComponent(name, default=None):
+        """Finds the registration registry for a given name, checks if it has
+        an active registration, and if so, returns its component.  Otherwise
+        returns default.
+        """
+
+    def queryLocalService(service_type, default=None):
+        """Return a local service, if there is one
+
+        A local service is one configured in the local service manager.
+        """
+
+    def addSubsite(subsite):
+        """Add a subsite of the site
+
+        Local sites are connected in a tree. Each site knows about
+        its containing sites and its subsites.
+
+        BBB: Replaced by addSub in ILocatedRegistry
+        """
+    

Added: Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/registration.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/registration.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/registration.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -0,0 +1,147 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Registration BBB components
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+from zope.interface import implements
+
+from zope.app import zapi
+from zope.app.container.contained import Contained
+
+import interfaces
+
+
+class RegistrationStack(Contained):
+    """Registration registry implemention
+
+       A registration stack provides support for a collection of
+       registrations such that, at any time, at most one is active.  The
+       "stack" aspect of the api is designed to support "uninstallation",
+       as will be described below.
+       """
+    implements(interfaces.IRegistrationStack)
+
+    def __init__(self, container):
+        self.__parent__ = container
+        self.sitemanager = zapi.getSiteManager(container)
+
+    def register(self, registration):
+        self.sitemanager.register(registration)
+        self._activate(registration)
+
+    def unregister(self, registration):
+        self.sitemanager.register(registration)
+        self._deactivate(registration)
+
+    def registered(self, registration):
+        self.sitemanager.registered(registration)
+
+    def _activate(self, registration):
+        zope.event.notify(RegistrationActivatedEvent(registration))
+        registration.activated()
+
+    def _deactivate(self, registration):
+        zope.event.notify(RegistrationDeactivatedEvent(registration))
+        registration.deactivated()
+
+    def activate(self, registration):
+        self.sitemanager.register(registration)
+        self._activate(registration)
+
+
+    def deactivate(self, registration):
+        self.sitemanager.register(registration)
+        self._deactivate(registration)
+
+    def active(self):
+        return True
+
+    def __nonzero__(self):
+        # XXX: Needs to be done
+        return bool(self.data)
+
+    def info(self):
+        # XXX: Needs to be done
+        result = [{'active': False,
+                   'registration': registration,
+                  }
+                  for registration in data
+                 ]
+
+        if result:
+            result[0]['active'] = True
+
+        return [r for r in result if r['registration'] is not None]
+
+    def data(self):
+        # XXX: Note done
+        # Need to convert old path-based data to object-based data
+        # It won't affect new objects that get instance-based data attrs
+        # on construction.
+
+        data = []
+        sm = zapi.getServices(self)
+        for path in self._data:
+            if isinstance(path, basestring):
+                try:
+                    data.append(zapi.traverse(sm, path))
+                except KeyError:
+                    # ignore objects we can't get to
+                    raise # for testing
+            else:
+                data.append(path)
+
+        return tuple(data)
+
+
+class BBBRegistry(object):
+
+    def queryRegistrationsFor(self, cfg, default=None):
+        return RegistrationStack(self, name)
+
+    def createRegistrationsFor(self, cfg):
+        # Ignore
+        pass
+    
+
+class BBBRegisterableContainer(object):
+
+    def getRegistrationManager(self):
+        return self.registrationManager
+
+    def findModule(self, name):
+        from zope.app.module import findModule
+        return findModule(name)
+
+    def resolve(self, name):
+        from zope.app.module import resolve
+        return resolve(name)
+        
+
+
+class BBBRegistered(object):
+
+    def addUsage(self, location):
+        # Ignore in the hope that noone uses this
+        pass
+
+    def removeUsage(self, location):
+        # Ignore in the hope that noone uses this
+        pass
+
+    def usages(self):
+        return [zapi.getPath(reg.component)
+                for reg in self.registrations]

Added: Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/bbb/site.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -0,0 +1,75 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Site-related BBB components
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+from zope.component.bbb.service import IService
+
+import registration
+
+class BBBSiteManager(object):
+
+    def queryRegistrationsFor(self, cfg, default=None):
+        return self.queryRegistrations(cfg.name, default)
+
+    def queryRegistrations(self, name, default=None):
+        """See INameRegistry"""
+        return registration.RegistrationStack(self, name)
+
+    def addSubsite(self, sub):
+        return self.addSub(sub)
+
+    def createRegistrationsFor(self, cfg):
+        # Ignore
+        pass
+
+    def createRegistrations(self, name):
+        # Ignore
+        pass
+
+    def listRegistrationNames(self):
+        # Only used for services
+        services = ['Utilities', 'Adapters']
+        return [reg.name
+                for reg in self.utilities.registrations()
+                if reg.provided is IService] + services
+        
+    def queryActiveComponent(self, name, default=None):
+        return self.queryLocalService(name, default)
+
+    def getServiceDefinitions(self):
+        gsm = zapi.getGlobalSiteManager()
+        return gsm.getServiceDefinitions()
+
+    def getService(self, name):
+        return zapi.getUtility(IService, name, self)
+
+    def queryLocalService(self, name, default=None):
+        service = zapi.getUtility(IService, name, self)
+        if zapi.getSiteManager(service) is not self:
+            return default
+        return service
+
+    def getInterfaceFor(self, service_type):
+        iface = [iface
+                for name, iface in self.getServiceDefinitions()
+                if name == service_type]
+        return iface[0]
+
+    def queryComponent(self, type=None, filter=None, all=0):
+        # Ignore, hoping that noone uses this horrible method
+        return []
+

Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/interfaces/registration.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/interfaces/registration.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/interfaces/registration.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -27,6 +27,8 @@
 from zope.app.event.interfaces import IObjectEvent
 from zope.app.i18n import ZopeMessageIDFactory as _
 
+from zope.app.component import bbb
+
 InactiveStatus = _('Inactive')
 ActiveStatus = _('Active')
 
@@ -230,7 +232,7 @@
     contains(IRegisterable, IRegisterableContainer)
     
 
-class IRegistered(Interface):
+class IRegistered(Interface, bbb.interfaces.IBBBRegistered):
     """An object that can track down its registrations.
 
     The object need not implement this functionality itself, but must at

Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/registration.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/registration.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/registration.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -31,6 +31,9 @@
 from zope.app.location import inside
 from zope.app.traversing.interfaces import TraversalError
 
+# BBB: First introduced in 3.1; should go away in 3.3 
+import bbb
+
 class RegistrationEvent(objectevent.ObjectEvent):
     """An event that is created when a registration-related activity occured."""
     implements(interfaces.IRegistrationEvent)
@@ -167,7 +170,7 @@
                 "Can't move a registered component from its container.")
 
 
-class Registered(object):
+class Registered(bbb.registration.BBBRegistered, object):
     """An adapter from IRegisterable to IRegistered.
 
     This class is the only place that knows how 'Registered'

Added: Zope3/branches/srichter-blow-services/src/zope/app/registration/__init__.py
===================================================================

Added: Zope3/branches/srichter-blow-services/src/zope/app/registration/interfaces.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/registration/interfaces.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/registration/interfaces.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -0,0 +1,107 @@
+##############################################################################
+#
+# Copyright (c) 2002-2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Interfaces for objects supporting registration
+
+$Id: interfaces.py 28654 2004-12-20 21:13:50Z gintautasm $
+"""
+from zope.interface import Interface, implements
+from zope.schema import TextLine
+from zope.schema.interfaces import ITextLine
+from zope.app.component.interfaces import registration
+
+UnregisteredStatus = registration.InactiveStatus
+RegisteredStatus = registration.InactiveStatus
+ActiveStatus = registration.ActiveStatus
+
+IRegistrationEvent = registration.IRegistrationEvent
+IRegistrationActivatedEvent = registration.IRegistrationActivatedEvent
+IRegistrationDeactivatedEvent = registration.IRegistrationDeactivatedEvent
+
+class INoLocalServiceError(Interface):
+    """No local service to register with.
+    """
+
+class NoLocalServiceError(Exception):
+    """No local service to configure
+
+    An attempt was made to register a registration for which there is
+    no local service.
+    """
+
+    implements(INoLocalServiceError)
+
+IRegistration = registration.IRegistration
+
+class IComponentPath(ITextLine):
+    """A component path
+
+    This is just the interface for the ComponentPath field below.  We'll use
+    this as the basis for looking up an appropriate widget.
+    """
+
+class ComponentPath(TextLine):
+    """A component path
+
+    Values of the field are absolute unicode path strings that can be
+    traversed to get an object.
+    """
+    implements(IComponentPath)
+
+IComponentRegistration = registration.IComponentRegistration
+
+from zope.app.component.bbb.interfaces import IRegistrationStack
+
+IRegistry = registration.IRegistry
+
+class IOrderedContainer(Interface):
+    """Containers whose items can be reorderd."""
+
+    def moveTop(names):
+        """Move the objects corresponding to the given names to the top.
+        """
+
+    def moveUp(names):
+        """Move the objects corresponding to the given names up.
+        """
+
+    def moveBottom(names):
+        """Move the objects corresponding to the given names to the bottom.
+        """
+
+    def moveDown(names):
+        """Move the objects corresponding to the given names down.
+        """
+
+IRegistrationManager = registration.IRegistrationManager
+IRegisterableContainer = registration.IRegisterableContainer
+IRegisterable = registration.IRegisterable
+
+IRegistered = registration.IRegistered
+
+IAttributeRegisterable = IRegisterable
+
+class INoRegistrationManagerError(Interface):
+    """No registration manager error
+    """
+
+class NoRegistrationManagerError(Exception):
+    """No registration manager
+
+    There is no registration manager in a site-management folder, or
+    an operation would result in no registration manager in a
+    site-management folder.
+
+    """
+    implements(INoRegistrationManagerError)
+

Added: Zope3/branches/srichter-blow-services/src/zope/app/registration/registration.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/registration/registration.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/registration/registration.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -0,0 +1,45 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Component registration support for services
+
+$Id: registration.py 28601 2004-12-09 19:20:03Z srichter $
+"""
+
+from zope.app.component import registration
+
+RegistrationEvent = registration.RegistrationEvent
+RegistrationActivatedEvent = registration.RegistrationActivatedEvent
+RegistrationDeactivatedEvent = registration.RegistrationDeactivatedEvent
+
+RegistrationStatusPropery = registration.RegistrationStatusProperty
+
+from zope.app.component.bbb.registration import RegistrationStack
+NotifyingRegistrationStack = RegistrationStack
+
+SimpleRegistrationRemoveSubscriber = \
+    registration.SimpleRegistrationRemoveSubscriber
+SimpleRegistration = registration.SimpleRegistration
+
+ComponentRegistration = registration.ComponentRegistration
+ComponentRegistrationAddSubscriber = \
+    registration.ComponentRegistrationAddSubscriber
+ComponentRegistrationRemoveSubscriber = \
+    registration.ComponentRegistrationRemoveSubscriber
+RegisterableMoveSubscriber = registration.RegisterableMoveSubscriber
+
+Registered = registration.Registered
+
+RegistrationManager = registration.RegistrationManager
+
+RegisterableContainer = registration.RegisterableContainer

Added: Zope3/branches/srichter-blow-services/src/zope/app/site/folder.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/site/folder.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/site/folder.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -0,0 +1,26 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""A site management folder contains components and component registrations.
+
+$Id: folder.py 25177 2004-06-02 13:17:31Z jim $
+"""
+from zope.app.container.btree import BTreeContainer
+
+from zope.app.component.site import SiteManagementFolder
+from zope.app.component.site import SMFolderFactory
+
+# I really hope that noone is using this.
+class SiteManagementFolders(BTreeContainer):
+    pass
+

Modified: Zope3/branches/srichter-blow-services/src/zope/app/site/interfaces.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/site/interfaces.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/site/interfaces.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -1,5 +1,30 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Interfaces for folders.
+
+$Id: interfaces.py 27514 2004-09-13 15:54:05Z fdrake $
+"""
+from zope.interface import Interface
 from zope.app.component.interfaces import registration
+from zope.app.container.interfaces import IContainer
 
+from zope.app.component.interfaces import IPossibleSite, ISite
+from zope.app.component.interfaces import ILocalSiteManager
+from zope.app.component.interfaces import ISiteManagementFolder
+
+ISiteManager = ILocalSiteManager
+
 class ILocalService(registration.IRegisterable):
     """A local service isn't a local service if it doesn't implement this.
 
@@ -14,3 +39,43 @@
     It implies a specific way of implementing IRegisterable,
     by subclassing IAttributeRegisterable.
     """
+
+class IComponentManager(Interface):
+
+    def queryComponent(type=None, filter=None, all=0):
+        """Return all components that match the given type and filter
+
+        The objects are returned a sequence of mapping objects with keys:
+
+        path -- The component path
+
+        component -- The component
+
+        all -- A flag indicating whether all component managers in
+               this place should be queried, or just the local one.
+
+        """
+
+class IBindingAware(Interface):
+
+    def bound(name):
+        """Inform a service component that it is providing a service
+
+        Called when an immediately-containing service manager binds
+        this object to perform the named service.
+        """
+
+    def unbound(name):
+        """Inform a service component that it is no longer providing a service
+
+        Called when an immediately-containing service manager unbinds
+        this object from performing the named service.
+        """
+
+class ISiteManagementFolders(IContainer, IComponentManager):
+    """A collection of ISiteManagementFolder objects.
+
+    An ISiteManagementFolders object supports simple containment as
+    well as package query and lookup.
+    
+    """

Added: Zope3/branches/srichter-blow-services/src/zope/app/site/service.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/site/service.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/site/service.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -0,0 +1,26 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Service Manager code
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.app.component.site import SiteManager, UtilityRegistration
+from zope.app.component.interfaces.registration import \
+     IRegisterableContainerContaining as IRegisterableContainerContainer
+
+ServiceManager = SiteManager
+
+ServiceRegistration = UtilityRegistration

Added: Zope3/branches/srichter-blow-services/src/zope/app/site/servicecontainer.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/site/servicecontainer.py	2005-02-04 18:01:29 UTC (rev 29042)
+++ Zope3/branches/srichter-blow-services/src/zope/app/site/servicecontainer.py	2005-02-04 18:02:01 UTC (rev 29043)
@@ -0,0 +1,22 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Service Manager Container
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.app.component.site import SiteManagerContainer
+
+ServiceManagerContainer = SiteManagerContainer



More information about the Zope3-Checkins mailing list