flex.data
Class DataService

java.lang.Object
  extended by flex.management.ManageableComponent
      extended by flex.messaging.services.AbstractService
          extended by flex.messaging.services.MessageService
              extended by flex.data.DataService
All Implemented Interfaces:
Manageable, FlexComponent, FlexConfigurable, flex.messaging.services.messaging.MessagingConstants, Service

public class DataService
extends MessageService

This is the service which receives DataMessages and handles data synchronization functionality. It essentially adds DataMessage processing capabilities to the MessageService, so therefore it is a subclass of MessageService.


Field Summary
static String LOG_CATEGORY
          Log category for DataService.
 
Fields inherited from class flex.messaging.services.MessageService
TIMING_LOG_CATEGORY
 
Fields inherited from class flex.messaging.services.AbstractService
LOG_CATEGORY_STARTUP_DESTINATION
 
Fields inherited from interface flex.messaging.services.messaging.MessagingConstants
ALLOW_SUBTOPICS_ELEMENT, BATCH_WRITE_SIZE_ELEMENT, CLUSTER_MESSAGE_ROUTING, DEFAULT_DURABLE_STORE, DEFAULT_MAX_CACHE_SIZE, DEFAULT_SUBTOPIC_SEPARATOR, DURABLE_STORE_TYPE_ELEMENT, IS_DURABLE_ELEMENT, MAX_CACHE_SIZE_ELEMENT, SUBTOPIC_SEPARATOR_ELEMENT, TIME_TO_LIVE_ELEMENT
 
Constructor Summary
DataService()
          Constructs an unmanaged DataService.
DataService(boolean enableManagement)
          Constructs a DataService with the indicated management.
 
Method Summary
 void addDestination(Destination destination)
          Casts the Destination into DataDestination and calls super.addDestination
 Destination createDestination(String id)
          Creates a DataDestination instance, sets its id, sets it manageable if the DataService that created it is manageable, and sets its Service to the AbstractService that created it.
 ConfigMap describeService(Endpoint endpoint)
          Returns a ConfigMap of service properties that the client needs.
static flex.data.messages.DataMessage findCurrentCreateDataMessage(String messageId)
           
static Collection getPropertiesOnClientObject(Object clientObj)
          Again, this belongs somewhere else and could be more efficient.
static Object getPropertyOnClientObject(Object clientObj, String propertyName)
           
static Object[] getUpdateBody(flex.data.messages.DataMessage toUpdate)
           
static Object getUpdateBody(flex.data.messages.DataMessage toUpdate, int which)
           
static List getUpdateChanges(flex.data.messages.DataMessage update)
           
 boolean getUseClusterBroadcast()
           
 void initialize(String id, ConfigMap properties)
          Initializes the DataService with id and properties.
 void peerSyncAndPush(List messages)
          This method is provided for a cluster peer broadcast, it is not invoked locally.
 void peerSyncAndPushOneToPeer(Message message, Object remoteAddress)
          Called from an external server when we are pushing messages individually using the manual message routing.
 void receiveAdapterState(String destinationId, Object adapterState, Object senderAddress)
          This method is provided for a cluster peer broadcast, it is not invoked locally.
 void requestAdapterState(String destinationId, Object requestingAddress)
          This method is provided for a cluster peer broadcast, it is not invoked locally.
 void sendPeerSyncAndPush(List messages)
          This method enables the service to invoke fellow service operations on other cluster nodes.
 Object serviceCommand(CommandMessage message)
          Handles a command routed to the service by the MessageBroker.
 Object serviceMessage(Message message)
          Processes messages of type DataMessage by invoking the requested destination's adapter.
static void setPropertyOnClientObject(Object clientObj, String propertyName, Object value)
           
static void setUpdateBody(flex.data.messages.DataMessage msg, int which, Object item)
           
 void setUseClusterBroadcast(boolean ucb)
          This controls whether destinations that are a part of this service broadcast their messages across the cluster.
 
Methods inherited from class flex.messaging.services.MessageService
getSubscriberIds, initRemoteSubscriptions, pushMessageToClients, pushMessageToClients, sendPushMessageFromPeer, serviceMessageFromAdapter, start, subscribeFromPeer
 
Methods inherited from class flex.messaging.services.AbstractService
addDefaultChannel, getDefaultAdapter, getDefaultChannels, getDestination, getDestination, getDestinations, getMessageBroker, getRegisteredAdapters, registerAdapter, removeDefaultChannel, removeDestination, setDefaultAdapter, setDefaultChannels, setId, setMessageBroker, stop, unregisterAdapter
 
Methods inherited from class flex.management.ManageableComponent
getControl, getId, getParent, isManaged, isStarted, isValid, setControl, setManaged, setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface flex.messaging.services.Service
getId
 
Methods inherited from interface flex.management.Manageable
getControl, isManaged, setControl, setManaged
 
Methods inherited from interface flex.messaging.FlexComponent
isStarted
 

Field Detail

LOG_CATEGORY

public static final String LOG_CATEGORY
Log category for DataService.

See Also:
Constant Field Values
Constructor Detail

DataService

public DataService()
Constructs an unmanaged DataService.


DataService

public DataService(boolean enableManagement)
Constructs a DataService with the indicated management.

Parameters:
enableManagement - true if the DataService is manageable; otherwise false.
Method Detail

initialize

public void initialize(String id,
                       ConfigMap properties)
Initializes the DataService with id and properties.

Specified by:
initialize in interface FlexConfigurable
Overrides:
initialize in class ManageableComponent
Parameters:
id - Id of the ManageableComponent.
properties - Properties for the AbstractService.

createDestination

public Destination createDestination(String id)
Creates a DataDestination instance, sets its id, sets it manageable if the DataService that created it is manageable, and sets its Service to the AbstractService that created it.

Specified by:
createDestination in interface Service
Overrides:
createDestination in class MessageService
Parameters:
id - The id of the DataDestination.
Returns:
The Destination instanced created.

addDestination

public void addDestination(Destination destination)
Casts the Destination into DataDestination and calls super.addDestination

Specified by:
addDestination in interface Service
Overrides:
addDestination in class MessageService
Parameters:
destination - The Destination instance to be added.

setUseClusterBroadcast

public void setUseClusterBroadcast(boolean ucb)
This controls whether destinations that are a part of this service broadcast their messages across the cluster. If you are going to use any destinations which autoSyncEnabled, that requires broadcasting messages across the cluster. If you only use manualSync, you can disable use-cluster-broadcast. When this is turned off, the underlying messaging system is used to route messages across the cluster to get more scalable performance.


getUseClusterBroadcast

public boolean getUseClusterBroadcast()

describeService

public ConfigMap describeService(Endpoint endpoint)
Returns a ConfigMap of service properties that the client needs. This includes service's id under "id" key and additional DataService destination properties under "destination" key.

Specified by:
describeService in interface Service
Overrides:
describeService in class AbstractService
Parameters:
endpoint - Endpoint used to filter the destinations of the service.
Returns:
ConfigMap of service properties.

sendPeerSyncAndPush

public void sendPeerSyncAndPush(List messages)
This method enables the service to invoke fellow service operations on other cluster nodes. For the global cluster mode, we are sending over the entire list of messages that need to be pushed for a single transaction. This makes the syncAndPush operation more efficient and more accurate in the case where we have a create or update followed by a delete in the batch. We need to keep around the old sequence until after we have determined which clients need to be sent that delete. If we update the sequence after each message, we'll get a new sequence which does not include the item that was removed. When we process the remove event, we will not send it to clients which are subscribed to that sequence.

When this mode is disabled, we push messages individually across the cluster. In this mode, the destination's cluster-message-routing is used to determine whether to use broadcast or server-to-server modes.


peerSyncAndPushOneToPeer

public void peerSyncAndPushOneToPeer(Message message,
                                     Object remoteAddress)
Called from an external server when we are pushing messages individually using the manual message routing.


peerSyncAndPush

public void peerSyncAndPush(List messages)
This method is provided for a cluster peer broadcast, it is not invoked locally. We first go through and (if necessary) send batches to the adapter. We do process manage association messages, then commit them. At that point, we apply any sequence changes made to association messages, and re-fill any fills which need to be updated and push processed messages to clients as necessary.


requestAdapterState

public void requestAdapterState(String destinationId,
                                Object requestingAddress)
This method is provided for a cluster peer broadcast, it is not invoked locally.


receiveAdapterState

public void receiveAdapterState(String destinationId,
                                Object adapterState,
                                Object senderAddress)
This method is provided for a cluster peer broadcast, it is not invoked locally.


serviceCommand

public Object serviceCommand(CommandMessage message)
Description copied from interface: Service
Handles a command routed to the service by the MessageBroker. Usually these are commands sent by one of the endpoints.

Specified by:
serviceCommand in interface Service
Overrides:
serviceCommand in class MessageService
Parameters:
message - The message sent by the MessageBroker

serviceMessage

public Object serviceMessage(Message message)
Processes messages of type DataMessage by invoking the requested destination's adapter.

Specified by:
serviceMessage in interface Service
Overrides:
serviceMessage in class MessageService
Parameters:
message - The message sent by the MessageBroker

getUpdateBody

public static Object getUpdateBody(flex.data.messages.DataMessage toUpdate,
                                   int which)

getUpdateBody

public static Object[] getUpdateBody(flex.data.messages.DataMessage toUpdate)

getUpdateChanges

public static List getUpdateChanges(flex.data.messages.DataMessage update)

setUpdateBody

public static void setUpdateBody(flex.data.messages.DataMessage msg,
                                 int which,
                                 Object item)

findCurrentCreateDataMessage

public static flex.data.messages.DataMessage findCurrentCreateDataMessage(String messageId)

getPropertyOnClientObject

public static Object getPropertyOnClientObject(Object clientObj,
                                               String propertyName)

setPropertyOnClientObject

public static void setPropertyOnClientObject(Object clientObj,
                                             String propertyName,
                                             Object value)

getPropertiesOnClientObject

public static Collection getPropertiesOnClientObject(Object clientObj)
Again, this belongs somewhere else and could be more efficient.



Copyright © 2007 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcdsjavadoc/flex/data/DataService.html