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.txt 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
     24 -class DataMessage(AsyncMessage):
     25      """
     26      I am used to transport an operation that occured on a managed object
     27      or collection.
     28
     29      This class of message is transmitted between clients subscribed to a
     30      remote destination as well as between server nodes within a cluster.
     31      The payload of this message describes all of the relevant details of
     32      the operation. This information is used to replicate updates and detect
     33      conflicts.
     34
     35      @see: U{DataMessage on Livedocs (external)
     36      <http://livedocs.adobe.com/flex/201/langref/mx/data/messages/DataMessage.html>}
     37      """
     38
     39 -    def __init__(self):
     40          AsyncMessage.__init__(self)
     41          #: Provides access to the identity map which defines the
     42          #: unique identity of the item affected by this DataMessage
     43          #: (relevant for create/update/delete but not fill operations).
     44          self.identity = None
     45          #: Provides access to the operation/command of this DataMessage.
     46          #:
     47          #: Operations indicate how the remote destination should process
     48          #: this message.
     49          self.operation = None
     50
     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
     79 -class PagedMessage(SequencedMessage):
     80      """
     81      This messsage provides information about a partial sequence result.
     82
     83      @see: U{PagedMessage on Livedocs (external)
     84      <http://livedocs.adobe.com/flex/201/langref/mx/data/messages/PagedMessage.html>}
     85      """
     86
     87 -    def __init__(self):
     88          SequencedMessage.__init__(self)
     89          #: Provides access to the number of total pages in a sequence
     90          #: based on the current page size.
     91          self.pageCount = None
     92          #: Provides access to the index of the current page in a sequence.
     93          self.pageIndex = None
     94
     95
     96 -class DataErrorMessage(ErrorMessage):
     97      """
     98      Special cases of ErrorMessage will be sent when a data conflict
     99      occurs.
    100
    101      This message provides the conflict information in addition to
    102      the L{ErrorMessage<pyamf.flex.messaging.ErrorMessage>} information.
    103
    104      @see: U{DataErrorMessage on Livedocs (external)
    105      <http://livedocs.adobe.com/flex/201/langref/mx/data/messages/DataErrorMessage.html>}
    106      """
    107
    108 -    def __init__(self):
    109          ErrorMessage.__init__(self)
    110          #: The client oringinated message which caused the conflict.
    111          self.cause = None
    112          #: An array of properties that were found to be conflicting
    113          #: between the client and server objects.
    114          self.propertyNames = None
    115          #: The value that the server had for the object with the
    116          #: conflicting properties.
    117          self.serverObject = None
    118
    119  #: Namespace for C{flex.data} messages.
    120  MESSAGES_NS = 'flex.data.messages'
    121
    122  pyamf.register_package(globals(), MESSAGES_NS)
    123