1 22 package org.jboss.webservice.metadata.serviceref; 23 24 26 import org.jboss.deployment.DeploymentException; 27 import org.jboss.metadata.MetaData; 28 import org.jboss.xb.QNameBuilder; 29 import org.w3c.dom.Element ; 30 31 import javax.xml.namespace.QName ; 32 import java.util.ArrayList ; 33 import java.util.Iterator ; 34 import java.io.Serializable ; 35 36 41 public class HandlerMetaData implements Serializable 42 { 43 static final long serialVersionUID = 8749727542255024909L; 44 45 private String handlerName; 47 private String handlerClass; 49 private ArrayList initParams = new ArrayList (); 51 private ArrayList soapHeaders = new ArrayList (); 53 private ArrayList soapRoles = new ArrayList (); 55 private ArrayList portNames = new ArrayList (); 57 58 public void setHandlerName(String value) 59 { 60 this.handlerName = value; 61 } 62 63 public String getHandlerName() 64 { 65 return handlerName; 66 } 67 68 public void setHandlerClass(String handlerClass) 69 { 70 this.handlerClass = handlerClass; 71 } 72 73 public String getHandlerClass() 74 { 75 return handlerClass; 76 } 77 78 public void addInitParam(InitParamMetaData param) 79 { 80 initParams.add(param); 81 } 82 83 public InitParamMetaData[] getInitParams() 84 { 85 InitParamMetaData[] array = new InitParamMetaData[initParams.size()]; 86 initParams.toArray(array); 87 return array; 88 } 89 90 public void addSoapHeader(QName qName) 91 { 92 soapHeaders.add(qName); 93 } 94 95 public QName [] getSoapHeaders() 96 { 97 QName [] array = new QName [soapHeaders.size()]; 98 soapHeaders.toArray(array); 99 return array; 100 } 101 102 public void addSoapRole(String value) 103 { 104 soapRoles.add(value); 105 } 106 107 public String [] getSoapRoles() 108 { 109 String [] array = new String [soapRoles.size()]; 110 soapRoles.toArray(array); 111 return array; 112 } 113 114 public String [] getPortNames() 115 { 116 String [] array = new String [portNames.size()]; 117 portNames.toArray(array); 118 return array; 119 } 120 121 public void importStandardXml(Element element) 122 throws DeploymentException 123 { 124 handlerName = MetaData.getUniqueChildContent(element, "handler-name"); 125 126 handlerClass = MetaData.getUniqueChildContent(element, "handler-class"); 127 128 Iterator iterator = MetaData.getChildrenByTagName(element, "init-param"); 130 while (iterator.hasNext()) 131 { 132 Element paramElement = (Element ) iterator.next(); 133 InitParamMetaData param = new InitParamMetaData(); 134 param.setParamName(MetaData.getUniqueChildContent(paramElement, "param-name")); 135 param.setParamValue(MetaData.getUniqueChildContent(paramElement, "param-value")); 136 initParams.add(param); 137 } 138 139 iterator = MetaData.getChildrenByTagName(element, "soap-header"); 141 while (iterator.hasNext()) 142 { 143 Element headerElement = (Element ) iterator.next(); 144 String content = MetaData.getElementContent(headerElement); 145 QName qname = QNameBuilder.buildQName(headerElement, content); 146 soapHeaders.add(qname); 147 } 148 149 iterator = MetaData.getChildrenByTagName(element, "soap-role"); 151 while (iterator.hasNext()) 152 { 153 Element roleElement = (Element ) iterator.next(); 154 String content = MetaData.getElementContent(roleElement); 155 soapRoles.add(content); 156 } 157 158 iterator = MetaData.getChildrenByTagName(element, "port-name"); 160 while (iterator.hasNext()) 161 { 162 Element portElement = (Element ) iterator.next(); 163 String content = MetaData.getElementContent(portElement); 164 portNames.add(content); 165 } 166 } 167 168 public String toString() { 169 StringBuffer buffer = new StringBuffer ("\nHandlerMetaData:"); 170 buffer.append("\n name=" + handlerName); 171 buffer.append("\n class=" + handlerClass); 172 buffer.append("\n params=" + initParams); 173 buffer.append("\n headers=" + soapHeaders); 174 buffer.append("\n roles=" + soapRoles); 175 buffer.append("\n ports=" + portNames); 176 return buffer.toString(); 177 } 178 } 179
| Popular Tags
|