1 17 18 package org.apache.geronimo.web.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.web.GerWebAppType; 28 import org.apache.xmlbeans.SchemaTypeLoader; 29 30 33 public class WebAppDConfigBean extends DConfigBeanSupport { 34 private final ENCHelper encHelper; 35 36 WebAppDConfigBean(DDBean ddBean, GerWebAppType 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 GerWebAppType getWebApp() { 52 return (GerWebAppType) 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 public DConfigBean getDConfigBean(DDBean ddBean) throws ConfigurationException { 65 return encHelper.getDConfigBean(ddBean); 66 } 67 68 public void removeDConfigBean(DConfigBean dcBean) throws BeanNotFoundException { 69 encHelper.removeDConfigBean(dcBean); 70 } 71 72 public String [] getXpaths() { 73 return getXPathsForJ2ee_1_4(ENCHelper.ENC_XPATHS); 74 } 75 76 protected SchemaTypeLoader getSchemaTypeLoader() { 77 return WebAppDConfigRoot.SCHEMA_TYPE_LOADER; 78 } 79 80 } 81 | Popular Tags |