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: * @(#)WrapperBuilder.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.wsdl11wrapper;
030:
031: import java.util.Map;
032: import javax.wsdl.Message;
033: import org.w3c.dom.Document;
034: import org.w3c.dom.Element;
035: import org.w3c.dom.NodeList;
036:
037: /**
038: * Assist in processing normalized messages with JBI WSDL 1.1 wrappers
039: *
040: * Usage sequence, for each message to normalize:
041: * initialize()
042: * addParts() or multiple addPart() calls
043: * getResult()
044: *
045: * The same instance should not be used by multiple threads concurrently as it is
046: * not guaranteed to be thread safe - and maintains state
047: *
048: * The re-use of the same instance however is encouraged.
049: *
050: * @author aegloff
051: */
052: public interface WrapperBuilder {
053:
054: /**
055: * Constant Status
056: */
057: static public final String STATUS_TAG = "Status";
058:
059: /**
060: * Constant RESULT
061: */
062: static public final String RESULT_TAG = "Result";
063:
064: /**
065: * Initialize the builder to start a build sequence.
066: *
067: * Also re-sets a result document if it already exists.
068: *
069: * @pram docToPopulate Provide an empty document to popluate, or null if the
070: * builder should create a new document itself
071: * @param wsdlMessageDefinition sets the WSDL message definition of the message to normalize
072: * @param operationBindingMessageName The name defined in the WSDL operation binding for the message to normalize to.
073: *
074: * @throws WrapperProcessingException if the builder could not be initialized
075: */
076: void initialize(Document docToPopulate,
077: Message wsdlMessageDefinition,
078: String operationBindingMessageName)
079: throws WrapperProcessingException;
080:
081: /**
082: * Add a part in the right position (wrapped in a JBI part wrapper) to the JBI message wrapper element
083: * @param partName the name of the message part
084: * @param partNode the part node (payload)
085: * The part node does not have to be associated with the normalDoc yet, it will be imported
086: * @throws WrapperProcessingException if the part could not be added
087: */
088: void addPart(String partName, Element partNode)
089: throws WrapperProcessingException;
090:
091: /**
092: * Add a part in the right position (wrapped in a JBI part wrapper) to the JBI message wrapper element
093: * @param partName the name of the message part
094: * @param partNodes the part node(s) (payload)
095: * The part node does not have to be associated with the normalDoc yet, it will be imported
096: * @throws WrapperProcessingException if the part could not be added
097: */
098: void addPart(String partName, NodeList partNodes)
099: throws WrapperProcessingException;
100:
101: /**
102: * Add parts in the right order (each wrapped in a JBI part wrapper) to the passed in JBI message wrapper element
103: * The jbiMessageWrapper must be a node of the normalDoc.
104: * @param normalDoc The target document of the normalization
105: * @param jbiMessageWrapper The message wrapper element to add the jbi part wrappers and part payload to
106: * @param messageDefinintion the WSDL message definition
107: * @param partNameToPartNodes a mapping from the part name to the part node(s) of type NodeList (payload),
108: * The part node does not have to be associated with the normalDoc yet, it will be imported
109: * @throws WrapperProcessingException if the parts could not be added
110: */
111: void addParts(Map partNameToPartNodes)
112: throws WrapperProcessingException;
113:
114: /**
115: * Obtain the result document, i.e. the Normalized Message payload in
116: * jbi wsdl 1.1 wrapper format
117: * @return the normalized message payload document
118: */
119: Document getResult() throws WrapperProcessingException;
120:
121: /**
122: * Obtain the status document, i.e. the Normalized Message payload in
123: * jbi wsdl 1.1 wrapper format that represents a status (succeed or error)
124: * @return the normalized message payload document
125: */
126: Document getStatusDocument(String statusMessage)
127: throws WrapperProcessingException;
128:
129: /**
130: * Obtain the status Message definition
131: * @return the normalized message payload document
132: */
133: Message getStatusMessage() throws WrapperProcessingException;
134: }
|