org.springframework.flex.remoting
Class RemotingDestinationExporter

java.lang.Object
  extended by org.springframework.flex.core.AbstractDestinationFactory
      extended by org.springframework.flex.remoting.RemotingDestinationExporter
All Implemented Interfaces:
flex.messaging.FlexConfigurable, flex.messaging.FlexFactory, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public class RemotingDestinationExporter
extends AbstractDestinationFactory
implements flex.messaging.FlexFactory

An factory for exposing a Spring-managed bean to a Flex client for direct remoting calls.

The exported service will be exposed to the Flex client as a BlazeDS remoting service destination. By default, the destination id will be the same as the bean name of this factory. This may be overridden using the serviceId property. Note that this convention is slightly different from that employed by the remote-service xml config tag. See the xsd docs for details.

The methods on the exported service that are exposed to the Flex client can be controlled using the includeMethods and excludeMethods properties.

Author:
Jeremy Grelle, Mark Fisher
See Also:
MessageBrokerFactoryBean

Field Summary
 
Fields inherited from interface flex.messaging.FlexFactory
SCOPE, SCOPE_APPLICATION, SCOPE_REQUEST, SCOPE_SESSION, SOURCE
 
Constructor Summary
RemotingDestinationExporter()
           
 
Method Summary
protected  flex.messaging.Destination createDestination(java.lang.String destinationId, flex.messaging.MessageBroker broker)
          Create a specific destination and add it to the MessageBroker
 flex.messaging.FactoryInstance createFactoryInstance(java.lang.String id, flex.messaging.config.ConfigMap properties)
          
protected  void destroyDestination(java.lang.String destinationId, flex.messaging.MessageBroker broker)
          Stops and removes the specified destination from the MessageBroker
protected  flex.messaging.services.Service getTargetService(flex.messaging.MessageBroker broker)
          Returns the target Service that will manage the destination
 void initialize(java.lang.String id, flex.messaging.config.ConfigMap configMap)
           
protected  void initializeDestination(flex.messaging.Destination destination)
          Perform any necessary initialization logic on the created Destination
 java.lang.Object lookup(flex.messaging.FactoryInstance instanceInfo)
          Lookup will be handled directly by the created FactoryInstance
 void setExcludeMethods(java.lang.String[] excludeMethods)
          Sets the methods to be excluded from the bean being exported
 void setIncludeMethods(java.lang.String[] includeMethods)
          Sets the methods to included from the bean being exported
 void setService(java.lang.Object service)
          Sets the bean being exported.
 
Methods inherited from class org.springframework.flex.core.AbstractDestinationFactory
afterPropertiesSet, configureAdapter, destroy, getBeanFactory, getDestinationId, setBeanFactory, setBeanName, setChannels, setDestinationId, setMessageBroker, setServiceAdapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotingDestinationExporter

public RemotingDestinationExporter()
Method Detail

createFactoryInstance

public flex.messaging.FactoryInstance createFactoryInstance(java.lang.String id,
                                                            flex.messaging.config.ConfigMap properties)

Specified by:
createFactoryInstance in interface flex.messaging.FlexFactory

initialize

public void initialize(java.lang.String id,
                       flex.messaging.config.ConfigMap configMap)
Specified by:
initialize in interface flex.messaging.FlexConfigurable

lookup

public java.lang.Object lookup(flex.messaging.FactoryInstance instanceInfo)
Lookup will be handled directly by the created FactoryInstance

Specified by:
lookup in interface flex.messaging.FlexFactory

setExcludeMethods

public void setExcludeMethods(java.lang.String[] excludeMethods)
Sets the methods to be excluded from the bean being exported

Parameters:
excludeMethods - the methods to exclude

setIncludeMethods

public void setIncludeMethods(java.lang.String[] includeMethods)
Sets the methods to included from the bean being exported

Parameters:
includeMethods - the methods to include

setService

public void setService(java.lang.Object service)
Sets the bean being exported. Supports setting either a direct bean instance reference, or the String identifier of the bean, to be looked up from the BeanFactory. The latter is preferred, as it allows more accurate calculation of the "source" property of the destination, required for tooling introspection of the destination.

Parameters:
service - the bean being exported

createDestination

protected flex.messaging.Destination createDestination(java.lang.String destinationId,
                                                       flex.messaging.MessageBroker broker)
Create a specific destination and add it to the MessageBroker

Specified by:
createDestination in class AbstractDestinationFactory
Parameters:
destinationId - the id of the destination to create
broker - the MessageBroker where the destination should be created
Returns:
the created destination

destroyDestination

protected void destroyDestination(java.lang.String destinationId,
                                  flex.messaging.MessageBroker broker)
Stops and removes the specified destination from the MessageBroker

Specified by:
destroyDestination in class AbstractDestinationFactory
Parameters:
destinationId - the id of the destination being destroyed
broker - the MessageBroker from which the destination must be removed

getTargetService

protected flex.messaging.services.Service getTargetService(flex.messaging.MessageBroker broker)
Returns the target Service that will manage the destination

Specified by:
getTargetService in class AbstractDestinationFactory
Parameters:
broker - the MessageBroker that controls the service
Returns:
the service

initializeDestination

protected void initializeDestination(flex.messaging.Destination destination)
Perform any necessary initialization logic on the created Destination

Specified by:
initializeDestination in class AbstractDestinationFactory
Parameters:
destination - the created destination