Spring BlazeDS Integration

org.springframework.flex.core.io
Class AbstractAmfConversionServiceConfigProcessor

java.lang.Object
  extended by org.springframework.flex.core.io.AbstractAmfConversionServiceConfigProcessor
All Implemented Interfaces:
InitializingBean, MessageBrokerConfigProcessor
Direct Known Subclasses:
ClassPathScanningAmfConversionServiceConfigProcessor, HibernateConfigProcessor

public abstract class AbstractAmfConversionServiceConfigProcessor
extends Object
implements MessageBrokerConfigProcessor, InitializingBean

Base MessageBrokerConfigProcessor implementation that installs an alternative PropertyProxy implementation for enhanced serialization and deserialization of specific types. The alternative implementation uses Sping's ConversionService to allow specialized conversion of certain property types and is more flexible in the types it can handle.

The installed SpringPropertyProxy instances may be configured to use field-based property access (instead of requiring getters and setters) by setting the useDirectFieldAccess property to true. Additionally, types that do not have a default no-arg constructur can be handled, as long as they provide a constructor annotated with AmfCreator.

Subclasses are expected to supply their own mechanisms for determining the list of types to register and may apply additional configuration of the ConversionService, such as provisioning additional custom Converters.

Author:
Jeremy Grelle
See Also:
SpringPropertyProxy

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
AbstractAmfConversionServiceConfigProcessor()
           
 
Method Summary
 void afterPropertiesSet()
          
protected  void configureConverters(ConverterRegistry registry)
          Template method to allow subclasses to configure their own set of Converter instances.
protected abstract  Set<Class<?>> findTypesToRegister()
          Returns the set of types for which SpringPropertyProxy instances should be registered.
 MessageBroker processAfterStartup(MessageBroker broker)
          Apply this config processor to the newly created MessageBroker after it and all of its services have been started but before it is available for use.
 MessageBroker processBeforeStartup(MessageBroker broker)
          Apply this config processor to the newly created MessageBroker after its intial configuration settings have been parsed from the BlazeDS XML configuration, but before it has actually been started.
protected  void registerAmfProxies(ConversionService conversionService, boolean useDirectFieldAccess)
          Called during initialization, the default implementation configures and registers a SpringPropertyProxy instance for each type returned by findTypesToRegister.
protected  void registerPropertyProxy(SpringPropertyProxy proxy)
          Registers the given SpringPropertyProxy with the BlazeDS PropertyProxyRegistry.
 void setConversionService(ConversionService conversionService)
          Sets the ConversionService implementation to be used by all registered SpringPropertyProxy instances.
 void setUseDirectFieldAccess(boolean useDirectFieldAccess)
          When true, configures the registered SpringPropertyProxy instances to access fields directly, rather than requiring strict JavaBean compliance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

AbstractAmfConversionServiceConfigProcessor

public AbstractAmfConversionServiceConfigProcessor()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

processAfterStartup

public final MessageBroker processAfterStartup(MessageBroker broker)
Apply this config processor to the newly created MessageBroker after it and all of its services have been started but before it is available for use.

Specified by:
processAfterStartup in interface MessageBrokerConfigProcessor
Parameters:
broker - the started MessageBroker instance
Returns:
the modified MessageBroker

processBeforeStartup

public final MessageBroker processBeforeStartup(MessageBroker broker)
Apply this config processor to the newly created MessageBroker after its intial configuration settings have been parsed from the BlazeDS XML configuration, but before it has actually been started.

Specified by:
processBeforeStartup in interface MessageBrokerConfigProcessor
Parameters:
broker - the new MessageBroker instance
Returns:
the modified MessageBroker

setConversionService

public void setConversionService(ConversionService conversionService)
Sets the ConversionService implementation to be used by all registered SpringPropertyProxy instances.

Parameters:
conversionService - the conversion service to be used

setUseDirectFieldAccess

public void setUseDirectFieldAccess(boolean useDirectFieldAccess)
When true, configures the registered SpringPropertyProxy instances to access fields directly, rather than requiring strict JavaBean compliance. Defaults to false.

Parameters:
useDirectFieldAccess - determines whether fields should be accessed directly.

registerAmfProxies

protected void registerAmfProxies(ConversionService conversionService,
                                  boolean useDirectFieldAccess)
Called during initialization, the default implementation configures and registers a SpringPropertyProxy instance for each type returned by findTypesToRegister.

Parameters:
conversionService - the conversion service to be used for property conversion
useDirectFieldAccess - determines whether fields should be accessed directly

registerPropertyProxy

protected void registerPropertyProxy(SpringPropertyProxy proxy)
Registers the given SpringPropertyProxy with the BlazeDS PropertyProxyRegistry.

Parameters:
proxy - the property proxy to register

findTypesToRegister

protected abstract Set<Class<?>> findTypesToRegister()
Returns the set of types for which SpringPropertyProxy instances should be registered.

Returns:
the set of types to register

configureConverters

protected void configureConverters(ConverterRegistry registry)
Template method to allow subclasses to configure their own set of Converter instances. This is a convenient alternative to supplying a completely custom-configured ConversionService instance.

The default implementation does not register any additional Converters, thus subclasses do not need to delegate to it.

Parameters:
registry - - the converter registry used by the ConversionService

Spring BlazeDS Integration

Copyright © 2011. All Rights Reserved.