[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - IServiceService.py:1.2 GlobalServiceManager.py:1.4 ServiceManagerContainer.py:1.3 IServiceManager.py:NONE
Jim Fulton
jim@zope.com
Thu, 11 Jul 2002 14:22:07 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv7355/lib/python/Zope/ComponentArchitecture
Modified Files:
GlobalServiceManager.py ServiceManagerContainer.py
Added Files:
IServiceService.py
Removed Files:
IServiceManager.py
Log Message:
Reimplemented service managers to be package based. Service managers
are no longer containers. They have a packages subobject (not a
packages service) that contains packages. TTW components are created
in packages. To register a component, create the appropriate component
directive objects (these should be called configuration objects).
This should be viewed as a prototype to illustrate the idea of
packages. Lots of things can change (especially UI) and many things
aren't done (e.g. visiting created directives).
In the course of this, I fixed a bunch of bugs and problems in
traversal machinery.
I also renamed Zope.ComponentArchitecture.IServiceManager back to
IServiceService, since this interface doesn't actually specify any
management.
=== Zope3/lib/python/Zope/ComponentArchitecture/IServiceService.py 1.1 => 1.2 ===
+##############################################################################
+#
+# 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$
+"""
+
+from Interface import Interface
+
+class IServiceService(Interface):
+
+ def getServiceDefinitions():
+ """Retrieve all Service Definitions
+
+ Should return a list of tuples (name, interface)
+ """
+
+ def getInterfaceFor(name):
+ """Retrieve the service interface for the given name
+ """
+
+ def getService(name):
+ """Retrieve a service implementation
+
+ Raises ComponentLookupError if the service can't be found.
+
+ """
+
+ def queryService(name, default=None):
+ """Look for a named service.
+
+ Return the default if the service can't be found.
+
+ """
+
=== Zope3/lib/python/Zope/ComponentArchitecture/GlobalServiceManager.py 1.3 => 1.4 ===
"""
from Zope.Exceptions import DuplicationError
-from IServiceManager import IServiceManager
+from IServiceService import IServiceService
from Exceptions import ComponentLookupError
-class IGlobalServiceManager(IServiceManager):
+class IGlobalServiceManager(IServiceService):
def defineService(name, interface):
"""Define a new service of the given name implementing the given
@@ -66,7 +66,7 @@
self.__defs[name] = interface
def getServiceDefinitions(self):
- """see IServiceManager Interface"""
+ """see IServiceService Interface"""
return self.__defs.items()
def provideService(self, name, component):
@@ -84,7 +84,7 @@
self.__services[name] = component
def getService(self, name):
- """see IServiceManager interface"""
+ """see IServiceService interface"""
service = self.queryService(name)
if service is None:
raise ComponentLookupError(name)
@@ -92,7 +92,7 @@
return service
def queryService(self, name, default=None):
- """see IServiceManager interface"""
+ """see IServiceService interface"""
return self.__services.get(name, default)
@@ -100,7 +100,7 @@
serviceManager = GlobalServiceManager() # the global service manager instance
-
+defineService = serviceManager.defineService
_clear = serviceManager._clear
=== Zope3/lib/python/Zope/ComponentArchitecture/ServiceManagerContainer.py 1.2 => 1.3 ===
"""
from IServiceManagerContainer import IServiceManagerContainer
-from IServiceManager import IServiceManager
+from IServiceService import IServiceService
from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
_marker = object()
@@ -49,10 +49,10 @@
def setServiceManager(self, sm):
'''See interface IWriteServiceManagerContainer'''
- if IServiceManager.isImplementedBy(sm):
+ if IServiceService.isImplementedBy(sm):
self.__sm = sm
else:
- raise ValueError('setServiceManager requires an IServiceManager')
+ raise ValueError('setServiceManager requires an IServiceService')
#
############################################################
=== Removed File Zope3/lib/python/Zope/ComponentArchitecture/IServiceManager.py ===