[Zope-Checkins] CVS: Zope3/lib/python/Zope/StartUp - RequestFactory.py:1.1.2.3 ServerType.py:1.1.2.3 SiteDefinition.py:1.1.2.2 startup-registry.zcml:1.1.2.2
Shane Hathaway
shane@cvs.zope.org
Fri, 12 Apr 2002 17:31:06 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/StartUp
In directory cvs.zope.org:/tmp/cvs-serv20835/lib/python/Zope/StartUp
Modified Files:
Tag: Zope-3x-branch
RequestFactory.py ServerType.py SiteDefinition.py
startup-registry.zcml
Log Message:
Merged Zope3-Server-Branch.
=== Zope3/lib/python/Zope/StartUp/RequestFactory.py 1.1.2.2 => 1.1.2.3 ===
#
##############################################################################
-"""
-
-$Id$
-"""
-
-from Interface import Interface
-import copy
-
-
-class IRequestFactory(Interface):
- """This is a pure read-only interface, since the values are set through
- a ZCML directive and we shouldn't be able to change them.
- """
-
- def realize(db):
- """Realize the factory by initalizing the publication.
-
- The method returns the realized object.
- """
-
-
- def __call__(input_stream, output_steam, env):
- """Call the Request Factory"""
-
-
-
-
-
-class RequestFactory:
- """This class will generically create RequestFactories. This way I do
- not have to create a method for each Server Type there is.
- """
-
- __implements__ = IRequestFactory
-
- def __init__(self, publication, request):
- """Initialize Request Factory"""
- self._pubFactory = publication
- self._publication = None
- self._request = request
-
-
- ############################################################
- # Implementation methods for interface
- # Zope.StartUp.RequestFactory.IRequestFactory
-
- def realize(self, db):
- 'See Zope.StartUp.RequestFactory.IRequestFactory'
- realized = copy.copy(self)
- realized._publication = realized._pubFactory(db)
- return realized
-
-
- def __call__(self, input_stream, output_steam, env):
- 'See Zope.StartUp.RequestFactory.IRequestFactory'
- request = self._request(input_stream, output_steam, env)
- request.setPublication(self._publication)
- return request
-
- #
- ############################################################
+"""ctory.py,v 1.1.2.2 2002/04/02 02:20:40 srichter Exp $
+"""
+
+from Interface import Interface
+import copy
+
+
+class IRequestFactory(Interface):
+ """This is a pure read-only interface, since the values are set through
+ a ZCML directive and we shouldn't be able to change them.
+ """
+
+ def realize(db):
+ """Realize the factory by initalizing the publication.
+
+ The method returns the realized object.
+ """
+
+
+ def __call__(input_stream, output_steam, env):
+ """Call the Request Factory"""
+
+
+
+
+
+class RequestFactory:
+ """This class will generically create RequestFactories. This way I do
+ not have to create a method for each Server Type there is.
+ """
+
+ __implements__ = IRequestFactory
+
+ def __init__(self, publication, request):
+ """Initialize Request Factory"""
+ self._pubFactory = publication
+ self._publication = None
+ self._request = request
+
+
+ ############################################################
+ # Implementation methods for interface
+ # Zope.StartUp.RequestFactory.IRequestFactory
+
+ def realize(self, db):
+ 'See Zope.StartUp.RequestFactory.IRequestFactory'
+ realized = copy.copy(self)
+ realized._publication = realized._pubFactory(db)
+ return realized
+
+
+ def __call__(self, input_stream, output_steam, env):
+ 'See Zope.StartUp.RequestFactory.IRequestFactory'
+ request = self._request(input_stream, output_steam, env)
+ request.setPublication(self._publication)
+ return request
+
+ #
+ ############################################################
=== Zope3/lib/python/Zope/StartUp/ServerType.py 1.1.2.2 => 1.1.2.3 ===
#
##############################################################################
-"""
-
-$Id$
-"""
-
-from Interface import Interface
-from RequestFactoryRegistry import getRequestFactory
-
-
-class IServerType(Interface):
- """This is a pure read-only interface, since the values are set through
- a ZCML directive and we shouldn't be able to change them.
- """
-
- def create(task_dispatcher, db, port=None, verbose=None):
- """Create the server knowing the port, task dispatcher and the ZODB.
- """
-
-
-class ServerType:
-
- __implements__ = IServerType
-
-
- def __init__(self, name, factory, requestFactory, logFactory,
- defaultPort, defaultVerbose):
- """ """
- self._name = name
- self._factory = factory
- self._requestFactory = requestFactory
- self._logFactory = logFactory
- self._defaultPort = defaultPort
- self._defaultVerbose = defaultVerbose
-
-
- ############################################################
- # Implementation methods for interface
- # Zope.StartUp.ServerType.IServerType
-
- def create(self, task_dispatcher, db, port=None, verbose=None):
- 'See Zope.StartUp.ServerType.IServerType'
-
-
- request_factory = getRequestFactory(self._requestFactory)
- request_factory = request_factory.realize(db)
-
- if port is None:
- port = self._defaultPort
-
- if verbose is None:
- verbose = self._defaultVerbose
-
- apply(self._factory,
- (request_factory, self._name, '', port),
- {'task_dispatcher': task_dispatcher,
- 'verbose': verbose,
- 'hit_log': self._logFactory()})
-
- #
- ############################################################
-
-
+"""e.py,v 1.1.2.2 2002/04/02 02:20:40 srichter Exp $
+"""
+
+from Interface import Interface
+from RequestFactoryRegistry import getRequestFactory
+
+
+class IServerType(Interface):
+ """This is a pure read-only interface, since the values are set through
+ a ZCML directive and we shouldn't be able to change them.
+ """
+
+ def create(task_dispatcher, db, port=None, verbose=None):
+ """Create the server knowing the port, task dispatcher and the ZODB.
+ """
+
+
+class ServerType:
+
+ __implements__ = IServerType
+
+
+ def __init__(self, name, factory, requestFactory, logFactory,
+ defaultPort, defaultVerbose):
+ """ """
+ self._name = name
+ self._factory = factory
+ self._requestFactory = requestFactory
+ self._logFactory = logFactory
+ self._defaultPort = defaultPort
+ self._defaultVerbose = defaultVerbose
+
+
+ ############################################################
+ # Implementation methods for interface
+ # Zope.StartUp.ServerType.IServerType
+
+ def create(self, task_dispatcher, db, port=None, verbose=None):
+ 'See Zope.StartUp.ServerType.IServerType'
+
+ request_factory = getRequestFactory(self._requestFactory)
+ request_factory = request_factory.realize(db)
+
+ if port is None:
+ port = self._defaultPort
+
+ if verbose is None:
+ verbose = self._defaultVerbose
+
+ apply(self._factory,
+ (request_factory, self._name, '', port),
+ {'task_dispatcher': task_dispatcher,
+ 'verbose': verbose,
+ 'hit_log': self._logFactory()})
+
+ #
+ ############################################################
+
+
=== Zope3/lib/python/Zope/StartUp/SiteDefinition.py 1.1.2.1 => 1.1.2.2 ===
# not create one.
self._initDB()
-
+
# Start the servers
for type, server_info in self._servers.items():
server = getServerType(type)
-
server.create(td, self._zodb, server_info['port'],
server_info['verbose'])
-
def _initDB(self):
"""Initialize the ZODB"""
=== Zope3/lib/python/Zope/StartUp/startup-registry.zcml 1.1.2.1 => 1.1.2.2 ===
+ <startup:registerRequestFactory name="VFSRequestFactory"
+ publication =
+ "Zope.App.ZopePublication.VFS.Publication.VFSPublication"
+ request = "Zope.Publisher.VFS.VFSRequest."
+ />
+
+
<startup:registerServerType
name = "Browser"
- factory = "Zope.Server.PublisherServers.PublisherHTTPServer"
+ factory = "Zope.Server.HTTP.PublisherHTTPServer."
requestFactory="BrowserRequestFactory"
- logFactory = "Zope.Server.HTTPServer.CommonHitLogger"
+ logFactory = "Zope.Server.HTTP.CommonHitLogger."
defaultPort="8080"
defaultVerbose="true" />
<startup:registerServerType
name = "XML-RPC"
- factory = "Zope.Server.PublisherServers.PublisherHTTPServer"
+ factory = "Zope.Server.HTTP.PublisherHTTPServer."
requestFactory="XMLRPCRequestFactory"
- logFactory = "Zope.Server.HTTPServer.CommonHitLogger"
+ logFactory = "Zope.Server.HTTP.CommonHitLogger."
defaultPort="8081"
+ defaultVerbose="true" />
+
+
+ <startup:registerServerType
+ name = "FTP"
+ factory = "Zope.Server.FTP.PublisherFTPServer."
+ requestFactory="VFSRequestFactory"
+ logFactory = "Zope.Server.FTP.CommonFTPActivityLogger."
+ defaultPort="8021"
defaultVerbose="true" />