flex.messaging.services.remoting.adapters
Class JavaAdapter

java.lang.Object
  extended by flex.management.ManageableComponent
      extended by flex.messaging.services.ServiceAdapter
          extended by flex.messaging.services.remoting.adapters.JavaAdapter
All Implemented Interfaces:
Manageable, FlexComponent, FlexConfigurable

public class JavaAdapter
extends ServiceAdapter

Basic adapter for invoking methods on a Java object. By default, it is stateless, in that a new object is instantiated for each request. If the destination configuration contains a stateful flag, the HTTP session is searched for an existing instance of the object, so multiple requests from the same client will be invoked on a stateful component.

Methods are cached, so requests subsequent to the initial creation/invocation will perform much better than will the initial invocation.

This class performs no internal synchronization.


Field Summary
static String[] PROTECTED_PACKAGES
           
 
Constructor Summary
JavaAdapter()
          Constructs an unmanaged JavaAdapter instance.
JavaAdapter(boolean enableManagement)
          Constructs a JavaAdapter instance.
 
Method Summary
 void addExcludeMethod(RemotingMethod value)
          Adds a method to the list of excluded methods for the adapter.
 void addIncludeMethod(RemotingMethod value)
          Adds a method to the list of included methods for the adapter.
 Iterator getExcludeMethodIterator()
          Returns an Iterator over the currently registered exclude methods.
 Iterator getIncludeMethodIterator()
          Returns an Iterator over the currently registered include methods.
 void initialize(String id, ConfigMap properties)
          Invoked to initialize the ManageableComponent.
 Object invoke(Message message)
          Handle a data message intended for this adapter.
 void removeExcludeMethod(RemotingMethod value)
          Removes a method from the list of excluded methods for the adapter.
 void removeIncludeMethod(RemotingMethod value)
          Removes a method from the list of included methods for the adapter.
 void setDestination(Destination destination)
          Casts the Destination into RemotingDestination and calls super.setDestination.
 void start()
          Starts the adapter if its associated Destination is started and if the adapter is not already running.
 
Methods inherited from class flex.messaging.services.ServiceAdapter
getAdapterState, getDestination, handlesSubscriptions, manage, setAdapterState, stop
 
Methods inherited from class flex.management.ManageableComponent
getControl, getId, getParent, 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

PROTECTED_PACKAGES

public static final String[] PROTECTED_PACKAGES
Constructor Detail

JavaAdapter

public JavaAdapter()
Constructs an unmanaged JavaAdapter instance.


JavaAdapter

public JavaAdapter(boolean enableManagement)
Constructs a JavaAdapter instance.

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

setDestination

public void setDestination(Destination destination)
Casts the Destination into RemotingDestination and calls super.setDestination.

Overrides:
setDestination in class ServiceAdapter
Parameters:
destination - remoting destination to associate with this adapter

getExcludeMethodIterator

public Iterator getExcludeMethodIterator()
Returns an Iterator over the currently registered exclude methods.

Returns:
an Iterator over the currently registered exclude methods

addExcludeMethod

public void addExcludeMethod(RemotingMethod value)
Adds a method to the list of excluded methods for the adapter. Invocations of excluded methods are blocked.

Parameters:
value - method to exclude

removeExcludeMethod

public void removeExcludeMethod(RemotingMethod value)
Removes a method from the list of excluded methods for the adapter.

Parameters:
value - method to remove from exlcuded methods list

getIncludeMethodIterator

public Iterator getIncludeMethodIterator()
Returns an Iterator over the currently registered include methods.

Returns:
an Iterator over the currently registered include methods

addIncludeMethod

public void addIncludeMethod(RemotingMethod value)
Adds a method to the list of included methods for the adapter. Invocations of included methods are allowed, and invocations of any non-included methods will be blocked.

Parameters:
value - method to include

removeIncludeMethod

public void removeIncludeMethod(RemotingMethod value)
Removes a method from the list of included methods for the adapter.

Parameters:
value - method to remove from the included methods list

initialize

public void initialize(String id,
                       ConfigMap properties)
Invoked to initialize the ManageableComponent. This base implementation calls setId() passing the provided id and ignores the properties map argument. Subclasses should call super.initialize().

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

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 ServiceAdapter

invoke

public 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.

Specified by:
invoke in class ServiceAdapter
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


Copyright © 2008 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/blazeds/1/javadoc/flex/messaging/services/remoting/adapters/JavaAdapter.html