1 17 package org.apache.servicemix.soap.marshalers; 18 19 import java.security.Principal ; 20 import java.util.HashMap ; 21 import java.util.Map ; 22 23 import javax.activation.DataHandler ; 24 import javax.security.auth.Subject ; 25 import javax.xml.namespace.QName ; 26 import javax.xml.transform.Source ; 27 28 import org.apache.servicemix.soap.SoapFault; 29 import org.w3c.dom.Document ; 30 import org.w3c.dom.DocumentFragment ; 31 32 39 public class SoapMessage { 40 41 private QName envelopeName; 42 private QName bodyName; 43 private Source source; 44 private Map attachments; 45 private Map headers; 46 private SoapFault fault; 47 private Subject subject; 48 private Document document; 49 50 53 public Document getDocument() { 54 return document; 55 } 56 59 public void setDocument(Document document) { 60 this.document = document; 61 } 62 65 public Subject getSubject() { 66 return subject; 67 } 68 71 public void setSubject(Subject subject) { 72 this.subject = subject; 73 } 74 public Map getAttachments() { 75 return attachments; 76 } 77 public void setAttachments(Map attachments) { 78 this.attachments = attachments; 79 } 80 public void addAttachment(String name, DataHandler handler) { 81 if (this.attachments == null) { 82 this.attachments = new HashMap (); 83 } 84 this.attachments.put(name, handler); 85 } 86 public boolean hasAttachments() { 87 return attachments != null && attachments.size() > 0; 88 } 89 90 public Map getHeaders() { 91 return headers; 92 } 93 public void setHeaders(Map headers) { 94 this.headers = headers; 95 } 96 public void addHeader(QName name, DocumentFragment header) { 97 if (this.headers == null) { 98 this.headers = new HashMap (); 99 } 100 this.headers.put(name, header); 101 } 102 public boolean hasHeaders() { 103 return headers != null && headers.size() > 0; 104 } 105 106 public Source getSource() { 107 return source; 108 } 109 public void setSource(Source source) { 110 this.source = source; 111 } 112 113 public QName getEnvelopeName() { 114 return envelopeName; 115 } 116 public void setEnvelopeName(QName envelopeName) { 117 this.envelopeName = envelopeName; 118 } 119 public QName getBodyName() { 120 return bodyName; 121 } 122 public void setBodyName(QName bodyName) { 123 this.bodyName = bodyName; 124 } 125 126 public SoapFault getFault() { 127 return fault; 128 } 129 public void setFault(SoapFault fault) { 130 this.fault = fault; 131 } 132 133 public void addPrincipal(Principal principal) { 134 if (subject == null) { 135 subject = new Subject (); 136 } 137 subject.getPrincipals().add(principal); 138 } 139 140 } 141 | Popular Tags |