Package pyamf :: Package flex :: Module data

[hide private]
[frames] | no frames]

# Source Code for Module pyamf.flex.data

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