Spring BlazeDS Integration

org.springframework.flex.core.io
Class HibernateConfigProcessor

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

public class HibernateConfigProcessor
extends AbstractAmfConversionServiceConfigProcessor
implements BeanFactoryAware, InitializingBean

MessageBrokerConfigProcessor implementation that uses the Hibernate Metadata API to determine all classes that potentially need special AMF conversion rules applied to them to prevent lazy initialization errors. Each type found will have a properly configured instance of SpringPropertyProxy registered for it with the BlazeDS PropertyProxyRegistry.

Author:
Jeremy Grelle

Field Summary
protected  boolean hibernateConfigured
           
 
Fields inherited from class org.springframework.flex.core.io.AbstractAmfConversionServiceConfigProcessor
log
 
Constructor Summary
HibernateConfigProcessor()
           
 
Method Summary
 void afterPropertiesSet()
          
protected  void configureConverters(ConverterRegistry registry)
          Template method to allow subclasses to configure their own set of Converter instances.
protected  void extractHibernateMetadata(org.hibernate.SessionFactory sessionFactory)
          Extracts all ClassMetadata and CollectionMetadata from a given SessionFactory to be used in determining the types that need a SpringPropertyProxy registered in findTypesToRegister()
protected  Set<Class<?>> findTypesToRegister()
          Returns the set of types for which SpringPropertyProxy instances should be registered.
protected  ListableBeanFactory getBeanFactory()
          Provides access to the BeanFactory by subclasses.
 void setBeanFactory(BeanFactory beanFactory)
          
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Sets the Hibernate SessionFactory to be used for reading type metadata.
 
Methods inherited from class org.springframework.flex.core.io.AbstractAmfConversionServiceConfigProcessor
processAfterStartup, processBeforeStartup, registerAmfProxies, registerPropertyProxy, setConversionService, setUseDirectFieldAccess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hibernateConfigured

protected boolean hibernateConfigured
Constructor Detail

HibernateConfigProcessor

public HibernateConfigProcessor()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception

Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class AbstractAmfConversionServiceConfigProcessor
Throws:
Exception

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
                    throws BeansException

Specified by:
setBeanFactory in interface BeanFactoryAware
Throws:
BeansException

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Sets the Hibernate SessionFactory to be used for reading type metadata. If this property is not explicitly set, all available SessionFactory instances will be retrieved from the containing BeanFactory and have their type metadata extracted for use in findTypesToRegister()

Parameters:
sessionFactory - the session factory from which to read metadata

findTypesToRegister

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

Specified by:
findTypesToRegister in class AbstractAmfConversionServiceConfigProcessor
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.

Overrides:
configureConverters in class AbstractAmfConversionServiceConfigProcessor
Parameters:
registry - - the converter registry used by the ConversionService

getBeanFactory

protected ListableBeanFactory getBeanFactory()
Provides access to the BeanFactory by subclasses.

Returns:
the containing bean factory

extractHibernateMetadata

protected void extractHibernateMetadata(org.hibernate.SessionFactory sessionFactory)
Extracts all ClassMetadata and CollectionMetadata from a given SessionFactory to be used in determining the types that need a SpringPropertyProxy registered in findTypesToRegister()

Parameters:
sessionFactory - the session factory from which to read metadata

Spring BlazeDS Integration

Copyright © 2011. All Rights Reserved.