org.granite.hibernate4
Class HibernateExternalizer

java.lang.Object
  extended by org.granite.messaging.amf.io.util.externalizer.DefaultExternalizer
      extended by org.granite.hibernate4.HibernateExternalizer
All Implemented Interfaces:
Externalizer

public class HibernateExternalizer
extends DefaultExternalizer

Author:
Franck WOLFF

Field Summary
 
Fields inherited from class org.granite.messaging.amf.io.util.externalizer.DefaultExternalizer
BYTES_0, constructors, dynamicClass, orderedFields, orderedSetterFields
 
Constructor Summary
HibernateExternalizer()
           
 
Method Summary
 int accept(Class<?> clazz)
           
 void configure(XMap properties)
          Configure this externalizer with the values supplied in granite-config.xml.
protected  Serializable deserializeSerializable(byte[] data)
           
protected  String getProxyDetachedState(HibernateProxy proxy)
           
protected  boolean isEmbeddable(Class<?> clazz)
           
protected  boolean isRegularEntity(Class<?> clazz)
           
protected  AbstractExternalizablePersistentCollection newExternalizableCollection(org.hibernate.collection.spi.PersistentCollection value)
           
protected  org.hibernate.collection.spi.PersistentCollection newHibernateCollection(AbstractExternalizablePersistentCollection value, Property field)
           
 Object newInstance(String type, ObjectInput in)
           
protected  Object newProxyInstantiator(ConcurrentHashMap<String,ProxyFactory> proxyFactories, String detachedState)
           
 void readExternal(Object o, ObjectInput in)
           
protected  byte[] serializeSerializable(Serializable o)
           
 void writeExternal(Object o, ObjectOutput out)
           
 
Methods inherited from class org.granite.messaging.amf.io.util.externalizer.DefaultExternalizer
findDefaultConstructor, findOrderedFields, findOrderedFields, isPropertyIgnored, isPropertyIgnored, isValueIgnored
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateExternalizer

public HibernateExternalizer()
Method Detail

configure

public void configure(XMap properties)
Configure this externalizer with the values supplied in granite-config.xml.

The only supported configuration option is 'hibernate-collection-metadata' with values in ['no' (default), 'yes' and 'lazy']. By default, collection metadata (key, role and snapshot) aren't serialized. If the value of the 'hibernate-collection-metadata' node is 'yes', metadata will be always serialized, while the 'lazy' value tells the externalizer to serialiaze metadata for uninitialized collections only.

Configuration example (granite-config.xml):

 <granite-config scan="true">
   <externalizers>
     <configuration>
       <hibernate-collection-metadata>lazy</hibernate-collection-metadata>
     </configuration>
   </externalizers>
 </granite-config>
 

Specified by:
configure in interface Externalizer
Overrides:
configure in class DefaultExternalizer
Parameters:
properties - an XMap instance that contains the configuration node.

newInstance

public Object newInstance(String type,
                          ObjectInput in)
                   throws IOException,
                          ClassNotFoundException,
                          InstantiationException,
                          InvocationTargetException,
                          IllegalAccessException
Specified by:
newInstance in interface Externalizer
Overrides:
newInstance in class DefaultExternalizer
Throws:
IOException
ClassNotFoundException
InstantiationException
InvocationTargetException
IllegalAccessException

newProxyInstantiator

protected Object newProxyInstantiator(ConcurrentHashMap<String,ProxyFactory> proxyFactories,
                                      String detachedState)

readExternal

public void readExternal(Object o,
                         ObjectInput in)
                  throws IOException,
                         ClassNotFoundException,
                         IllegalAccessException
Specified by:
readExternal in interface Externalizer
Overrides:
readExternal in class DefaultExternalizer
Throws:
IOException
ClassNotFoundException
IllegalAccessException

newHibernateCollection

protected org.hibernate.collection.spi.PersistentCollection newHibernateCollection(AbstractExternalizablePersistentCollection value,
                                                                                   Property field)

writeExternal

public void writeExternal(Object o,
                          ObjectOutput out)
                   throws IOException,
                          IllegalAccessException
Specified by:
writeExternal in interface Externalizer
Overrides:
writeExternal in class DefaultExternalizer
Throws:
IOException
IllegalAccessException

newExternalizableCollection

protected AbstractExternalizablePersistentCollection newExternalizableCollection(org.hibernate.collection.spi.PersistentCollection value)

accept

public int accept(Class<?> clazz)
Specified by:
accept in interface Externalizer
Overrides:
accept in class DefaultExternalizer

getProxyDetachedState

protected String getProxyDetachedState(HibernateProxy proxy)

isRegularEntity

protected boolean isRegularEntity(Class<?> clazz)

isEmbeddable

protected boolean isEmbeddable(Class<?> clazz)

serializeSerializable

protected byte[] serializeSerializable(Serializable o)

deserializeSerializable

protected Serializable deserializeSerializable(byte[] data)