1 22 package org.jboss.metadata; 23 24 import org.jboss.deployment.DeploymentException; 25 import org.w3c.dom.Element ; 26 import static org.jboss.metadata.MetaData.*; 27 28 42 public class ResourceRefMetaData extends Ref 43 { 44 46 53 private String refName; 54 55 private String name; 56 63 private String jndiName; 64 private String resURL; 65 68 private String type; 69 83 private boolean containerAuth; 84 93 private boolean isShareable; 94 95 97 public ResourceRefMetaData() 99 { 100 } 101 102 104 public String getJndiName() 105 { 106 return jndiName; 107 } 108 109 public void setJndiName(String jndiName) 110 { 111 this.jndiName = jndiName; 112 } 113 114 public String getName() 115 { 116 return name; 117 } 118 119 public void setName(String name) 120 { 121 this.name = name; 122 } 123 124 public String getRefName() 125 { 126 return refName; 127 } 128 129 public void setRefName(String refName) 130 { 131 this.refName = refName; 132 } 133 134 public String getResURL() 135 { 136 return resURL; 137 } 138 139 public void setResURL(String resURL) 140 { 141 this.resURL = resURL; 142 } 143 144 public String getType() 145 { 146 return type; 147 } 148 149 public void setType(String type) 150 { 151 this.type = type; 152 } 153 154 public String getResourceName() 155 { 156 if (name == null) 157 { 158 name = refName; 160 } 161 return name; 162 } 163 164 public void setResourceName(String resName) 165 { 166 name = resName; 167 } 168 169 public boolean isContainerAuth() 170 { 171 return containerAuth; 172 } 173 public void setContainerAuth(String value) 174 { 175 this.containerAuth = value.equalsIgnoreCase("Container"); 176 } 177 public void setContainerAuth(boolean flag) 178 { 179 this.containerAuth = flag; 180 } 181 182 public boolean isShareable() 183 { 184 return isShareable; 185 } 186 public void setSharable(String value) 187 { 188 this.isShareable = value.equalsIgnoreCase("Shareable"); 189 } 190 public void setSharable(boolean flag) 191 { 192 this.isShareable = flag; 193 } 194 195 public void importEjbJarXml(Element element) throws DeploymentException 196 { 197 refName = getElementContent(getUniqueChild(element, "res-ref-name")); 198 199 type = getElementContent(getUniqueChild(element, "res-type")); 200 201 String auth = getElementContent(getUniqueChild(element, "res-auth")); 202 if (auth.equalsIgnoreCase("Container")) 203 { 204 containerAuth = true; 205 } 206 else if (auth.equals("Application") || auth.equals("SERVLET") ) 207 { 208 containerAuth = false; 209 } 210 else 211 { 212 throw new DeploymentException("res-auth tag should be 'Container' or " 213 + "'Application' or 'SERVLET'"); 214 } 215 String sharing = getElementContent(getOptionalChild(element, "res-sharing-scope"), "Shareable"); 217 isShareable = sharing.equals("Shareable"); 218 } 219 220 public void importJbossXml(Element element) throws DeploymentException 221 { 222 Element child = getOptionalChild(element, "resource-name"); 224 if (child == null) 225 { 226 if (type.equals("java.net.URL")) 227 { 228 Element resUrl = getOptionalChild(element, "res-url"); 230 if (resUrl != null) 231 { 232 resURL = getElementContent(resUrl); 233 } 234 else 235 { 236 Element name = getUniqueChild(element, "jndi-name"); 237 jndiName = getElementContent(name); 238 } 239 } 240 else 242 jndiName = getElementContent(getUniqueChild(element, "jndi-name")); 243 } 244 else 245 { 246 name = getElementContent(child); 247 } 248 } 249 250 252 254 256 } 258 | Popular Tags |