001: /*
002: Copyright (c) 2004-2005, Dennis M. Sosnoski.
003: All rights reserved.
004:
005: Redistribution and use in source and binary forms, with or without modification,
006: are permitted provided that the following conditions are met:
007:
008: * Redistributions of source code must retain the above copyright notice, this
009: list of conditions and the following disclaimer.
010: * Redistributions in binary form must reproduce the above copyright notice,
011: this list of conditions and the following disclaimer in the documentation
012: and/or other materials provided with the distribution.
013: * Neither the name of JiBX nor the names of its contributors may be used
014: to endorse or promote products derived from this software without specific
015: prior written permission.
016:
017: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
018: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
019: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
020: DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
021: ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
022: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
023: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
024: ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
026: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027: */
028:
029: package org.jibx.ws.wsdl;
030:
031: import java.util.ArrayList;
032: import java.util.List;
033:
034: /**
035: * WSDL object model component corresponding to an operation definition.
036: *
037: * @author Dennis M. Sosnoski
038: */
039: public class Operation {
040: /** Actual operation name. */
041: private String m_name;
042:
043: /** SOAP action. */
044: private String m_soapAction;
045:
046: /** Documentation as node list (<code>null</code> if none). */
047: private List m_documentation;
048:
049: /** Ordered message references for this operation. */
050: private ArrayList m_messageRefs;
051:
052: /**
053: * Constructor from operation name.
054: *
055: * @param name operation name
056: */
057: public Operation(String name) {
058: m_name = name;
059: m_soapAction = "";
060: m_messageRefs = new ArrayList();
061: }
062:
063: /**
064: * Add reference to input message. All input message(s) must be set before
065: * any output or fault messages are set.
066: *
067: * @param msg input message
068: */
069: public void addInputMessage(Message msg) {
070: m_messageRefs.add(new MessageReference(
071: MessageReference.INPUT_REFERENCE, msg));
072: }
073:
074: /**
075: * Add reference to output message. All output message(s) must be set after
076: * any input messages and before any fault messages are set.
077: *
078: * @param msg output message
079: */
080: public void addOutputMessage(Message msg) {
081: m_messageRefs.add(new MessageReference(
082: MessageReference.OUTPUT_REFERENCE, msg));
083: }
084:
085: /**
086: * Add reference to fault message. All fault message(s) must be set after
087: * any input or output messages are set.
088: *
089: * @param msg fault message
090: */
091: public void addFaultMessage(Message msg) {
092: m_messageRefs.add(new MessageReference(
093: MessageReference.FAULT_REFERENCE, msg));
094: }
095:
096: /**
097: * Get operation name.
098: *
099: * @return operation name
100: */
101: public String getName() {
102: return m_name;
103: }
104:
105: /**
106: * Get soapAction.
107: *
108: * @return soapAction
109: */
110: public String getSoapAction() {
111: return m_soapAction;
112: }
113:
114: /**
115: * Set soapAction.
116: *
117: * @param action
118: */
119: public void setSoapAction(String action) {
120: m_soapAction = action;
121: }
122:
123: /**
124: * Get documentation.
125: *
126: * @return list of nodes
127: */
128: public List getDocumentation() {
129: return m_documentation;
130: }
131:
132: /**
133: * Set documentation.
134: *
135: * @param nodes list of nodes
136: */
137: public void setDocumentation(List nodes) {
138: m_documentation = nodes;
139: }
140:
141: /**
142: * Get message references for operation. The returned list is live, but
143: * should not be modified by the caller.
144: *
145: * @return list of parts
146: */
147: public ArrayList getMessageReferences() {
148: return m_messageRefs;
149: }
150: }
|