1 17 18 package org.apache.geronimo.tomcat.deployment; 19 20 import javax.enterprise.deploy.model.DDBean ; 21 import javax.enterprise.deploy.spi.DConfigBean ; 22 import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException ; 23 import javax.enterprise.deploy.spi.exceptions.ConfigurationException ; 24 25 import org.apache.geronimo.deployment.plugin.DConfigBeanSupport; 26 import org.apache.geronimo.naming.deployment.ENCHelper; 27 import org.apache.geronimo.xbeans.geronimo.tomcat.TomcatWebAppType; 28 import org.apache.xmlbeans.SchemaTypeLoader; 29 30 33 public class WebAppDConfigBean extends DConfigBeanSupport { 34 private final ENCHelper encHelper; 35 36 WebAppDConfigBean(DDBean ddBean, TomcatWebAppType webApp) { 37 super(ddBean, webApp); 38 39 ENCHelper.XmlEnvRefs envRefs = new ENCHelper.XmlEnvRefs(webApp.getEjbRefArray(), webApp.getEjbLocalRefArray(), webApp.getResourceRefArray(), webApp.getResourceEnvRefArray()); 40 41 String version = ddBean.getRoot().getAttributeValue("version"); 43 if ("2.4".equals(version)) { 44 encHelper = new ENCHelper(ddBean, envRefs, getXPathsForJ2ee_1_4(ENCHelper.ENC_XPATHS), getXPathsForJ2ee_1_4(ENCHelper.NAME_XPATHS)); 45 } else { 46 encHelper = new ENCHelper(ddBean, envRefs, getXPathsWithPrefix(null, ENCHelper.ENC_XPATHS), getXPathsWithPrefix(null, ENCHelper.NAME_XPATHS)); 47 } 48 49 } 50 51 TomcatWebAppType getWebApp() { 52 return (TomcatWebAppType) getXmlObject(); 53 } 54 55 public String getContextRoot() { 56 return getWebApp().getContextRoot(); 57 } 58 59 public void setContextRoot(String contextRoot) { 60 pcs.firePropertyChange("contextRoot", getContextRoot(), contextRoot); 61 getWebApp().setContextRoot(contextRoot); 62 } 63 64 70 public boolean getContextPriorityClassLoader() { 71 return getWebApp().getContextPriorityClassloader(); 72 } 73 74 80 public void setContextPriorityClassLoader(boolean contextPriority) { 81 pcs.firePropertyChange("contextPriorityClassLoader", getContextPriorityClassLoader(), contextPriority); 82 getWebApp().setContextPriorityClassloader(contextPriority); 83 } 84 85 public DConfigBean getDConfigBean(DDBean ddBean) throws ConfigurationException { 86 return encHelper.getDConfigBean(ddBean); 87 } 88 89 public void removeDConfigBean(DConfigBean dcBean) throws BeanNotFoundException { 90 encHelper.removeDConfigBean(dcBean); 91 } 92 93 public String [] getXpaths() { 94 return getXPathsForJ2ee_1_4(ENCHelper.ENC_XPATHS); 95 } 96 97 protected SchemaTypeLoader getSchemaTypeLoader() { 98 return WebAppDConfigRoot.SCHEMA_TYPE_LOADER; 99 } 100 101 } 102 | Popular Tags |