1 28 29 package com.caucho.ejb.cfg; 30 31 import com.caucho.config.ConfigException; 32 import com.caucho.util.L10N; 33 34 import javax.annotation.PostConstruct; 35 36 40 public class EjbEntityConfigProxy extends EjbBeanConfigProxy { 41 private static final L10N L = new L10N(EjbBeanConfigProxy.class); 42 43 private EjbEntityBean _entity; 44 45 48 public EjbEntityConfigProxy(EjbConfig config, String ejbModuleName) 49 { 50 super(config, ejbModuleName); 51 } 52 53 56 @PostConstruct 57 public void init() 58 throws Throwable 59 { 60 EjbBean oldBean = getConfig().getBeanConfig(getEJBName()); 61 62 if (oldBean == null) { 63 _entity = new EjbEntityBean(getConfig(), getEJBModuleName()); 64 _entity.setEJBName(getEJBName()); 65 _entity.setLocation(getLocation()); 66 _entity.setAllowPOJO(getConfig().isAllowPOJO()); 67 } 68 else if (! (oldBean instanceof EjbEntityBean)) { 69 throw new ConfigException(L.l("entity bean `{0}' conflicts with prior {1} bean at {2}.", 70 getEJBName(), oldBean.getEJBKind(), 71 oldBean.getLocation())); 72 } 73 else { 74 _entity = (EjbEntityBean) oldBean; 75 } 76 77 78 _entity.addDependencyList(getDependencyList()); 79 80 getBuilderProgram().configure(_entity); 81 } 82 83 86 public EjbEntityBean getEntity() 87 { 88 return _entity; 89 } 90 } 91 | Popular Tags |