[Zope-CVS] CVS: Products/AdaptableStorage/serial/interfaces - IClassifier.py:1.2 IDeserializationEvent.py:1.2 IEventBase.py:1.3 IGateway.py:1.3 IKeyedObjectSystem.py:1.2 IObjectGateway.py:1.2 IObjectMapper.py:1.2 IObjectSerializer.py:1.2 ISerializationEvent.py:1.3
Shane Hathaway
shane@zope.com
Fri, 6 Dec 2002 17:07:21 -0500
Update of /cvs-repository/Products/AdaptableStorage/serial/interfaces
In directory cvs.zope.org:/tmp/cvs-serv8198/serial/interfaces
Modified Files:
IClassifier.py IDeserializationEvent.py IEventBase.py
IGateway.py IKeyedObjectSystem.py IObjectGateway.py
IObjectMapper.py IObjectSerializer.py ISerializationEvent.py
Log Message:
Experiment: removed mapper_name from OIDs, with the intent of allowing
loading and storage by different mappers depending on what the classifier
specifies. Not yet complete. Involved changes to virtually every module. :-)
I may decide to revert this. The shane-before-mapper-name-removal tag
was added just before this checkin.
=== Products/AdaptableStorage/serial/interfaces/IClassifier.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/serial/interfaces/IClassifier.py:1.1 Wed Nov 27 13:37:06 2002
+++ Products/AdaptableStorage/serial/interfaces/IClassifier.py Fri Dec 6 17:06:50 2002
@@ -24,24 +24,24 @@
Implementations of this interface are a little like biologists.
During serialization, the classifyObject() method returns a
mapping containing the classification of subob (like a biologist
- identifying a creature's genus and species). During deserialization, the
- chooseMapper() method decides what kind of objects to use for a
- classification (like a biologist showing you a creature of a certain
- genus and species).
+ identifying a creature's genus and species). During
+ deserialization, the classifyState() method decides what kind of
+ objects to create for a stored state (like a biologist showing you
+ a creature of a certain genus and species).
- The keys in the classification are implementation-dependent.
+ The keys in the classification mapping are implementation-dependent.
"""
- def classifyObject(value):
- """Returns a classification and mapper_name for the given object.
+ def classifyObject(keychain, value):
+ """Returns a classification and mapper_name.
"""
- def classifyFilename(filename, isdir):
- """Returns a classification and mapper_name given a filename.
+ def classifyState(mapper, keychain):
+ """Returns a classification and mapper_name.
- Generally, the filename extension is examined.
+ May load the classification from storage.
"""
- def chooseMapper(classification):
- """Returns a mapper_name given a classification.
+ def store(mapper, keychain, classification):
+ """Stores the classification of an object.
"""
=== Products/AdaptableStorage/serial/interfaces/IDeserializationEvent.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/serial/interfaces/IDeserializationEvent.py:1.1 Wed Nov 27 13:37:06 2002
+++ Products/AdaptableStorage/serial/interfaces/IDeserializationEvent.py Fri Dec 6 17:06:50 2002
@@ -28,7 +28,7 @@
"""Indicates that a named internal subobject was deserialized.
"""
- def dereference(name, mapper_name=None, key=None, classification=None):
+ def dereference(name, keychain):
"""Retrieves a referenced subobject (usually ghosted initially).
"""
=== Products/AdaptableStorage/serial/interfaces/IEventBase.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/serial/interfaces/IEventBase.py:1.2 Wed Dec 4 23:18:08 2002
+++ Products/AdaptableStorage/serial/interfaces/IEventBase.py Fri Dec 6 17:06:50 2002
@@ -29,8 +29,8 @@
def getObjectMapper():
"""Returns the object mapper for the object being (de)serialized."""
- def getKey():
- """Returns the key of the object being (de)serialized."""
+ def getKeychain():
+ """Returns the keychain of the object being (de)serialized."""
def getObject():
"""Returns the object being (de)serialized."""
=== Products/AdaptableStorage/serial/interfaces/IGateway.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/serial/interfaces/IGateway.py:1.2 Tue Dec 3 18:10:53 2002
+++ Products/AdaptableStorage/serial/interfaces/IGateway.py Fri Dec 6 17:06:50 2002
@@ -20,7 +20,7 @@
class IGateway (Interface):
- """Loads and stores data by key.
+ """Loads and stores data by keychain.
Implementations can store in entire tables, pieces of tables, translate
for storage in joined tables, or store in some entirely different way.
@@ -35,7 +35,7 @@
See serial.interfaces.ISchema.
"""
- def load(object_mapper, key):
+ def load(object_mapper, keychain):
"""Loads data.
Returns a pair containing the data and an object that acts as
@@ -45,7 +45,7 @@
hashable.
"""
- def store(object_mapper, key, data):
+ def store(object_mapper, keychain, data):
"""Stores data.
Returns a new serial.
=== Products/AdaptableStorage/serial/interfaces/IKeyedObjectSystem.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/serial/interfaces/IKeyedObjectSystem.py:1.1 Wed Nov 27 13:37:06 2002
+++ Products/AdaptableStorage/serial/interfaces/IKeyedObjectSystem.py Fri Dec 6 17:06:50 2002
@@ -19,9 +19,9 @@
from Interface import Interface
class IKeyedObjectSystem (Interface):
- """A collection of objects identifiable by key."""
+ """A collection of objects identifiable by keychain."""
- def loadStub(mapper_name, key, class_info=None):
+ def loadStub(keychain, class_info=None):
"""Returns a class instance, possibly ghosted.
class_info is provided as a possible optimization. Without
@@ -30,11 +30,11 @@
"""
def identifyObject(object):
- """Returns the (mapper_name, key) of an object.
+ """Returns the keychain of an object.
Returns None if the object is not in the keyed object system.
"""
- def newKey():
- """Returns a new key that doesn't conflict with any other key."""
+## def newKey():
+## """Returns a new keychain that doesn't conflict with any other."""
=== Products/AdaptableStorage/serial/interfaces/IObjectGateway.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/serial/interfaces/IObjectGateway.py:1.1 Wed Nov 27 13:37:06 2002
+++ Products/AdaptableStorage/serial/interfaces/IObjectGateway.py Fri Dec 6 17:06:50 2002
@@ -20,14 +20,14 @@
class IObjectGateway (IGateway):
+ ""
+## def makeKey(event, name, stored):
+## """Returns a key for referring to an object stored by this gateway.
- def makeKey(event, name, stored):
- """Returns a key for referring to an object stored by this gateway.
-
- 'event' is an IEventBase. The name of the subobject is in
- 'name'. 'stored' is a flag. If it is true, the key will be
- stored and arbitrary keys are allowed. If it is false, the
- key will not be stored and keys must be derived exclusively
- from event and name.
- """
+## 'event' is an IEventBase. The name of the subobject is in
+## 'name'. 'stored' is a flag. If it is true, the key will be
+## stored and arbitrary keys are allowed. If it is false, the
+## key will not be stored and keys must be derived exclusively
+## from event and name.
+## """
=== Products/AdaptableStorage/serial/interfaces/IObjectMapper.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/serial/interfaces/IObjectMapper.py:1.1 Wed Nov 27 13:37:06 2002
+++ Products/AdaptableStorage/serial/interfaces/IObjectMapper.py Fri Dec 6 17:06:50 2002
@@ -23,13 +23,19 @@
"""A hub for operations involved in mapping a certain kind of object.
"""
- def getDomainMapper():
- """Returns the domain mapper.
+## def getDomainMapper():
+## """Returns the domain mapper.
- Note that every object mapper in a domain mapper must return
- the same domain mapper. Otherwise it's not possible to find
- an object mapper given nothing other than a mapper name.
- """
+## Note that every object mapper in a domain mapper must return
+## the same domain mapper. Otherwise it's not possible to find
+## an object mapper given nothing other than a mapper name.
+## """
+
+ def getSerializer():
+ """Returns the IObjectSerializer for this mapper."""
+
+ def getGateway():
+ """Returns the IGateway for this mapper."""
def getClassifier():
"""Returns the classifier for subobjects.
@@ -40,11 +46,12 @@
ways, even though the same classes are used.
"""
- def getSerializer():
- """Returns the IObjectSerializer for this mapper."""
+ def getSubMapper(name):
+ """Returns the named sub-mapper.
- def getGateway():
- """Returns the IGateway for this mapper."""
+ The name of a sub-mapper is usually chosen by either a
+ classifier or an aspect.
+ """
def isVolatile():
"""Returns true if objects should last only one transaction.
=== Products/AdaptableStorage/serial/interfaces/IObjectSerializer.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/serial/interfaces/IObjectSerializer.py:1.1 Wed Nov 27 13:37:06 2002
+++ Products/AdaptableStorage/serial/interfaces/IObjectSerializer.py Fri Dec 6 17:06:50 2002
@@ -34,30 +34,27 @@
"""Returns true if this mapper can serialize the given object.
"""
- def serialize(object_mapper, key, object, keyed_ob_sys):
+ def serialize(object_mapper, keychain, object, keyed_ob_sys):
"""Returns the serialization of an object.
Returns a pair containing the serialized state of the object
and a list of externally referenced objects of the form
- (mapper_name, key, object). The serialized state should be a
+ (keychain, object). The serialized state should be a
dictionary mapping aspect names to the serialization of the
corresponding aspects.
"""
- def deserialize(object_mapper, key, object, keyed_ob_sys, full_state):
+ def deserialize(object_mapper, keychain, object, keyed_ob_sys, full_state):
"""Fills an object based on a previously serialized state.
"""
- def getClassInfo(full_state=None):
+ def createEmptyInstance(full_state=None):
"""Returns the class info for a state.
If this serializer works with instances of only one class,
- getClassInfo() should return the corresponding class info even
- when full_state is None to improve performance. Otherwise,
- when full_state is None, getClassInfo() should return None.
-
- The class info takes the form ((module, name), args), where
- args is usually None, but may be the arguments for
- constructing the class.
+ createEmptyInstance() should create a class instance even when
+ full_state is None to improve performance. When full_state is
+ None and the optimization is not possible,
+ createEmptyInstance() should return None.
"""
=== Products/AdaptableStorage/serial/interfaces/ISerializationEvent.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/serial/interfaces/ISerializationEvent.py:1.2 Wed Dec 4 23:18:08 2002
+++ Products/AdaptableStorage/serial/interfaces/ISerializationEvent.py Fri Dec 6 17:06:50 2002
@@ -42,11 +42,11 @@
"""
"""
- def makeKey(mapper_name, name, stored_key=0):
+ def makeKey(name, stored_key=0):
"""
"""
- def notifySerializedRef(name, value, is_attribute, mapper_name, key):
+ def notifySerializedRef(name, value, is_attribute, keychain):
"""Indicates that a reference to an external subobject was serialized.
TODO: write more here. ;-)
@@ -58,5 +58,5 @@
def getExternalRefs():
"""Returns the list of external references.
- The returned list is of the form [(mapper_name, key, subobject)].
+ The returned list is of the form [(keychain, subobject)].
"""