Package net.sf.gilead.gwt

Source Code of net.sf.gilead.gwt.GwtConfigurationHelper

/**
*
*/
package net.sf.gilead.gwt;

import net.sf.gilead.core.IPersistenceUtil;
import net.sf.gilead.core.PersistentBeanManager;
import net.sf.gilead.core.beanlib.mapper.ProxyClassMapper;
import net.sf.gilead.core.serialization.GwtProxySerialization;
import net.sf.gilead.core.store.stateless.StatelessProxyStore;

/**
* @author bruno.marchesson
*
*/
public class GwtConfigurationHelper
{
  /**
   * Init bean manager for stateless mode for GWT
   */
  public static PersistentBeanManager initGwtStatelessBeanManager(IPersistenceUtil persistenceUtil)
  {
    if (PersistentBeanManager.getInstance().getPersistenceUtil() == null)
    {
      PersistentBeanManager beanManager = PersistentBeanManager.getInstance();
      beanManager.setPersistenceUtil(persistenceUtil);
     
      StatelessProxyStore proxyStore = new StatelessProxyStore();
      proxyStore.setProxySerializer(new GwtProxySerialization());
      beanManager.setProxyStore(proxyStore);
     
      beanManager.setClassMapper(null);
    }
   
    return PersistentBeanManager.getInstance();
  }
 
  public static PersistentBeanManager initGwtProxyBeanManager(IPersistenceUtil persistenceUtil)
  {
    if (PersistentBeanManager.getInstance().getPersistenceUtil() == null)
    {
      PersistentBeanManager beanManager = PersistentBeanManager.getInstance();
      beanManager.setPersistenceUtil(persistenceUtil);
     
      StatelessProxyStore proxyStore = new StatelessProxyStore();
      proxyStore.setProxySerializer(new GwtProxySerialization());
      beanManager.setProxyStore(proxyStore);
     
      ProxyClassMapper classMapper = new ProxyClassMapper();
      classMapper.setPersistenceUtil(persistenceUtil);
      beanManager.setClassMapper(classMapper);
    }
   
    return PersistentBeanManager.getInstance();
  }
}
TOP

Related Classes of net.sf.gilead.gwt.GwtConfigurationHelper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.