flex.messaging.services
Class ServiceAdapter

java.lang.Object
  extended by flex.management.ManageableComponent
      extended by flex.messaging.services.ServiceAdapter
All Implemented Interfaces:
Manageable, FlexComponent, FlexConfigurable
Direct Known Subclasses:
HTTPProxyAdapter, JavaAdapter, JavaAdapter, JMSAdapter, MessagingAdapter

public abstract class ServiceAdapter
extends ManageableComponent

The ServiceAdapter class is the base definition of a service adapter.


Field Summary
static String LOG_CATEGORY
          Log category for ServiceAdapter.
 
Constructor Summary
ServiceAdapter()
          Constructs an unmanaged ServiceAdapter instance.
ServiceAdapter(boolean enableManagement)
          Constructs a ServiceAdapter instance.
 
Method Summary
 Object getAdapterState()
          Return an object, usually a Collection, representing any shared state for the adapter.
 Destination getDestination()
          Returns the Destination of the ServiceAdapter.
 boolean handlesSubscriptions()
          Returns true if the adapter performs custom subscription management.
abstract  Object invoke(Message message)
          Handle a data message intended for this adapter.
 Object manage(CommandMessage commandMessage)
          Accept a command from the adapter's service and perform some internal action based upon it.
 void setAdapterState(Object adapterState)
          Set an object, usually a Collection, to represent shared state for the adapter.
 void setDestination(Destination destination)
          Sets the Destination of the ServiceAdapter.
 void start()
          Starts the adapter if its associated Destination is started and if the adapter is not already running.
 void stop()
          Stops the ServiceAdapter.
 
Methods inherited from class flex.management.ManageableComponent
getControl, getId, getParent, initialize, isManaged, isStarted, isValid, setControl, setId, setManaged, setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_CATEGORY

public static final String LOG_CATEGORY
Log category for ServiceAdapter.

See Also:
Constant Field Values
Constructor Detail

ServiceAdapter

public ServiceAdapter()
Constructs an unmanaged ServiceAdapter instance.


ServiceAdapter

public ServiceAdapter(boolean enableManagement)
Constructs a ServiceAdapter instance.

Parameters:
enableManagement - true if the ServiceAdapter has a corresponding MBean control for management; otherwise false.
Method Detail

start

public void start()
Starts the adapter if its associated Destination is started and if the adapter is not already running. If subclasses override, they must call super.start().

Specified by:
start in interface FlexComponent
Overrides:
start in class ManageableComponent

stop

public void stop()
Stops the ServiceAdapter. If subclasses override, they must call super.start().

Specified by:
stop in interface FlexComponent
Overrides:
stop in class ManageableComponent

getDestination

public Destination getDestination()
Returns the Destination of the ServiceAdapter.

Returns:
The Destination of the ServiceAdapter.

setDestination

public void setDestination(Destination destination)
Sets the Destination of the ServiceAdapter. Also sets the ServiceAdapter of the Destination if needed.

Parameters:
destination -

invoke

public abstract Object invoke(Message message)
Handle a data message intended for this adapter. This method is responsible for handling the message and returning a result (if any). The return value of this message is used as the body of the acknowledge message returned to the client. It may be null if there is no data being returned for this message.

Typically the data content for the message is stored in the body property of the message. The headers of the message are used to store fields which relate to the transport of the message. The type of operation is stored as the operation property of the message.

Parameters:
message - the message as sent by the client intended for this adapter
Returns:
the body of the acknowledge message (or null if there is no body)
See Also:
Message, AsyncMessage

manage

public Object manage(CommandMessage commandMessage)
Accept a command from the adapter's service and perform some internal action based upon it. CommandMessages are used for messages which control the state of the connection between the client and the server. For example, this handles subscribe, unsubscribe, and ping operations. The messageRefType property of the CommandMessage is used to associate a command message with a particular service. Services are configured to handle messages of a particular concrete type. For example, the MessageService is typically invoked to handle messages of type flex.messaging.messages.AsyncMessage. To ensure a given CommandMessage is routed to the right service, its MessageRefType is set to the string name of the message type for messages handled by that service.

See Also:
CommandMessage, AsyncMessage

getAdapterState

public Object getAdapterState()
Return an object, usually a Collection, representing any shared state for the adapter. If adapters have shared state, they should override this method, as the default implementation throws an UnsupportedOperationException.


setAdapterState

public void setAdapterState(Object adapterState)
Set an object, usually a Collection, to represent shared state for the adapter. If adapters have shared state, they should override this method, as the default implementation throws an UnsupportedOperationException.


handlesSubscriptions

public boolean handlesSubscriptions()
Returns true if the adapter performs custom subscription management. The default return value is false, and subclasses should override this method as necessary.



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/messaging/services/ServiceAdapter.html