1 24 25 package org.objectweb.jonas_ws.wsgen.ddmodifier; 26 27 import org.w3c.dom.Document ; 28 import org.w3c.dom.Element ; 29 import org.w3c.dom.Text ; 30 31 import org.objectweb.jonas.common.Log; 32 33 import org.objectweb.util.monolog.api.Logger; 34 35 41 public class DeploymentDescModifier { 42 43 44 protected static final String J2EE_NS = "http://java.sun.com/xml/ns/j2ee"; 45 46 47 protected static final String JONAS_NS = "http://www.objectweb.org/jonas/ns"; 48 49 50 private static Logger logger = Log.getLogger(Log.JONAS_WSGEN_PREFIX); 51 52 53 private Element element; 54 55 56 private Element parent; 57 58 59 private Document doc; 60 61 67 public DeploymentDescModifier(Element element, Document doc) { 68 this(element, doc, null); 69 } 70 71 78 public DeploymentDescModifier(Element element, Document doc, Element parent) { 79 this.element = element; 80 this.doc = doc; 81 this.parent = parent; 82 } 83 84 91 protected Element newJ2EEElement(String name) { 92 return doc.createElementNS(J2EE_NS, name); 93 } 94 95 104 protected Element newJ2EEElement(String name, String text) { 105 Element e = doc.createElementNS(J2EE_NS, name); 106 Text txt = doc.createTextNode(text); 107 e.appendChild(txt); 108 109 return e; 110 } 111 112 119 protected Element newJOnASElement(String name) { 120 return doc.createElementNS(JONAS_NS, name); 121 } 122 123 132 protected Element newJOnASElement(String name, String text) { 133 Element e = doc.createElementNS(JONAS_NS, name); 134 Text txt = doc.createTextNode(text); 135 e.appendChild(txt); 136 137 return e; 138 } 139 140 141 147 protected Element newElement (String name) { 148 return doc.createElement(name); 149 } 150 151 159 protected Element newElement (String name, String text) { 160 Element e = doc.createElement(name); 161 Text txt = doc.createTextNode(text); 162 e.appendChild(txt); 163 164 return e; 165 } 166 167 170 public static Logger getLogger() { 171 return logger; 172 } 173 174 177 public Element getParent() { 178 return parent; 179 } 180 181 184 public Element getElement() { 185 return element; 186 } 187 188 191 public Document getDocument() { 192 return doc; 193 } 194 195 199 public void setDocument(Document doc) { 200 this.doc = doc; 201 this.parent = doc.getDocumentElement(); 202 } 203 204 208 public void setElement(Element e) { 209 element = e; 210 getParent().appendChild(e); 211 } 212 213 } | Popular Tags |