1 22 package org.jboss.deployment.spi.beans; 23 24 import javax.enterprise.deploy.model.DDBean ; 25 import javax.enterprise.deploy.model.DDBeanRoot ; 26 import javax.enterprise.deploy.model.DeployableObject ; 27 import javax.enterprise.deploy.spi.DConfigBean ; 28 import javax.enterprise.deploy.spi.DConfigBeanRoot ; 29 import javax.enterprise.deploy.spi.exceptions.ConfigurationException ; 30 31 49 50 public class JBossExample2ConfigBeanRoot extends JBossConfigBeanProxy implements DConfigBeanRoot 51 { 52 53 public JBossExample2ConfigBeanRoot(DDBeanRoot root) 54 { 55 JBossExample2MainConfigBean bean = new JBossExample2MainConfigBean(root, this, null); 56 DeployableObject deployment = root.getDeployableObject(); 57 setBean(bean, deployment); 58 } 59 60 public DConfigBean getDConfigBean(DDBeanRoot arg0) 61 { 62 69 return null; 70 } 71 72 private class JBossExample2MainConfigBean extends AbstractJBossConfigBean 73 { 74 public JBossExample2MainConfigBean(DDBean bean, DConfigBeanRoot root, ConfigBeanXPaths path) 75 { 76 super(bean, root, path); 77 } 78 79 87 protected ConfigBeanXPaths buildXPathList() 88 { 89 ConfigBeanXPaths pathRoot = new ConfigBeanXPaths("", null); 90 91 new ConfigBeanXPaths("root-element/sub-element", pathRoot); 93 new ConfigBeanXPaths("root-element/other-sub", pathRoot); 94 return pathRoot; 95 } 96 97 101 public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException 102 { 103 String path = bean.getXpath(); 105 ConfigBeanXPaths cPath = (ConfigBeanXPaths)xpaths.get(path); 106 if (cPath == null) 107 { 108 throw new ConfigurationException ("Config Bean Not Found"); 109 } 110 111 AbstractJBossConfigBean retBean; 112 if (bean.getXpath().equals("root-element/sub-element")) 113 { 114 retBean = new JBossExample2SubElementConfigBean(bean, this.myRoot, cPath); 115 } 116 else if (bean.getXpath().equals("root-element/other-sub")) 117 { 118 retBean = new JBossExample2OtherSubConfigBean(bean, this.myRoot, cPath); 119 } 120 else 121 { 122 retBean = new JBossNullConfigBean(bean, this.myRoot, cPath); 123 } 124 125 children.add(retBean); 126 return retBean; 127 } 128 } 129 130 public class JBossExample2SubElementConfigBean extends AbstractJBossConfigBean 131 { 132 public JBossExample2SubElementConfigBean(DDBean bean, DConfigBeanRoot root, ConfigBeanXPaths path) 133 { 134 super(bean, root, path); 135 } 136 137 144 145 protected ConfigBeanXPaths buildXPathList() 146 { 147 ConfigBeanXPaths pathRoot = new ConfigBeanXPaths("", null); 148 new ConfigBeanXPaths("@id", pathRoot); 149 new ConfigBeanXPaths("name", pathRoot); 150 new ConfigBeanXPaths("class", pathRoot); 151 return pathRoot; 152 } 153 154 } 155 156 public class JBossExample2OtherSubConfigBean extends AbstractJBossConfigBean 157 { 158 public JBossExample2OtherSubConfigBean(DDBean bean, DConfigBeanRoot root, ConfigBeanXPaths path) 159 { 160 super(bean, root, path); 161 } 162 163 170 protected ConfigBeanXPaths buildXPathList() 171 { 172 ConfigBeanXPaths pathRoot = new ConfigBeanXPaths("", null); 173 new ConfigBeanXPaths("name", pathRoot); 174 new ConfigBeanXPaths("description", pathRoot); 175 return pathRoot; 176 } 177 } 178 } 179 | Popular Tags |