[Zope-CVS] CVS: Products/AdaptableStorage/serial/interfaces - IAspectEvent.py:1.1 IKeychainGenerator.py:1.1 IMapperEvent.py:1.1 IClassifier.py:1.5 IDeserializationEvent.py:1.4 IGateway.py:1.4 IObjectMapper.py:1.4 IObjectSerializer.py:1.4 ISerializationEvent.py:1.5 public.py:1.3 IEventBase.py:NONE
Shane Hathaway
shane@zope.com
Mon, 9 Dec 2002 13:26:00 -0500
Update of /cvs-repository/Products/AdaptableStorage/serial/interfaces
In directory cvs.zope.org:/tmp/cvs-serv24698/serial/interfaces
Modified Files:
IClassifier.py IDeserializationEvent.py IGateway.py
IObjectMapper.py IObjectSerializer.py ISerializationEvent.py
public.py
Added Files:
IAspectEvent.py IKeychainGenerator.py IMapperEvent.py
Removed Files:
IEventBase.py
Log Message:
More sanitization and documentation:
- Renamed RecordSchema to FieldSchema and made the simpler schema classes
usable. This removed the need to always work with record sets when all
that is needed is a single value.
- Finally successfully abstracted away keychain generation. Now gateways
and serializers don't have to duplicate logic.
- Renamed IEventBase to IMapperEvent, created a derivative IAspectEvent, and
moved some of the methods of IMapperEvent to IAspectEvent.
ISerializationEvent and IDeserializationEvent now derive from IAspectEvent.
- Changed IGateways to expect IMapperEvents instead of a (mapper, keychain)
pair.
=== Added File Products/AdaptableStorage/serial/interfaces/IAspectEvent.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Aspect-related event interface base.
$Id: IAspectEvent.py,v 1.1 2002/12/09 18:25:28 shane Exp $
"""
from IMapperEvent import IMapperEvent
class IAspectEvent (IMapperEvent):
def getKeyedObjectSystem():
"""Returns the IKeyedObjectSystem that generated the event."""
def getObject():
"""Returns the object being (de)serialized."""
def setAspectName(name):
"""Sets the name of the aspect being (de)serialized."""
def getAspectName():
"""Returns the name of the aspect being (de)serialized."""
=== Added File Products/AdaptableStorage/serial/interfaces/IKeychainGenerator.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Keychain generator interface
$Id: IKeychainGenerator.py,v 1.1 2002/12/09 18:25:28 shane Exp $
"""
from Interface import Interface
class IKeychainGenerator (Interface):
"""A utility for generating sub-keychains.
"""
def makeKeychain(event, name, stored):
"""Returns a new keychain.
event is an IMapperEvent.
name is the name of the subobject.
stored is a flag indicating whether the returned keychain will
be stored. If it will not be stored, the generated keychain
can not be a random label.
"""
=== Added File Products/AdaptableStorage/serial/interfaces/IMapperEvent.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Mapper event interface.
$Id: IMapperEvent.py,v 1.1 2002/12/09 18:25:28 shane Exp $
"""
from Interface import Interface
class IMapperEvent (Interface):
def getObjectMapper():
"""Returns the object mapper for the object being (de)serialized."""
def getKeychain():
"""Returns the keychain of the object being (de)serialized."""
def makeKeychain(name, stored):
"""Generates a keychain for a subobject.
"""
=== Products/AdaptableStorage/serial/interfaces/IClassifier.py 1.4 => 1.5 ===
--- Products/AdaptableStorage/serial/interfaces/IClassifier.py:1.4 Mon Dec 9 10:57:24 2002
+++ Products/AdaptableStorage/serial/interfaces/IClassifier.py Mon Dec 9 13:25:28 2002
@@ -36,12 +36,16 @@
"""Returns a classification and mapper_name.
"""
- def classifyState(object_mapper, keychain):
+ def classifyState(event):
"""Returns a classification and mapper_name.
+ event is an IMapperEvent.
+
May load the classification from storage.
"""
- def store(object_mapper, keychain, classification):
+ def store(event, classification):
"""Stores the classification of an object.
+
+ event is an IMapperEvent.
"""
=== Products/AdaptableStorage/serial/interfaces/IDeserializationEvent.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/serial/interfaces/IDeserializationEvent.py:1.3 Sat Dec 7 00:59:13 2002
+++ Products/AdaptableStorage/serial/interfaces/IDeserializationEvent.py Mon Dec 9 13:25:28 2002
@@ -16,10 +16,10 @@
$Id$
"""
-from IEventBase import IEventBase
+from IAspectEvent import IAspectEvent
-class IDeserializationEvent(IEventBase):
+class IDeserializationEvent(IAspectEvent):
"""Aspect deserializers call methods of this interface to restore
internal and external references.
"""
=== Products/AdaptableStorage/serial/interfaces/IGateway.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/serial/interfaces/IGateway.py:1.3 Fri Dec 6 17:06:50 2002
+++ Products/AdaptableStorage/serial/interfaces/IGateway.py Mon Dec 9 13:25:28 2002
@@ -35,9 +35,11 @@
See serial.interfaces.ISchema.
"""
- def load(object_mapper, keychain):
+ def load(event):
"""Loads data.
+ event is an IMapperEvent.
+
Returns a pair containing the data and an object that acts as
a serial number or a hash of the data. The serial number is
either a time stamp or some other object that can be
@@ -45,8 +47,10 @@
hashable.
"""
- def store(object_mapper, keychain, data):
+ def store(event, data):
"""Stores data.
+
+ event is an IMapperEvent.
Returns a new serial.
"""
=== Products/AdaptableStorage/serial/interfaces/IObjectMapper.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/serial/interfaces/IObjectMapper.py:1.3 Mon Dec 9 10:57:24 2002
+++ Products/AdaptableStorage/serial/interfaces/IObjectMapper.py Mon Dec 9 13:25:28 2002
@@ -30,13 +30,24 @@
"""Returns the IGateway for this mapper."""
def getClassifier():
- """Returns the classifier for objects referenced by this mapper."""
+ """Returns the IClassifier for objects referenced by this mapper.
+
+ If this mapper references no other objects, it's safe to
+ return None.
+ """
def getSubMapper(name):
- """Returns the named sub-mapper.
+ """Returns the named sub-IObjectMapper.
The name of a sub-mapper is chosen by either a classifier or
an aspect.
+ """
+
+ def getKeychainGenerator():
+ """Returns the IKeychainGenerator for subobjects.
+
+ Some serializers and gateways make use of this. If no serializer
+ or gateway needs this, it's safe to return None.
"""
def isVolatile():
=== Products/AdaptableStorage/serial/interfaces/IObjectSerializer.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/serial/interfaces/IObjectSerializer.py:1.3 Mon Dec 9 10:57:24 2002
+++ Products/AdaptableStorage/serial/interfaces/IObjectSerializer.py Mon Dec 9 13:25:28 2002
@@ -34,7 +34,7 @@
"""Returns true if this mapper can serialize the given object.
"""
- def serialize(object_mapper, keychain, object, keyed_ob_sys):
+ def serialize(keyed_ob_sys, object_mapper, keychain, object):
"""Returns the serialization of an object.
Returns a pair containing the serialized state of the object
@@ -44,7 +44,7 @@
corresponding aspects.
"""
- def deserialize(object_mapper, keychain, object, keyed_ob_sys, full_state):
+ def deserialize(keyed_ob_sys, object_mapper, keychain, object, full_state):
"""Fills an object based on a previously serialized state.
"""
=== Products/AdaptableStorage/serial/interfaces/ISerializationEvent.py 1.4 => 1.5 ===
--- Products/AdaptableStorage/serial/interfaces/ISerializationEvent.py:1.4 Mon Dec 9 10:57:24 2002
+++ Products/AdaptableStorage/serial/interfaces/ISerializationEvent.py Mon Dec 9 13:25:28 2002
@@ -16,10 +16,10 @@
$Id$
"""
-from IEventBase import IEventBase
+from IAspectEvent import IAspectEvent
-class ISerializationEvent(IEventBase):
+class ISerializationEvent(IAspectEvent):
"""Serialization event.
Aspect serializers call methods of this interface to create
=== Products/AdaptableStorage/serial/interfaces/public.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/serial/interfaces/public.py:1.2 Mon Dec 9 10:57:24 2002
+++ Products/AdaptableStorage/serial/interfaces/public.py Mon Dec 9 13:25:28 2002
@@ -16,14 +16,16 @@
$Id$
"""
+from IAspectEvent import IAspectEvent
from IAspectSerializer import IAspectSerializer
from IClassifier import IClassifier
from IDeserializationEvent import IDeserializationEvent
-from IEventBase import IEventBase
from IFullDeserializationEvent import IFullDeserializationEvent
from IFullSerializationEvent import IFullSerializationEvent
from IGateway import IGateway
+from IKeychainGenerator import IKeychainGenerator
from IKeyedObjectSystem import IKeyedObjectSystem
+from IMapperEvent import IMapperEvent
from IObjectMapper import IObjectMapper
from IObjectSerializer import IObjectSerializer
from ISchema import ISchema
=== Removed File Products/AdaptableStorage/serial/interfaces/IEventBase.py ===