[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/services - __init__.py:1.2 auth.py:1.2 cache.py:1.2 configuration.py:1.2 configurationmanager.py:1.2 connection.py:1.2 error.py:1.2 event.py:1.2 hub.py:1.2 interfaces.py:1.2 package.py:1.2 principalannotation.py:1.2 query.py:1.2 service.py:1.2 session.py:1.2
Jim Fulton
jim@zope.com
Wed, 25 Dec 2002 09:14:05 -0500
Update of /cvs-repository/Zope3/src/zope/app/interfaces/services
In directory cvs.zope.org:/tmp/cvs-serv15352/src/zope/app/interfaces/services
Added Files:
__init__.py auth.py cache.py configuration.py
configurationmanager.py connection.py error.py event.py hub.py
interfaces.py package.py principalannotation.py query.py
service.py session.py
Log Message:
Grand renaming:
- Renamed most files (especially python modules) to lower case.
- Moved views and interfaces into separate hierarchies within each
project, where each top-level directory under the zope package
is a separate project.
- Moved everything to src from lib/python.
lib/python will eventually go away. I need access to the cvs
repository to make this happen, however.
There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.
=== Zope3/src/zope/app/interfaces/services/__init__.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/__init__.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.
=== Zope3/src/zope/app/interfaces/services/auth.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/auth.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,53 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""
+$Id$
+"""
+from zope.interface import Interface
+from zope.app.interfaces.security import IPrincipal
+
+class IReadUser(IPrincipal):
+ """Read interface for a User."""
+
+ def getLogin():
+ """Get the login for the user."""
+
+ def getRoles():
+ """Get the roles for the user."""
+
+ def validate(pw):
+ """Seee whether the password is valid."""
+
+
+class IWriteUser(Interface):
+ """Write interface for a User."""
+
+ def setTitle(title):
+ """Set title of User."""
+
+ def setDescription(description):
+ """Set description of User."""
+
+ def setLogin(login):
+ """Set login of User."""
+
+ def setRoles(roles):
+ """Set roles of User."""
+
+ def setPassword(password):
+ """Set password of User."""
+
+
+class IUser(IReadUser, IWriteUser):
+ """A user object for the Local Authentication Service."""
=== Zope3/src/zope/app/interfaces/services/cache.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/cache.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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 configuration for a cache.
+
+$Id$
+"""
+
+from zope.app.interfaces.services.configuration \
+ import INamedComponentConfiguration
+
+class ICacheConfiguration(INamedComponentConfiguration):
+ """Cache configuration
+
+ Cache configurations are dependent on the caches that they configure. They
+ register themselves as component dependents.
+ """
=== Zope3/src/zope/app/interfaces/services/configuration.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/configuration.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,254 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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 configuration registration
+
+$Id$
+"""
+
+from zope.interface import Interface, Attribute
+from zope.schema import Text, TextLine
+from zope.schema.interfaces import ITextLine
+from zope.app.security.permissionfield import PermissionField
+
+Unregistered = u'Unregistered'
+Registered = u'Registered'
+Active = u'Active'
+
+class IConfigurationStatus(ITextLine):
+ """The registration status of a configuration
+ """
+
+class ConfigurationStatus(TextLine):
+ __implements__ = IConfigurationStatus
+ allowed_values = Unregistered, Registered, Active
+
+class IConfigurationSummary(Interface):
+ """Configuration summary data
+ """
+
+ title = TextLine(title = u"Title",
+ description = u"Descriptive title",
+ required = True)
+
+ status = ConfigurationStatus(title = u"Configuration status")
+
+class IConfiguration(IConfigurationSummary):
+ """Configuration object
+
+ A configuration object represents a specific configuration
+ decision, such as registering an adapter or defining a permission.
+
+ In addition to the attributes or methods defined here,
+ configuration objects will include additional attributes
+ identifying how they should be used. For example, a service
+ configuration will provide a service type. An adapter
+ configuration will specify a used-for interface and a provided
+ interface.
+ """
+
+ description = Text(title=u"Description",
+ description=u"Detailed description",
+ )
+
+ def activated():
+ """Method called when a configuration is made active
+ """
+
+ def deactivated():
+ """Method called when a configuration is made inactive
+ """
+
+
+class INamedConfigurationInfo(Interface):
+ """Configuration object that is registered by name
+ """
+
+ name = TextLine(title=u"Name",
+ description=u"The name that is registered")
+
+ # The label is generally set as a class attribute on the
+ # configuration class.
+ label = Attribute("Descriptive label of the configuration type "
+ "(for example, Service, Connection)")
+
+class INamedConfiguration(INamedConfigurationInfo, IConfiguration):
+ pass
+
+class INamedComponentConfigurationInfo(INamedConfigurationInfo):
+ """Configuration object that configures a component associated with a name
+ """
+
+ permission = PermissionField(
+ title=u"The permission needed to use the component.")
+
+ componentPath = Attribute("The physical path to the component")
+
+class INamedComponentConfiguration(INamedComponentConfigurationInfo,
+ INamedConfiguration):
+ def getComponent():
+ """Return the component named in the configuration.
+ """
+
+class IConfigurationRegistry(Interface):
+ """A registry of configurations for a set of parameters
+
+ A service will have a registry containing configuration registries
+ for specific parameters. For example, an adapter service will have
+ a configuration registry for each given used-for and provided
+ interface.
+ """
+
+ def register(configuration):
+ """Register the given configuration
+
+ Do nothing if the configuration is already registered.
+ """
+
+ def unregister(configuration):
+ """Unregister the given configuration
+
+ Do nothing if the configuration is not registered.
+ """
+
+ def registered(configuration):
+ """Is the configuration registered
+
+ Return a boolean indicating whether the configuration has been
+ registered.
+
+ """
+
+ def activate(configuration):
+ """Make the configuration active.
+
+ The activated method is called on the configuration.
+
+ Raises a ValueError if the given configuration is not registered.
+ """
+
+ def deactivate(configuration):
+ """Make the configuration inactive.
+
+ Id the configuration is active, the deactivated method is called
+ on the configuration.
+
+ Raises a ValueError if the given configuration is not registered.
+
+ The call has no effect if the configuration is registered but
+ not active.
+ """
+
+ def active():
+ """Return the active configuration, if any
+
+ Otherwise, returns None.
+ """
+
+ def info():
+ """Return a sequence of configuration information
+
+ The sequence items are mapping objects with keys:
+
+ id -- A string that can be used to uniquely identify the
+ configuration
+
+ active -- A boolean indicating whether the configuration is
+ active
+
+ configuration -- The configuration object.
+ """
+
+ def __nonzero__(self):
+ """The registry is true if it is non-empty
+ """
+
+
+class IConfigurable(Interface):
+ """A component that can be configured using a configuration manager."""
+
+ def queryConfigurationsFor(configuration, default=None):
+ """Return an IConfigurationRegistry for the configuration
+
+ Data on the configuration is used to decide which registry to
+ return. For example, a service manager will use the
+ configuration name attribute to decide which registry
+ to return.
+
+ Typically, an object that implements this method will also
+ implement a method named queryConfigurations, which takes
+ arguments for each of the parameters needed to specify a set
+ of configurations.
+
+ The registry must be returned in the context of the context of
+ the configurable.
+
+ """
+
+ def createConfigurationsFor(configuration):
+ """Create and return an IConfigurationRegistry for the configuration
+
+ Data on the configuration is used to decide which regsitry to
+ create. For example, a service manager will use the
+ configuration name attribute to decide which regsitry
+ to create.
+
+ Typically, an object that implements this method will also
+ implement a method named createConfigurations, which takes
+ arguments for each of the parameters needed to specify a set
+ of configurations.
+
+ Calling createConfigurationsFor twice for the same configuration
+ returns the same registry.
+ """
+
+
+class INameConfigurable(IConfigurable):
+ """An IConfigurable, where a name is used to decide which registry to
+ return for methods in IConfigurable.
+
+ All configurations that pass through queryConfigurationsFor and
+ createConfigurationsFor are expected to implement INamedConfiguration.
+ """
+
+ def queryConfigurations(name, default=None):
+ """Return an IConfigurationRegistry for the configuration name
+
+ queryConfigurationsFor(cfg, default) is equivalent to
+ queryConfigurations(cfg.name, default)
+ """
+
+ def createConfigurationsFor(configuration):
+ """Create and return an IConfigurationRegistry for the configuration
+ name
+
+ createConfigurationsFor(cfg, default) is equivalent to
+ createConfigurations(cfg.name, default)
+ """
+
+ def listConfigurationNames():
+ """Return a list of all registered configuration names
+ """
+
+class INameComponentConfigurable(INameConfigurable):
+ """An INameConfigurable where the configurations refer to components.
+
+ All configurations that pass through queryConfigurationsFor and
+ createConfigurationsFor are expected to implement
+ INamedComponentConfiguration.
+ """
+ def queryActiveComponent(name, default=None):
+ """Finds the configuration registry for a given name, checks if it has
+ an active configuration, and if so, returns its component. Otherwise
+ returns default.
+ """
=== Zope3/src/zope/app/interfaces/services/configurationmanager.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/configurationmanager.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,49 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""
+$Id$
+"""
+
+from zope.app.interfaces.container import IContainerNamesContainer
+from zope.interface import Interface
+
+class IOrderedContainer(Interface):
+ """Container with items that can be rearranged.
+ """
+
+ # Yes, maybe this should be in the container package, but, we are
+ # likely to come up with a better general ordering interface, so
+ # we'll leave this one here for now.
+
+ 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
+ """
+
+class IConfigurationManager(IContainerNamesContainer, IOrderedContainer):
+ """Manage Configurations
+ """
+
+__doc__ = IConfigurationManager.__doc__ + __doc__
=== Zope3/src/zope/app/interfaces/services/connection.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/connection.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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 configuration for a database adapter.
+
+$Id$
+"""
+
+from zope.app.interfaces.services.configuration \
+ import INamedComponentConfiguration
+
+class IConnectionConfiguration(INamedComponentConfiguration):
+ """Database Connection Configuration
+
+ Connection configurations are dependent on the database adapters that they
+ configure. They register themselves as component dependents.
+ """
=== Zope3/src/zope/app/interfaces/services/error.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/error.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,46 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""
+
+Revision information:
+$Id$
+"""
+from zope.interface import Interface
+
+class IErrorReportingService(Interface):
+ """Error Reporting Service Interface.
+ """
+
+ def raising(info, request=None):
+ """Logs an exception.
+ """
+
+ def getProperties():
+ """Gets the properties as dictionary.
+ keep_entries, copy_to_logfile, ignored_exceptions
+ """
+
+ def setProperties(keep_entries, copy_to_zlog=0, ignored_exceptions=(),
+ RESPONSE=None):
+ """Sets the properties. keep_entries, copy_to_logfile,
+ ignored_exceptions
+ """
+
+ def getLogEntries():
+ """Returns the entries in the log, most recent first.
+ """
+
+ def getLogEntryById(id):
+ """Return LogEntry by ID
+ """
=== Zope3/src/zope/app/interfaces/services/event.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/event.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""
+
+Revision information:
+$Id$
+"""
+from zope.interface import Attribute
+from zope.interfaces.event import IIndirectSubscriber
+
+class IPathSubscriber(IIndirectSubscriber):
+
+ def __init__(wrapped_subscriber):
+ """creates new PathSubscriber for the given wrapped_subscriber"""
+
+ subscriber_path = Attribute(
+ """the slash-delineated physical path to the subscriber"""
+ )
=== Zope3/src/zope/app/interfaces/services/hub.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/hub.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,216 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""Object hub interfaces.
+
+$Id$
+"""
+
+from zope.interface import Attribute
+
+from zope.interfaces.event import IEventChannel
+from zope.interfaces.event import IEvent
+
+
+class ObjectHubError(Exception):
+ pass
+
+
+class IHubEventChannel(IEventChannel):
+ """Event channel that filters hub events.
+
+ It typically lies between the ObjectHub service and an index, so that
+ only certain content gets indexed. The extra iterObjectRegistrations
+ method is needed for bootstrapping the index with the appropriate objects.
+ """
+
+ def iterObjectRegistrations():
+ """Returns an iterator of the object registrations.
+
+ An object registration is a tuple (location, hubid, wrapped_object).
+ """
+
+class IObjectHub(IHubEventChannel):
+ """ObjectHub.
+
+ Receives Object Modify Events from the Event Service, and
+ changes these into Hub Id Object Modify Events, then passes
+ these on to its subscribers.
+
+ To map Object Modify Events onto Hub Id Object Modify Events, take
+ the location from the Object Modify Event, look up the Hub Id for this
+ location, and create an equivalent Hub Id Object Modify Event using this
+ Hub Id.
+
+ Note that we are concerned with locations and not with Objects.
+ An object may have more than one location. That doesn't concern
+ us here.
+
+ We're only interested in what happens during the time during which
+ an object is registered with the hub -- between ObjectRegistered
+ and ObjectUnregistered events. As one consequence of that, we do
+ care about object removals, but not (directly) about object
+ additions.
+
+ Table of decisions about maintaining the location<->Hub Id lookup:
+
+ Register
+
+ if location already in lookup:
+ raise ObjectHubError, as this is implies bad state somewhere
+ generate new hub id
+ place hub id<->location into lookup, to say that we have an
+ interesting object
+
+ send out hub id object register event to subscribers
+
+ Unregister
+
+ if location not in lookup:
+ raise ObjectHubError, as this is implies bad state somewhere
+ remove location<->hub id from lookup
+
+ send out hub id unregister event to subscribers
+
+ Modify
+
+ if location not in lookup:
+ ignore this event, as we're not interested in this object
+ else:
+ look up hub id for the location
+ send out hub id object modify event to subscribers
+
+ Move
+
+ if old_location not in lookup:
+ ignore this event, as we're not interested in this object
+ elif new_location is in lookup:
+ raise ObjectHubError
+ else:
+ look up hub id for old_location
+ change lookup:
+ remove hub id<->old_location
+ add hub id<->new_location
+ send out hub id object context-change event to subscribers
+
+ Remove (specializes Unregister)
+
+ if old_location not in lookup:
+ ignore this event, as we're not interested in this object
+ else:
+ look up hub id for old_location
+ change lookup:
+ remove hub id<->old_location
+ send out hub id object remove event to subscribers
+ """
+
+ def getHubId(obj_or_loc):
+ """Returns the hub id int that is mapped to the given location
+ or wrapped object.
+
+ Location is either a unicode, or a tuple of unicodes, or an
+ ascii string, or a tuple of ascii strings.
+ (See Zope/App/Traversing/__init__.py)
+ It must be absolute, so if it is a string it must start with a u'/',
+ and if it is a tuple, it must start with an empty string.
+
+ (u'',u'whatever',u'whatever2')
+ u'/whatever/whatever2'
+
+ If there is no hub id, raise NotFoundError.
+ """
+
+ def getLocation(hubid):
+ """Returns a location as a tuple of unicodes.
+
+ If there is no location, raise NotFoundError.
+ """
+
+ def getObject(hubid):
+ """Returns an object for the given hub id.
+
+ If there is no such hub id, raise NotFoundError.
+ If there is no such object, passes through whatever error
+ the traversal service raises.
+ """
+
+ def register(obj_or_loc):
+ """Returns a new hub id for the given location or the given
+ wrapped object if it is not already registered.
+
+ It also emits a HubIdObjectRegisteredEvent. Raises an
+ ObjectHubError if the location was previously registered.
+ """
+
+ def unregister(obj_or_loc_or_hubid):
+ """Unregister an object by wrapped object, by location, or by hubid.
+
+ It also emits a HubIdObjectUnregisteredEvent.
+ If the hub id or location wasn't registered a
+ NotFoundError is raised.
+ """
+
+ def numRegistrations():
+ """Returns the number of location<-->hubid registrations held.
+ """
+
+ def getRegistrations(location='/'):
+ """Returns a sequence of the registrations at and within the
+ given location.
+
+ A registration a tuple (location, hib_id).
+ """
+
+
+class IHubEvent(IEvent):
+ """Internal Object Hub Event : something has happened to an object for
+ which there is a hub id.
+ A hub id is a way of refering to an object independent of location.
+ """
+ hub = Attribute(
+ """the originating object hub (and thus the hub for which this
+ hubid is pertinent)""")
+
+ object = Attribute("The subject of the event.")
+
+ hubid = Attribute("the object's hub-unique id")
+
+ location = Attribute("An optional object location.")
+
+
+class IRegistrationHubEvent(IHubEvent):
+ """The hub registration status of an object has changed
+ """
+
+
+class IObjectRegisteredHubEvent(IRegistrationHubEvent):
+ """A hub id has been freshly created and mapped against an object."""
+
+
+class IObjectUnregisteredHubEvent(IRegistrationHubEvent):
+ """We are no longer interested in this object."""
+
+
+class IObjectModifiedHubEvent(IHubEvent):
+ """An object with a hub id has been modified."""
+
+
+class IObjectMovedHubEvent(IHubEvent):
+ """An object with a hub id has had its context changed. Typically, this
+ means that it has been moved."""
+
+ fromLocation = Attribute("The old location for the object.")
+
+
+class IObjectRemovedHubEvent(IObjectUnregisteredHubEvent):
+ """An object with a hub id has been removed and unregistered."""
=== Zope3/src/zope/app/interfaces/services/interfaces.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/interfaces.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,153 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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 interfaces
+
+$Id$
+"""
+
+from zope.app.interfaces.services.configuration import IConfiguration
+from zope.app.component.interfacefield import InterfaceField
+from zope.schema import BytesLine, TextLine, Text
+from zope.interface import Interface
+from zope.app.services.field import ComponentLocation
+from zope.component.interfaces import IPresentation
+
+class IAdapterConfigurationInfo(Interface):
+
+ forInterface = InterfaceField(
+ title = u"For interface",
+ description = u"The interface of the objects being adapted",
+ readonly = True,
+ required = False, # XXX the UI should be explicit about allowing
+ ) # no selection.
+
+ providedInterface = InterfaceField(
+ title = u"Provided interface",
+ description = u"The interface provided by the adapter",
+ readonly = True,
+ required = True,
+ )
+
+ factoryName = BytesLine(
+ title=u"The dotted name of a factory for creating the adapter",
+ readonly = True,
+ required = True,
+ )
+
+class IAdapterConfiguration(IConfiguration, IAdapterConfigurationInfo):
+
+ def getAdapter(object):
+ """Return an adapter for the object
+
+ The adapter is computed by passing the object to the
+ registered factory.
+ """
+
+class IViewConfigurationInfo(Interface):
+
+ forInterface = InterfaceField(
+ title = u"For interface",
+ description = u"The interface of the objects being viewed",
+ readonly = True,
+ required = True,
+ )
+
+ presentationType = InterfaceField(
+ title = u"Presentation type",
+ description = u"The presentation type of a view",
+ readonly = True,
+ required = True,
+ type = IPresentation,
+ )
+
+ factoryName = BytesLine(
+ title=u"The dotted name of a factory for creating the view",
+ readonly = True,
+ required = True,
+ min_length = 1,
+ )
+
+ viewName = TextLine(
+ title = u"View name",
+ readonly = True,
+ required = True,
+ min_length = 1,
+ )
+
+ layer = BytesLine(
+ title = u"Layer",
+ description = u"The skin layer the view is registered for",
+ required = False,
+ readonly = True,
+ min_length = 1,
+ default = "default",
+ )
+
+class IViewConfiguration(IConfiguration, IViewConfigurationInfo):
+
+ def getView(object, request):
+ """Return an adapter for the object
+
+ The adapter is computed by passing the object to the
+ registered factory.
+ """
+
+
+class IZPTTemplate(Interface):
+ """ZPT Templates for use in views
+ """
+
+ contentType = BytesLine(
+ title=u'Content type of generated output',
+ required=True,
+ default='text/html'
+ )
+
+ source = Text(
+ title=u"Source",
+ description=u"""The source of the page template.""",
+ required=True)
+
+ def render(context, request, *args, **kw):
+ """Render the page template.
+
+ The context argument is bound to the top-level 'context'
+ variable. The request argument is bound to the top-level
+ 'request' variable. The positional arguments are bound to the
+ 'args' variable and the keyword arguments are bound to the
+ 'options' variable.
+
+ """
+
+class IPageConfigurationInfo(IViewConfigurationInfo):
+
+ factoryName = BytesLine(
+ title=u"The dotted name of a factory for creating the view",
+ readonly = True,
+ required = False,
+ min_length = 1,
+ )
+
+ template = ComponentLocation(
+ title = u"Page template",
+ required = False,
+ readonly = True,
+ type = IZPTTemplate,
+ )
+
+class IPageConfiguration(IConfiguration, IPageConfigurationInfo):
+
+ def getView(object, request):
+ """Return a page for the object.
+ """
=== Zope3/src/zope/app/interfaces/services/package.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/package.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,56 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+
+from zope.app.interfaces.container import IContainer
+from zope.app.interfaces.services.service import IComponentManager
+
+class IPackages(IContainer, IComponentManager):
+ """Packages objects contain database packages
+
+ They support simple containment as well as package query and lookup.
+ """
+
+doc = IPackages.__doc__ + """
+$Id$
+"""
+
+
+
+"""XXX short summary goes here.
+
+XXX longer description goes here.
+
+$Id$
+"""
+
+from zope.app.interfaces.container import IContainer
+
+class IPackage(IContainer):
+ """Component and component configuration containers.
+ """
+
+
+
+
+"""IPackageAdding
+
+$Id$
+"""
+from zope.app.interfaces.container import IAdding
+
+class IPackageAdding(IAdding):
+ """The Package Adding is special, since it is not part of the content
+ namespace, but has a similar functionality as a Folder. Therefore there
+ are views that overlap; this interface was created so that there are no
+ configuration conflicts."""
=== Zope3/src/zope/app/interfaces/services/principalannotation.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/principalannotation.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,30 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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 for storing IAnnotations for principals."""
+
+from zope.interface import Interface
+
+
+class IPrincipalAnnotationService(Interface):
+ """Stores IAnnotations for IPrinicipals."""
+
+ def getAnnotation(principal):
+ """Return object implementing IAnnotations for the givin IPrinicipal.
+
+ If there is no IAnnotations it will be created and then returned.
+ """
+
+ def hasAnnotation(principal):
+ """Return boolean indicating if given IPrincipal has IAnnotations."""
=== Zope3/src/zope/app/interfaces/services/query.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/query.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""XXX short summary goes here.
+
+XXX longer description goes here.
+
+$Id$
+"""
+
+from zope.interface import Interface, Attribute
+
+class IQueryProcessor(Interface):
+
+ input_interface = Attribute("The __implements__-like specification "
+ "for the input interfaces.")
+ output_interface = Attribute("The __implements__-like specification "
+ "for the output interfaces.")
+
+ def __call__(query):
+ """Processes the query returning the result.
+
+ The query must be adaptable to each interface in input_interface.
+ The output should be adaptable to each interface in the
+ output_interface.
+ """
+
+
+"""XXX short summary goes here.
+
+XXX longer description goes here.
+
+$Id$
+"""
+from zope.interface import Interface
+
+class IQueryService(Interface):
+
+ def listQueries():
+ '''Returns a list of query registrations.
+
+ (query_id, permission_id, input_interface, output_interface)'''
+
+ def processQuery(query_id, input):
+ '''Processes the input, using the query registered with query_id.
+
+ The input is adapted to the input interface that is registered for
+ the query_id.'''
=== Zope3/src/zope/app/interfaces/services/service.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:04 2002
+++ Zope3/src/zope/app/interfaces/services/service.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,169 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__metaclass__ = type
+
+from zope.publisher.interfaces.browser import IBrowserPresentation
+from zope.interface import Interface
+from zope.app.component.interfacefield import InterfaceField
+from zope.schema import BytesLine
+from zope.component.interfaces import IPresentation
+from zope.app.interfaces.container import IContainer
+
+from zope.interface import Interface, Attribute
+
+from zope.component.interfaces import IServiceService
+
+from zope.app.interfaces.services.configuration \
+ import INamedComponentConfiguration
+
+from zope.app.interfaces.services.configuration \
+ import INameComponentConfigurable
+
+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 IReadServiceManagerContainer(Interface):
+
+ def getServiceManager():
+ """Returns the service manager contained in this object.
+
+ If there isn't a service manager, raise a component lookup.
+ """
+
+ def queryServiceManager(default=None):
+ """Returns the service manager contained in this object.
+
+ If there isn't a service manager, return the default.
+ """
+
+ def hasServiceManager():
+ """Query to find out if the component defines a service manager."""
+
+Read = IReadServiceManagerContainer
+
+class IWriteServiceManagerContainer(Interface):
+
+ def setServiceManager(sm):
+ """Sets the service manager for this object."""
+
+Write = IWriteServiceManagerContainer
+
+class IServiceManagerContainer(IReadServiceManagerContainer,
+ IWriteServiceManagerContainer):
+ pass
+
+
+class IBindingAware(Interface):
+
+ def bound(name):
+ """Inform a service components that it's providing a service
+
+ Called when an immediately-containing service manager binds
+ this object to perform the named service.
+ """
+
+ def unbound(name):
+ """Inform a service components that it's no longer providing a service
+
+ Called when an immediately-containing service manager unbinds
+ this object from performing the named service.
+ """
+
+from zope.interface import Attribute
+
+class IServiceManager(IServiceService, IComponentManager,
+ INameComponentConfigurable):
+ """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.
+ """
+
+ Packages = Attribute("Package container")
+
+class INameResolver(Interface):
+ """Objects that can resolve dotted names to objects
+ """
+
+ def resolve(dotted_name):
+ """Resolve the given dotted name to a module global variable.
+
+ If the name ends with a trailing dot, the last name segment
+ may be repeated.
+ """
+
+class IServiceConfiguration(INamedComponentConfiguration):
+ """Service Configuration
+
+ Service configurations are dependent on the components that they
+ configure. They register themselves as component dependents.
+
+ The name of a service configuration is used to determine the service
+ type.
+ """
+
+class IViewPackageInfo(Interface):
+
+ forInterface = InterfaceField(
+ title = u"For interface",
+ description = u"The interface of the objects being viewed",
+ required = True,
+ )
+
+ presentationType = InterfaceField(
+ title = u"Presentation type",
+ description = u"The presentation type of a view",
+ required = True,
+ type = IPresentation,
+ default = IBrowserPresentation,
+ )
+
+ factoryName = BytesLine(
+ title=u"The dotted name of a factory for creating the view",
+ required = True,
+ )
+
+ layer = BytesLine(
+ title = u"Layer",
+ description = u"The skin layer the view is registered for",
+ required = False,
+ min_length = 1,
+ default = "default",
+ )
+
+class IViewPackage(IViewPackageInfo, IContainer):
+ """Sub-packages that contain templates that are registered as views
+ """
=== Zope3/src/zope/app/interfaces/services/session.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:05 2002
+++ Zope3/src/zope/app/interfaces/services/session.py Wed Dec 25 09:13:02 2002
@@ -0,0 +1,76 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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 session service."""
+
+from zope.interface import Interface
+
+
+class ISessionService(Interface):
+ """Manages sessions - fake state over multiple browser requests."""
+
+ def getSessionId(browserRequest):
+ """Return sessionId for the given request.
+
+ If the request doesn't have an attached sessionId a new one will
+ be generated.
+
+ This will do whatever is possible to do the HTTP request to ensure
+ the session id will be preserved. Depending on the specific
+ method, further action might be necessary on the part of the user.
+ See the documentation for the specific implementation and its
+ interfaces.
+ """
+
+ def invalidate(sessionId):
+ """Destroy all attached data and invalidate the session."""
+
+ def getDataManager(name):
+ """Get the ISessionDataManager for given name.
+
+ Raises KeyError if name is unknown.
+ """
+
+
+class IConfigureSessionService(Interface):
+ """Configuration for ISessionService."""
+
+ def registerDataManager(name, dataManager):
+ """Register ISessionDataManager under given name.
+
+ Raises ValueError if a data manager with that name already
+ """
+
+ def unregisterDataManager(name):
+ """Remove ISessionDataManager."""
+
+
+class ISessionDataManager(Interface):
+ """Stores data objects for sessions.
+
+ In general, a data object will be stored for each sessionId requested from
+ the ISessionDataManager.
+
+ Sub-interfaces should specify the interface(s) implemented by the data
+ objects.
+ """
+
+ def getDataObject(sessionId):
+ """Returns data attached to session.
+
+ Should create new object if this is a new session.
+ """
+
+ def deleteData(sessionId):
+ """Delete data attached to session."""