001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.axis2.jaxws.message.impl;
020:
021: import org.apache.axiom.om.OMElement;
022: import org.apache.axis2.jaxws.message.Block;
023: import org.apache.axis2.jaxws.message.Message;
024: import org.apache.axis2.jaxws.message.Protocol;
025: import org.apache.axis2.jaxws.message.XMLFault;
026: import org.apache.axis2.jaxws.message.factory.BlockFactory;
027:
028: import javax.jws.soap.SOAPBinding.Style;
029: import javax.xml.namespace.QName;
030: import javax.xml.stream.XMLStreamException;
031: import javax.xml.stream.XMLStreamReader;
032: import javax.xml.stream.XMLStreamWriter;
033: import javax.xml.ws.WebServiceException;
034:
035: /**
036: * XMLSpine
037: * <p/>
038: * An XMLSpine is an optimized form of the xml part of the message. Currently there is only one
039: * implementation (XMLSpineImpl).
040: *
041: * @see XMLSpineImpl for more details
042: */
043: interface XMLSpine {
044: /**
045: * Get the protocol for this Message (soap11, soap12, etc.)
046: *
047: * @return Protocl
048: */
049: public Protocol getProtocol();
050:
051: /**
052: * Write out the Message
053: *
054: * @param writer XMLStreamWriter
055: * @param consume true if this is the last request on the block.
056: * @throws WebServiceException
057: */
058: public void outputTo(XMLStreamWriter writer, boolean consume)
059: throws XMLStreamException, WebServiceException;
060:
061: /**
062: * Get the XMLStreamReader represented by this Message for the xml part
063: *
064: * @param consume true if this is the last request on the Message
065: * @return XMLStreamReader
066: * @throws WebServiceException
067: * @throws XMLStreamException
068: */
069: public XMLStreamReader getXMLStreamReader(boolean consume)
070: throws WebServiceException;
071:
072: /** @return the Style (document or rpc) */
073: public Style getStyle();
074:
075: /** @return the QName of the operation element if Style.rpc. Otherwise null */
076: public QName getOperationElement() throws WebServiceException;
077:
078: /**
079: * Set the operation element qname. The operation qname is only used if Style.rpc
080: *
081: * @param operationQName
082: */
083: public void setOperationElement(QName operationQName)
084: throws WebServiceException;
085:
086: /**
087: * isConsumed Return true if the part is consumed. Once consumed, the information in the part
088: * is no longer available.
089: *
090: * @return true if the block is consumed (a method was called with consume=true)
091: */
092: public boolean isConsumed();
093:
094: /**
095: * Determines whether the XMLPart represents a Fault
096: *
097: * @return true if the message represents a fault
098: */
099: public boolean isFault() throws WebServiceException;
100:
101: /**
102: * If the XMLPart represents a fault, an XMLFault is returned which describes the fault in a
103: * protocol agnostic manner
104: *
105: * @return the XMLFault object or null
106: * @see XMLFault
107: */
108: public XMLFault getXMLFault() throws WebServiceException;
109:
110: /**
111: * Change the XMLPart so that it represents the fault described by XMLFault
112: *
113: * @param xmlfault
114: * @see XMLFault
115: */
116: public void setXMLFault(XMLFault xmlFault)
117: throws WebServiceException;
118:
119: /**
120: * getAsOMElement Get the xml part as a read/write OM
121: *
122: * @return OMElement (probably OM SOAPEnvelope)
123: * @throws WebServiceException
124: */
125: public OMElement getAsOMElement() throws WebServiceException;
126:
127: /**
128: * getNumBodyBlocks
129: *
130: * @return number of body blocks
131: * @throws WebServiceException
132: */
133: public int getNumBodyBlocks() throws WebServiceException;
134:
135: /**
136: * getBodyBlock Get the body block at the specificed index. The BlockFactory and object
137: * context are passed in to help create the proper kind of block. Calling this method
138: * will cache the OM.
139: * Avoid it in performant situations.
140: *
141: * @param index
142: * @param context
143: * @param blockFactory
144: * @return Block or null
145: * @throws WebServiceException
146: * @see getBodyBlock
147: */
148: public Block getBodyBlock(int index, Object context,
149: BlockFactory blockFactory) throws WebServiceException;
150:
151: /**
152: * getBodyBlock Get the single Body Block. The BlockFactory and object context are passed in to
153: * help create the proper kind of block. This method should only be invoked when it is known
154: * that there is zero or one block.
155: *
156: * @param index
157: * @param context
158: * @param blockFactory
159: * @return Block or null
160: * @throws WebServiceException
161: */
162: public Block getBodyBlock(Object context, BlockFactory blockFactory)
163: throws WebServiceException;
164:
165: /**
166: * setBodyBlock Set the block at the specified index Once set, the Message owns the block. You
167: * must use the getBodyBlock method to access it.
168: *
169: * @param index
170: * @param block
171: * @throws WebServiceException
172: */
173: public void setBodyBlock(int index, Block block)
174: throws WebServiceException;
175:
176: /**
177: * setBodyBlock Set this as block as the single block for the message.
178: *
179: * @param index
180: * @param block
181: * @throws WebServiceException
182: */
183: public void setBodyBlock(Block block) throws WebServiceException;
184:
185: /**
186: * removeBodyBlock Removes the indicated BodyBlock
187: *
188: * @param index
189: * @throws WebServiceException
190: */
191: public void removeBodyBlock(int index) throws WebServiceException;
192:
193: /**
194: * getNumHeaderBlocks
195: *
196: * @return number of header blocks
197: * @throws WebServiceException
198: */
199: public int getNumHeaderBlocks() throws WebServiceException;
200:
201: /**
202: * getHeaderBlock Get the header block with the specified name The BlockFactory and object
203: * context are passed in to help create the proper kind of block.
204: *
205: * @param namespace
206: * @param localPart
207: * @param context
208: * @param blockFactory
209: * @return Block
210: * @throws WebServiceException
211: */
212: public Block getHeaderBlock(String namespace, String localPart,
213: Object context, BlockFactory blockFactory)
214: throws WebServiceException;
215:
216: /**
217: * appendHeaderBlock Append the block to the list of header blocks. The Message owns the block.
218: * You must use the getHeaderBlock method to access it.
219: *
220: * @param namespace
221: * @param localPart
222: * @param block
223: * @throws WebServiceException
224: */
225: public void setHeaderBlock(String namespace, String localPart,
226: Block block) throws WebServiceException;
227:
228: /**
229: * removePayload Removes the indicated block
230: *
231: * @param namespace
232: * @param localPart
233: * @throws WebServiceException
234: */
235: public void removeHeaderBlock(String namespace, String localPart)
236: throws WebServiceException;
237:
238: /**
239: * Get a traceString...the trace string dumps the contents of the Block without forcing an
240: * underlying ill-performant transformation of the message.
241: *
242: * @return String containing trace information
243: * @boolean indent String containing indent characters
244: */
245: public String traceString(String indent);
246:
247: /**
248: * Used to identify the Message parent of the XMLSpine
249: *
250: * @param msg
251: */
252: public void setParent(Message msg);
253:
254: }
|