Package pyamf :: Package flex :: Module data
[hide private]
[frames] | no frames]

Source Code for Module pyamf.flex.data

  1  # Copyright (c) 2007-2008 The PyAMF Project. 
  2  # See LICENSE for details. 
  3   
  4  """ 
  5  Flex Data Management Service implementation. 
  6   
  7  This module contains the message classes used with Flex Data Management 
  8  Service. 
  9   
 10  @author: U{Thijs Triemstra<mailto:info@collab.nl>} 
 11   
 12  @since: 0.1.0 
 13  """ 
 14   
 15  import pyamf 
 16  from pyamf.flex.messaging import AsyncMessage, AcknowledgeMessage, ErrorMessage 
 17   
 18  __all__ = [ 
 19      'DataMessage', 
 20      'SequencedMessage', 
 21      'PagedMessage', 
 22      'DataErrorMessage' 
 23  ] 
 24   
25 -class DataMessage(AsyncMessage):
26 """ 27 I am used to transport an operation that occured on a managed object 28 or collection. 29 30 This class of message is transmitted between clients subscribed to a 31 remote destination as well as between server nodes within a cluster. 32 The payload of this message describes all of the relevant details of 33 the operation. This information is used to replicate updates and detect 34 conflicts. 35 36 @see: U{DataMessage on Livedocs (external) 37 <http://livedocs.adobe.com/flex/201/langref/mx/data/messages/DataMessage.html>} 38 """ 39
40 - def __init__(self):
41 AsyncMessage.__init__(self) 42 #: Provides access to the identity map which defines the 43 #: unique identity of the item affected by this DataMessage 44 #: (relevant for create/update/delete but not fill operations). 45 self.identity = None 46 #: Provides access to the operation/command of this DataMessage. 47 #: 48 #: Operations indicate how the remote destination should process 49 #: this message. 50 self.operation = None
51
52 -class SequencedMessage(AcknowledgeMessage):
53 """ 54 Response to L{DataMessage} requests. 55 56 @see: U{SequencedMessage on Livedocs (external) 57 <http://livedocs.adobe.com/flex/201/langref/mx/data/messages/SequencedMessage.html>} 58 """ 59
60 - def __init__(self):
61 AcknowledgeMessage.__init__(self) 62 #: Provides access to the sequence id for this message. 63 #: 64 #: The sequence id is a unique identifier for a sequence 65 #: within a remote destination. This value is only unique for 66 #: the endpoint and destination contacted. 67 self.sequenceId = None 68 #: 69 self.sequenceProxies = None 70 #: Provides access to the sequence size for this message. 71 #: 72 #: The sequence size indicates how many items reside in the 73 #: remote sequence. 74 self.sequenceSize = None 75 #: 76 self.dataMessage = None
77
78 -class PagedMessage(SequencedMessage):
79 """ 80 This messsage provides information about a partial sequence result. 81 82 @see: U{PagedMessage on Livedocs (external) 83 <http://livedocs.adobe.com/flex/201/langref/mx/data/messages/PagedMessage.html>} 84 """ 85
86 - def __init__(self):
87 SequencedMessage.__init__(self) 88 #: Provides access to the number of total pages in a sequence 89 #: based on the current page size. 90 self.pageCount = None 91 #: Provides access to the index of the current page in a 92 #: sequence. 93 self.pageIndex = None
94
95 -class DataErrorMessage(ErrorMessage):
96 """ 97 Special cases of ErrorMessage will be sent when a data conflict 98 occurs. 99 100 This message provides the conflict information in addition to 101 the L{ErrorMessage<pyamf.flex.messaging.ErrorMessage>} information. 102 103 @see: U{DataErrorMessage on Livedocs (external) 104 <http://livedocs.adobe.com/flex/201/langref/mx/data/messages/DataErrorMessage.html>} 105 """ 106
107 - def __init__(self):
108 ErrorMessage.__init__(self) 109 #: The client oringinated message which caused the conflict. 110 self.cause = None 111 #: An array of properties that were found to be conflicting 112 #: between the client and server objects. 113 self.propertyNames = None 114 #: The value that the server had for the object with the 115 #: conflicting properties. 116 self.serverObject = None
117 118 #: Namespace for C{flex.data} messages. 119 MESSAGES_NS = 'flex.data.messages' 120 121 for x in (DataMessage, SequencedMessage, PagedMessage, DataErrorMessage): 122 pyamf.register_class(x, '%s.%s' % (MESSAGES_NS, x.__name__), metadata=['amf3']) 123 del x 124