001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)SOAPWrapper.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.common.soap;
030:
031: import java.util.HashMap;
032: import java.util.Iterator;
033: import java.util.Map;
034:
035: import javax.xml.soap.SOAPMessage;
036:
037: /**
038: * This object provides a wrapper for SOAP Messages and also contains status information.
039: * The wrapper allows clients to attach properties to it.
040: *
041: * @author Sun Microsystems, Inc.
042: */
043: public class SOAPWrapper {
044: /**
045: * A place holder to hold additional name-value pairs.
046: */
047: private Map mMap;
048:
049: /**
050: * Contains handle to the soap message.
051: */
052: private SOAPMessage mMessage;
053:
054: /**
055: * Request Status.
056: */
057: private int mStatus;
058:
059: /**
060: * Internal handle to the service URL.
061: */
062: private String mServiceURL;
063:
064: /**
065: * Creates a new instance of SOAPWrapper.
066: *
067: * @param soapMessage - soap message
068: */
069: public SOAPWrapper(SOAPMessage soapMessage) {
070: mMessage = soapMessage;
071: mMap = new HashMap();
072: }
073:
074: /**
075: * Sets status.
076: *
077: * @param status request status
078: */
079: public void setStatus(int status) {
080: mStatus = status;
081: }
082:
083: /**
084: * Gets status.
085: *
086: * @return status information
087: */
088: public int getStatus() {
089: return mStatus;
090: }
091:
092: /**
093: * Gets Service URL.
094: *
095: * @return service URL
096: */
097: public String getServiceURL() {
098: return mServiceURL;
099: }
100:
101: /**
102: * Sets Service URL.
103: *
104: * @param serviceURL service url.
105: */
106: public void setServiceURL(String serviceURL) {
107: mServiceURL = serviceURL;
108: }
109:
110: /**
111: * Gets the soap message.
112: *
113: * @return soap message instance
114: */
115: public SOAPMessage getMessage() {
116: return mMessage;
117: }
118:
119: /**
120: * Sets a property to the SOAP Wrapper.
121: *
122: * @param propertyName property name
123: * @param value property value
124: */
125: public void setValue(String propertyName, Object value) {
126: mMap.put(propertyName, value);
127: }
128:
129: /**
130: * Sets a property to the SOAP Wrapper.
131: *
132: * @param propertyName property name
133: *
134: * @return property value
135: */
136: public Object getValue(String propertyName) {
137: return mMap.get(propertyName);
138: }
139:
140: /**
141: * Get the property list.
142: *
143: * @return a list of property names.
144: */
145: public Iterator getProperties() {
146: return mMap.keySet().iterator();
147: }
148: }
|