[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/FSSync - FSDirective.py:1.1.2.1 FSRegistry.py:1.1.2.2 IFSSyncService.py:1.1.2.2 IGlobalFSSyncService.py:1.1.2.2 configure.zcml:1.1.2.2

Naveen P pnaveen@zeomega.com
Tue, 15 Oct 2002 09:48:18 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/FSSync
In directory cvs.zope.org:/tmp/cvs-serv9655

Modified Files:
      Tag: FileSystemSync-branch
	FSRegistry.py IFSSyncService.py IGlobalFSSyncService.py 
	configure.zcml 
Added Files:
      Tag: FileSystemSync-branch
	FSDirective.py 
Log Message:
FSDirectory


=== Added File Zope3/lib/python/Zope/App/FSSync/FSDirective.py ===
##############################################################################
#
# 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.
# 
##############################################################################
""" Register class directive.
$Id: FSDirective.py,v 1.1.2.1 2002/10/15 13:48:17 pnaveen Exp $
"""
from Zope.App.FSSync.FSRegistry import provideSynchronizer
from Zope.Configuration.Action import Action

"""
registerFSRegistry method to register Class and Serializer factory associated with it.
"""
def registerFSRegistry(_context, class_, factory):
	__class = _context.resolve(class_)
	__factory = _context.resolve(factory)	
	return [
		Action(
			discriminator = ('adapter', class_),
			callable = provideSynchronizer,
			args = (__class, __factory),
			)
		]


=== Zope3/lib/python/Zope/App/FSSync/FSRegistry.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/lib/python/Zope/App/FSSync/FSRegistry.py:1.1.2.1	Fri Oct 11 08:30:49 2002
+++ Zope3/lib/python/Zope/App/FSSync/FSRegistry.py	Tue Oct 15 09:48:17 2002
@@ -23,16 +23,18 @@
     __implements__ = IGlobalFSSyncService
 
     def __init__(self):
-	self._class_factory_reg = {}
+        self._class_factory_reg = {}
+        
+    def __call__(self):
+        return self.__init__()
 
     def querySynchronizer(self, object):
         """Return factory method for a given class.
-	
         The factory is returned of the object if None of the 
- 	Factory method is present return None
+        Factory method is present return None
         """
 
-	factory = self._class_factory_reg.get(object.__class__)
+        factory = self._class_factory_reg.get(object.__class__)
         if factory is not None:
             return factory(object)
         return None
@@ -41,7 +43,21 @@
     def provideSynchronizer(self,class_, factory):
         """sets class_,factory into the dictionary 
         """
-	if class_ in self._class_factory_reg:
-		raise  DuplicationError
-	else:
-		self._class_factory_reg[class_] = factory
+        if class_ in self._class_factory_reg:
+            raise  DuplicationError
+        else:
+            self._class_factory_reg[class_] = factory
+
+    _clear = __init__
+
+# the FS registry serializer service instance
+fsRegistry = FSRegistry()
+provideSynchronizer = fsRegistry.provideSynchronizer
+querySynchronizer = fsRegistry.querySynchronizer
+
+_clear = fsRegistry._clear
+
+# Register our cleanup with Testing.CleanUp to make writing unit tests simpler.
+from Zope.Testing.CleanUp import addCleanUp
+addCleanUp(_clear)
+del addCleanUp


=== Zope3/lib/python/Zope/App/FSSync/IFSSyncService.py 1.1.2.1 => 1.1.2.2 ===


=== Zope3/lib/python/Zope/App/FSSync/IGlobalFSSyncService.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/lib/python/Zope/App/FSSync/IGlobalFSSyncService.py:1.1.2.1	Thu Oct 10 09:14:22 2002
+++ Zope3/lib/python/Zope/App/FSSync/IGlobalFSSyncService.py	Tue Oct 15 09:48:17 2002
@@ -24,8 +24,7 @@
     def provideSynchronizer(class_, factory):
         """Register a synchronizer
 
-        A factory is provides for computing synchronizers for
-        instances of the class.
+        A factory for a Synchronization Adapter is provided to create synchronizers for instances of the class
         """
 
 __doc__ = IGlobalFSSyncService.__doc__ + __doc__


=== Zope3/lib/python/Zope/App/FSSync/configure.zcml 1.1.2.1 => 1.1.2.2 ===
--- Zope3/lib/python/Zope/App/FSSync/configure.zcml:1.1.2.1	Thu Oct 10 00:43:25 2002
+++ Zope3/lib/python/Zope/App/FSSync/configure.zcml	Tue Oct 15 09:48:17 2002
@@ -1,6 +1,8 @@
 <zopeConfigure xmlns="http://namespaces.zope.org/zope">
 
-<adapter provides="Zope.App.FSSync.IObjectFile."
-         factory=".Default." />
+<serviceType id='FSRegistryService'
+           interface='.IGlobalFSSyncService.' />
 
+<service serviceType='FSRegistryService'
+           component='.FSRegistry.fsRegistry' />
 </zopeConfigure>