ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chamik...@apache.org
Subject svn commit: r349924 [11/22] - in /webservices/site/trunk/targets/sandesha: ./ sandesha2/ sandesha2/images/ sandesha2/images/logos/ sandesha2/style/ sandesha2/xref-test/ sandesha2/xref-test/org/ sandesha2/xref-test/org/apache/ sandesha2/xref-test/org/ap...
Date Wed, 30 Nov 2005 11:17:58 GMT
Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/SandeshaOutHandler.html
URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/SandeshaOutHandler.html?rev=349924&view=auto
==============================================================================
--- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/SandeshaOutHandler.html (added)
+++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/SandeshaOutHandler.html Wed Nov 30 03:11:01 2005
@@ -0,0 +1,623 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>SandeshaOutHandler xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../apidocs/org/apache/sandesha2/handlers/SandeshaOutHandler.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a>   <em class="comment">/*</em>
+<a name="2" href="#2">2</a>   <em class="comment"> * Copyright 1999-2004 The Apache Software Foundation.</em>
+<a name="3" href="#3">3</a>   <em class="comment"> * </em>
+<a name="4" href="#4">4</a>   <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License"); you may not</em>
+<a name="5" href="#5">5</a>   <em class="comment"> * use this file except in compliance with the License. You may obtain a copy of</em>
+<a name="6" href="#6">6</a>   <em class="comment"> * the License at</em>
+<a name="7" href="#7">7</a>   <em class="comment"> * </em>
+<a name="8" href="#8">8</a>   <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a>   <em class="comment"> * </em>
+<a name="10" href="#10">10</a>  <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a>  <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT</em>
+<a name="12" href="#12">12</a>  <em class="comment"> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the</em>
+<a name="13" href="#13">13</a>  <em class="comment"> * License for the specific language governing permissions and limitations under</em>
+<a name="14" href="#14">14</a>  <em class="comment"> * the License.</em>
+<a name="15" href="#15">15</a>  <em class="comment"> *  </em>
+<a name="16" href="#16">16</a>  <em class="comment"> */</em>
+<a name="17" href="#17">17</a>  
+<a name="18" href="#18">18</a>  <strong>package</strong> <a href="../../../../org/apache/sandesha2/handlers/package-summary.html">org.apache.sandesha2.handlers</a>;
+<a name="19" href="#19">19</a>  
+<a name="20" href="#20">20</a>  <strong>import</strong> javax.xml.namespace.QName;
+<a name="21" href="#21">21</a>  
+<a name="22" href="#22">22</a>  <strong>import</strong> org.apache.axis2.AxisFault;
+<a name="23" href="#23">23</a>  <strong>import</strong> org.apache.axis2.addressing.EndpointReference;
+<a name="24" href="#24">24</a>  <strong>import</strong> org.apache.axis2.client.ListenerManager;
+<a name="25" href="#25">25</a>  <strong>import</strong> org.apache.axis2.context.AbstractContext;
+<a name="26" href="#26">26</a>  <strong>import</strong> org.apache.axis2.context.ConfigurationContext;
+<a name="27" href="#27">27</a>  <strong>import</strong> org.apache.axis2.context.MessageContext;
+<a name="28" href="#28">28</a>  <strong>import</strong> org.apache.axis2.context.OperationContext;
+<a name="29" href="#29">29</a>  <strong>import</strong> org.apache.axis2.context.OperationContextFactory;
+<a name="30" href="#30">30</a>  <strong>import</strong> org.apache.axis2.context.ServiceContext;
+<a name="31" href="#31">31</a>  <strong>import</strong> org.apache.axis2.description.AxisService;
+<a name="32" href="#32">32</a>  <strong>import</strong> org.apache.axis2.description.Parameter;
+<a name="33" href="#33">33</a>  <strong>import</strong> org.apache.axis2.description.ParameterImpl;
+<a name="34" href="#34">34</a>  <strong>import</strong> org.apache.axis2.handlers.AbstractHandler;
+<a name="35" href="#35">35</a>  <strong>import</strong> org.apache.axis2.soap.SOAPBody;
+<a name="36" href="#36">36</a>  <strong>import</strong> org.apache.axis2.soap.SOAPEnvelope;
+<a name="37" href="#37">37</a>  <strong>import</strong> org.apache.axis2.soap.SOAPFactory;
+<a name="38" href="#38">38</a>  <strong>import</strong> org.apache.commons.logging.Log;
+<a name="39" href="#39">39</a>  <strong>import</strong> org.apache.commons.logging.LogFactory;
+<a name="40" href="#40">40</a>  <strong>import</strong> org.apache.sandesha2.Sandesha2Constants;
+<a name="41" href="#41">41</a>  <strong>import</strong> org.apache.sandesha2.RMMsgContext;
+<a name="42" href="#42">42</a>  <strong>import</strong> org.apache.sandesha2.SandeshaException;
+<a name="43" href="#43">43</a>  <strong>import</strong> org.apache.sandesha2.Sandesha2Constants.ClientAPI;
+<a name="44" href="#44">44</a>  <strong>import</strong> org.apache.sandesha2.policy.RMPolicyBean;
+<a name="45" href="#45">45</a>  <strong>import</strong> org.apache.sandesha2.storage.StorageManager;
+<a name="46" href="#46">46</a>  <strong>import</strong> org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
+<a name="47" href="#47">47</a>  <strong>import</strong> org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+<a name="48" href="#48">48</a>  <strong>import</strong> org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
+<a name="49" href="#49">49</a>  <strong>import</strong> org.apache.sandesha2.storage.beans.CreateSeqBean;
+<a name="50" href="#50">50</a>  <strong>import</strong> org.apache.sandesha2.storage.beans.SenderBean;
+<a name="51" href="#51">51</a>  <strong>import</strong> org.apache.sandesha2.storage.beans.SequencePropertyBean;
+<a name="52" href="#52">52</a>  <strong>import</strong> org.apache.sandesha2.util.MsgInitializer;
+<a name="53" href="#53">53</a>  <strong>import</strong> org.apache.sandesha2.util.RMMsgCreator;
+<a name="54" href="#54">54</a>  <strong>import</strong> org.apache.sandesha2.util.RMPolicyManager;
+<a name="55" href="#55">55</a>  <strong>import</strong> org.apache.sandesha2.util.SOAPAbstractFactory;
+<a name="56" href="#56">56</a>  <strong>import</strong> org.apache.sandesha2.util.SandeshaUtil;
+<a name="57" href="#57">57</a>  <strong>import</strong> org.apache.sandesha2.util.SequenceManager;
+<a name="58" href="#58">58</a>  <strong>import</strong> org.apache.sandesha2.wsrm.AckRequested;
+<a name="59" href="#59">59</a>  <strong>import</strong> org.apache.sandesha2.wsrm.CreateSequence;
+<a name="60" href="#60">60</a>  <strong>import</strong> org.apache.sandesha2.wsrm.Identifier;
+<a name="61" href="#61">61</a>  <strong>import</strong> org.apache.sandesha2.wsrm.LastMessage;
+<a name="62" href="#62">62</a>  <strong>import</strong> org.apache.sandesha2.wsrm.MessageNumber;
+<a name="63" href="#63">63</a>  <strong>import</strong> org.apache.sandesha2.wsrm.Sequence;
+<a name="64" href="#64">64</a>  <strong>import</strong> org.apache.sandesha2.wsrm.SequenceOffer;
+<a name="65" href="#65">65</a>  <strong>import</strong> org.apache.wsdl.WSDLConstants;
+<a name="66" href="#66">66</a>  
+<a name="67" href="#67">67</a>  <em>/**<em>*</em></em>
+<a name="68" href="#68">68</a>  <em> * This is invoked in the outFlow of an RM endpoint</em>
+<a name="69" href="#69">69</a>  <em> * </em>
+<a name="70" href="#70">70</a>  <em> * @author Chamikara Jayalath &lt;chamikaramj@gmail.com></em>
+<a name="71" href="#71">71</a>  <em> */</em>
+<a name="72" href="#72">72</a>  
+<a name="73" href="#73">73</a>  <strong>public</strong> <strong>class</strong> <a href="../../../../org/apache/sandesha2/handlers/SandeshaOutHandler.html">SandeshaOutHandler</a> <strong>extends</strong> AbstractHandler {
+<a name="74" href="#74">74</a>  
+<a name="75" href="#75">75</a>  	<strong>protected</strong> Log log = LogFactory.getLog(SandeshaOutHandler.<strong>class</strong>.getName());
+<a name="76" href="#76">76</a>  
+<a name="77" href="#77">77</a>  	<strong>public</strong> <strong>void</strong> invoke(MessageContext msgCtx) throws AxisFault {
+<a name="78" href="#78">78</a>  
+<a name="79" href="#79">79</a>  		ConfigurationContext context = msgCtx.getSystemContext();
+<a name="80" href="#80">80</a>  		<strong>if</strong> (context == <strong>null</strong>)
+<a name="81" href="#81">81</a>  			<strong>throw</strong> <strong>new</strong> AxisFault(<span class="string">"ConfigurationContext is null"</span>);
+<a name="82" href="#82">82</a>  
+<a name="83" href="#83">83</a>  		AxisService axisService = msgCtx.getAxisService();
+<a name="84" href="#84">84</a>  		<strong>if</strong> (axisService == <strong>null</strong>)
+<a name="85" href="#85">85</a>  			<strong>throw</strong> <strong>new</strong> AxisFault(<span class="string">"AxisService is null"</span>);
+<a name="86" href="#86">86</a>  
+<a name="87" href="#87">87</a>  		<em class="comment">//getting rm message</em>
+<a name="88" href="#88">88</a>  		RMMsgContext rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
+<a name="89" href="#89">89</a>  
+<a name="90" href="#90">90</a>  		String DONE = (String) msgCtx
+<a name="91" href="#91">91</a>  				.getProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE);
+<a name="92" href="#92">92</a>  		<strong>if</strong> (<strong>null</strong> != DONE &amp;&amp; <span class="string">"true"</span>.equals(DONE))
+<a name="93" href="#93">93</a>  			<strong>return</strong>;
+<a name="94" href="#94">94</a>  
+<a name="95" href="#95">95</a>  		msgCtx.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, <span class="string">"true"</span>);
+<a name="96" href="#96">96</a>  
+<a name="97" href="#97">97</a>  		ServiceContext serviceContext = msgCtx.getServiceContext();
+<a name="98" href="#98">98</a>  		Object debug = <strong>null</strong>;
+<a name="99" href="#99">99</a>  		<strong>if</strong> (serviceContext != <strong>null</strong>) {
+<a name="100" href="#100">100</a> 			debug = serviceContext.getProperty(ClientAPI.SANDESHA_DEBUG_MODE);
+<a name="101" href="#101">101</a> 			<strong>if</strong> (debug != <strong>null</strong> &amp;&amp; <span class="string">"on"</span>.equals(debug)) {
+<a name="102" href="#102">102</a> 				System.out.println(<span class="string">"DEBUG: SandeshaOutHandler got a '"</span>
+<a name="103" href="#103">103</a> 						+ SandeshaUtil.getMessageTypeString(rmMsgCtx
+<a name="104" href="#104">104</a> 								.getMessageType()) + <span class="string">"' message."</span>);
+<a name="105" href="#105">105</a> 			}
+<a name="106" href="#106">106</a> 		}
+<a name="107" href="#107">107</a> 
+<a name="108" href="#108">108</a> 		<em class="comment">//continue only if an possible application message</em>
+<a name="109" href="#109">109</a> 		<strong>if</strong> (!(rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.UNKNOWN)) {
+<a name="110" href="#110">110</a> 			<strong>return</strong>;
+<a name="111" href="#111">111</a> 		}
+<a name="112" href="#112">112</a> 
+<a name="113" href="#113">113</a> 		<em class="comment">//Strating the sender.</em>
+<a name="114" href="#114">114</a> 		SandeshaUtil.startSenderIfStopped(context);
+<a name="115" href="#115">115</a> 
+<a name="116" href="#116">116</a> 		<em class="comment">//Adding the policy bean</em>
+<a name="117" href="#117">117</a> 		RMPolicyBean policyBean = RMPolicyManager.getPolicyBean(rmMsgCtx);
+<a name="118" href="#118">118</a> 		rmMsgCtx.setProperty(Sandesha2Constants.WSP.RM_POLICY_BEAN, policyBean);
+<a name="119" href="#119">119</a> 
+<a name="120" href="#120">120</a> 		StorageManager storageManager = <a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="121" href="#121">121</a> 				.getSandeshaStorageManager(context);
+<a name="122" href="#122">122</a> 
+<a name="123" href="#123">123</a> 		CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
+<a name="124" href="#124">124</a> 		SequencePropertyBeanMgr seqPropMgr = storageManager
+<a name="125" href="#125">125</a> 				.getSequencePropretyBeanMgr();
+<a name="126" href="#126">126</a> 
+<a name="127" href="#127">127</a> 		<strong>boolean</strong> serverSide = msgCtx.isServerSide();
+<a name="128" href="#128">128</a> 
+<a name="129" href="#129">129</a> 		<em class="comment">//setting message Id if null</em>
+<a name="130" href="#130">130</a> 		<strong>if</strong> (msgCtx.getMessageID() == <strong>null</strong>) {
+<a name="131" href="#131">131</a> 			msgCtx.setMessageID(SandeshaUtil.getUUID());
+<a name="132" href="#132">132</a> 		}
+<a name="133" href="#133">133</a> 		<em class="comment">//initial work</em>
+<a name="134" href="#134">134</a> 		<em class="comment">//find internal sequence id</em>
+<a name="135" href="#135">135</a> 		String internalSequenceId = <strong>null</strong>;
+<a name="136" href="#136">136</a> 
+<a name="137" href="#137">137</a> 		<em class="comment">//Temp sequence id is the one used to refer to the sequence (since</em>
+<a name="138" href="#138">138</a> 		<em class="comment">//actual sequence id is not available when first msg arrives)</em>
+<a name="139" href="#139">139</a> 		<em class="comment">//server side - sequenceId if the incoming sequence</em>
+<a name="140" href="#140">140</a> 		<em class="comment">//client side - wsaTo + SeequenceKey</em>
+<a name="141" href="#141">141</a> 
+<a name="142" href="#142">142</a> 		<strong>if</strong> (serverSide) {
+<a name="143" href="#143">143</a> 			<em class="comment">//getting the request message and rmMessage.</em>
+<a name="144" href="#144">144</a> 			MessageContext reqMsgCtx = msgCtx.getOperationContext()
+<a name="145" href="#145">145</a> 					.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+<a name="146" href="#146">146</a> 
+<a name="147" href="#147">147</a> 			RMMsgContext requestRMMsgCtx = <a href="../../../../org/apache/sandesha2/util/MsgInitializer.html">MsgInitializer</a>
+<a name="148" href="#148">148</a> 					.initializeMessage(reqMsgCtx);
+<a name="149" href="#149">149</a> 
+<a name="150" href="#150">150</a> 			Sequence reqSequence = (Sequence) requestRMMsgCtx
+<a name="151" href="#151">151</a> 					.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
+<a name="152" href="#152">152</a> 			<strong>if</strong> (reqSequence == <strong>null</strong>)
+<a name="153" href="#153">153</a> 				<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"Sequence part is null"</span>);
+<a name="154" href="#154">154</a> 
+<a name="155" href="#155">155</a> 			String incomingSeqId = reqSequence.getIdentifier().getIdentifier();
+<a name="156" href="#156">156</a> 			<strong>if</strong> (incomingSeqId == <strong>null</strong> || incomingSeqId == <span class="string">""</span>)
+<a name="157" href="#157">157</a> 				<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"Invalid seqence Id"</span>);
+<a name="158" href="#158">158</a> 
+<a name="159" href="#159">159</a> 			internalSequenceId = incomingSeqId;
+<a name="160" href="#160">160</a> 
+<a name="161" href="#161">161</a> 		} <strong>else</strong> {
+<a name="162" href="#162">162</a> 			<em class="comment">//set the internal sequence id for the client side.</em>
+<a name="163" href="#163">163</a> 			EndpointReference toEPR = msgCtx.getTo();
+<a name="164" href="#164">164</a> 			<strong>if</strong> (toEPR == <strong>null</strong> || toEPR.getAddress() == <strong>null</strong>
+<a name="165" href="#165">165</a> 					|| <span class="string">""</span>.equals(toEPR.getAddress()))
+<a name="166" href="#166">166</a> 				<strong>throw</strong> <strong>new</strong> AxisFault(
+<a name="167" href="#167">167</a> 						<span class="string">"TO End Point Reference is not set correctly. This is a must for the sandesha client side."</span>);
+<a name="168" href="#168">168</a> 
+<a name="169" href="#169">169</a> 			internalSequenceId = toEPR.getAddress();
+<a name="170" href="#170">170</a> 			String sequenceKey = (String) context
+<a name="171" href="#171">171</a> 					.getProperty(ClientAPI.SEQUENCE_KEY);
+<a name="172" href="#172">172</a> 			<strong>if</strong> (sequenceKey != <strong>null</strong>)
+<a name="173" href="#173">173</a> 				internalSequenceId = internalSequenceId + sequenceKey;
+<a name="174" href="#174">174</a> 
+<a name="175" href="#175">175</a> 		}
+<a name="176" href="#176">176</a> 
+<a name="177" href="#177">177</a> 		<em class="comment">//check if the first message</em>
+<a name="178" href="#178">178</a> 
+<a name="179" href="#179">179</a> 		<strong>long</strong> messageNumber = getNextMsgNo(context, internalSequenceId);
+<a name="180" href="#180">180</a> 
+<a name="181" href="#181">181</a> 		<strong>boolean</strong> sendCreateSequence = false;
+<a name="182" href="#182">182</a> 
+<a name="183" href="#183">183</a> 		SequencePropertyBean outSeqBean = seqPropMgr.retrieve(
+<a name="184" href="#184">184</a> 				internalSequenceId,
+<a name="185" href="#185">185</a> 				Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);
+<a name="186" href="#186">186</a> 
+<a name="187" href="#187">187</a> 		<strong>if</strong> (messageNumber == 1) {
+<a name="188" href="#188">188</a> 			<strong>if</strong> (outSeqBean == <strong>null</strong>) {
+<a name="189" href="#189">189</a> 				sendCreateSequence = <strong>true</strong>;
+<a name="190" href="#190">190</a> 			}
+<a name="191" href="#191">191</a> 		}
+<a name="192" href="#192">192</a> 
+<a name="193" href="#193">193</a> 		<em class="comment">//if fist message - setup the sequence for the client side</em>
+<a name="194" href="#194">194</a> 		<strong>if</strong> (!serverSide &amp;&amp; sendCreateSequence) {
+<a name="195" href="#195">195</a> 			SequenceManager.setupNewClientSequence(msgCtx, internalSequenceId);
+<a name="196" href="#196">196</a> 		}
+<a name="197" href="#197">197</a> 
+<a name="198" href="#198">198</a> 		<em class="comment">//if first message - add create sequence</em>
+<a name="199" href="#199">199</a> 		<strong>if</strong> (sendCreateSequence) {
+<a name="200" href="#200">200</a> 
+<a name="201" href="#201">201</a> 			SequencePropertyBean responseCreateSeqAdded = seqPropMgr.retrieve(
+<a name="202" href="#202">202</a> 					internalSequenceId,
+<a name="203" href="#203">203</a> 					Sandesha2Constants.SequenceProperties.OUT_CREATE_SEQUENCE_SENT);
+<a name="204" href="#204">204</a> 
+<a name="205" href="#205">205</a> 			<strong>if</strong> (responseCreateSeqAdded == <strong>null</strong>) {
+<a name="206" href="#206">206</a> 				responseCreateSeqAdded = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SequencePropertyBean.html">SequencePropertyBean</a>(
+<a name="207" href="#207">207</a> 						internalSequenceId,
+<a name="208" href="#208">208</a> 						Sandesha2Constants.SequenceProperties.OUT_CREATE_SEQUENCE_SENT,
+<a name="209" href="#209">209</a> 						<span class="string">"true"</span>);
+<a name="210" href="#210">210</a> 				seqPropMgr.insert(responseCreateSeqAdded);
+<a name="211" href="#211">211</a> 
+<a name="212" href="#212">212</a> 				String acksTo = <strong>null</strong>;
+<a name="213" href="#213">213</a> 				<strong>if</strong> (serviceContext != <strong>null</strong>) {
+<a name="214" href="#214">214</a> 					acksTo = (String) serviceContext
+<a name="215" href="#215">215</a> 							.getProperty(ClientAPI.AcksTo);
+<a name="216" href="#216">216</a> 				}
+<a name="217" href="#217">217</a> 
+<a name="218" href="#218">218</a> 				<strong>if</strong> (acksTo == <strong>null</strong>)
+<a name="219" href="#219">219</a> 					acksTo = Sandesha2Constants.WSA.NS_URI_ANONYMOUS;
+<a name="220" href="#220">220</a> 
+<a name="221" href="#221">221</a> 				<em class="comment">//If acksTo is not anonymous. Start the listner TODO: verify</em>
+<a name="222" href="#222">222</a> 				<strong>if</strong> (!Sandesha2Constants.WSA.NS_URI_ANONYMOUS.equals(acksTo)
+<a name="223" href="#223">223</a> 						&amp;&amp; !serverSide) {
+<a name="224" href="#224">224</a> 					String transportIn = (String) context
+<a name="225" href="#225">225</a> 							.getProperty(MessageContext.TRANSPORT_IN);
+<a name="226" href="#226">226</a> 					<strong>if</strong> (transportIn == <strong>null</strong>)
+<a name="227" href="#227">227</a> 						transportIn = org.apache.axis2.Constants.TRANSPORT_HTTP;
+<a name="228" href="#228">228</a> 					ListenerManager.makeSureStarted(transportIn, context);
+<a name="229" href="#229">229</a> 				} <strong>else</strong> <strong>if</strong> (acksTo == <strong>null</strong> &amp;&amp; serverSide) {
+<a name="230" href="#230">230</a> 					String incomingSequencId = <a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="231" href="#231">231</a> 							.getServerSideIncomingSeqIdFromInternalSeqId(internalSequenceId);
+<a name="232" href="#232">232</a> 					SequencePropertyBean bean = seqPropMgr.retrieve(
+<a name="233" href="#233">233</a> 							incomingSequencId,
+<a name="234" href="#234">234</a> 							Sandesha2Constants.SequenceProperties.REPLY_TO_EPR);
+<a name="235" href="#235">235</a> 					<strong>if</strong> (bean != <strong>null</strong>) {
+<a name="236" href="#236">236</a> 						EndpointReference acksToEPR = (EndpointReference) bean
+<a name="237" href="#237">237</a> 								.getValue();
+<a name="238" href="#238">238</a> 						<strong>if</strong> (acksToEPR != <strong>null</strong>)
+<a name="239" href="#239">239</a> 							acksTo = (String) acksToEPR.getAddress();
+<a name="240" href="#240">240</a> 					}
+<a name="241" href="#241">241</a> 				} <strong>else</strong> <strong>if</strong> (Sandesha2Constants.WSA.NS_URI_ANONYMOUS.equals(acksTo)) {
+<a name="242" href="#242">242</a> 					<em class="comment">//set transport in.</em>
+<a name="243" href="#243">243</a> 					Object trIn = msgCtx
+<a name="244" href="#244">244</a> 							.getProperty(MessageContext.TRANSPORT_IN);
+<a name="245" href="#245">245</a> 					<strong>if</strong> (trIn == <strong>null</strong>) {
+<a name="246" href="#246">246</a> 
+<a name="247" href="#247">247</a> 					}
+<a name="248" href="#248">248</a> 				}
+<a name="249" href="#249">249</a> 
+<a name="250" href="#250">250</a> 				addCreateSequenceMessage(rmMsgCtx, internalSequenceId, acksTo);
+<a name="251" href="#251">251</a> 
+<a name="252" href="#252">252</a> 			}
+<a name="253" href="#253">253</a> 		}
+<a name="254" href="#254">254</a> 
+<a name="255" href="#255">255</a> 		<em class="comment">//do response processing</em>
+<a name="256" href="#256">256</a> 
+<a name="257" href="#257">257</a> 		SOAPEnvelope env = rmMsgCtx.getSOAPEnvelope();
+<a name="258" href="#258">258</a> 		<strong>if</strong> (env == <strong>null</strong>) {
+<a name="259" href="#259">259</a> 			SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(
+<a name="260" href="#260">260</a> 					SandeshaUtil.getSOAPVersion(env)).getDefaultEnvelope();
+<a name="261" href="#261">261</a> 			rmMsgCtx.setSOAPEnvelop(envelope);
+<a name="262" href="#262">262</a> 		}
+<a name="263" href="#263">263</a> 
+<a name="264" href="#264">264</a> 		SOAPBody soapBody = rmMsgCtx.getSOAPEnvelope().getBody();
+<a name="265" href="#265">265</a> 		<strong>if</strong> (soapBody == <strong>null</strong>)
+<a name="266" href="#266">266</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(
+<a name="267" href="#267">267</a> 					<span class="string">"Invalid SOAP message. Body is not present"</span>);
+<a name="268" href="#268">268</a> 
+<a name="269" href="#269">269</a> 		String messageId1 = SandeshaUtil.getUUID();
+<a name="270" href="#270">270</a> 		<strong>if</strong> (rmMsgCtx.getMessageId() == <strong>null</strong>) {
+<a name="271" href="#271">271</a> 			rmMsgCtx.setMessageId(messageId1);
+<a name="272" href="#272">272</a> 		}
+<a name="273" href="#273">273</a> 
+<a name="274" href="#274">274</a> 		<strong>if</strong> (serverSide) {
+<a name="275" href="#275">275</a> 
+<a name="276" href="#276">276</a> 			<em class="comment">//processing the response</em>
+<a name="277" href="#277">277</a> 			processResponseMessage(rmMsgCtx, internalSequenceId, messageNumber);
+<a name="278" href="#278">278</a> 
+<a name="279" href="#279">279</a> 			MessageContext reqMsgCtx = msgCtx.getOperationContext()
+<a name="280" href="#280">280</a> 					.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+<a name="281" href="#281">281</a> 			RMMsgContext requestRMMsgCtx = <a href="../../../../org/apache/sandesha2/util/MsgInitializer.html">MsgInitializer</a>
+<a name="282" href="#282">282</a> 					.initializeMessage(reqMsgCtx);
+<a name="283" href="#283">283</a> 
+<a name="284" href="#284">284</a> 			<em class="comment">//let the request end with 202 if a ack has not been</em>
+<a name="285" href="#285">285</a> 			<em class="comment">// written in the incoming thread.</em>
+<a name="286" href="#286">286</a> 			<strong>if</strong> (reqMsgCtx.getProperty(Sandesha2Constants.ACK_WRITTEN) == <strong>null</strong>
+<a name="287" href="#287">287</a> 					|| !<span class="string">"true"</span>.equals(reqMsgCtx
+<a name="288" href="#288">288</a> 							.getProperty(Sandesha2Constants.ACK_WRITTEN)))
+<a name="289" href="#289">289</a> 				reqMsgCtx.getOperationContext().setProperty(
+<a name="290" href="#290">290</a> 						org.apache.axis2.Constants.RESPONSE_WRITTEN, <span class="string">"false"</span>);
+<a name="291" href="#291">291</a> 		} <strong>else</strong> {
+<a name="292" href="#292">292</a> 			EndpointReference toEPR = msgCtx.getTo();
+<a name="293" href="#293">293</a> 
+<a name="294" href="#294">294</a> 			<strong>if</strong> (toEPR == <strong>null</strong>)
+<a name="295" href="#295">295</a> 				<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"To EPR is not found"</span>);
+<a name="296" href="#296">296</a> 
+<a name="297" href="#297">297</a> 			String to = toEPR.getAddress();
+<a name="298" href="#298">298</a> 			String operationName = msgCtx.getOperationContext()
+<a name="299" href="#299">299</a> 					.getAxisOperation().getName().getLocalPart();
+<a name="300" href="#300">300</a> 
+<a name="301" href="#301">301</a> 			<strong>if</strong> (msgCtx.getWSAAction() == <strong>null</strong>) {
+<a name="302" href="#302">302</a> 				msgCtx.setWSAAction(to + <span class="string">"/"</span> + operationName);
+<a name="303" href="#303">303</a> 			}
+<a name="304" href="#304">304</a> 
+<a name="305" href="#305">305</a> 			<strong>if</strong> (msgCtx.getSoapAction() == <strong>null</strong>) {
+<a name="306" href="#306">306</a> 				msgCtx.setSoapAction(<span class="string">"\&quot;"</span> + to + <span class="string">"/"</span> + operationName + <span class="string">"\&quot;"</span>);
+<a name="307" href="#307">307</a> 			}
+<a name="308" href="#308">308</a> 
+<a name="309" href="#309">309</a> 			<em class="comment">//processing the response</em>
+<a name="310" href="#310">310</a> 			processResponseMessage(rmMsgCtx, internalSequenceId, messageNumber);
+<a name="311" href="#311">311</a> 
+<a name="312" href="#312">312</a> 		}
+<a name="313" href="#313">313</a> 
+<a name="314" href="#314">314</a> 		<em class="comment">//pausing the message</em>
+<a name="315" href="#315">315</a> 		msgCtx.setPausedTrue(getName());
+<a name="316" href="#316">316</a> 	}
+<a name="317" href="#317">317</a> 
+<a name="318" href="#318">318</a> 	<strong>public</strong> <strong>void</strong> addCreateSequenceMessage(<a href="../../../../org/apache/sandesha2/RMMsgContext.html">RMMsgContext</a> applicationRMMsg,
+<a name="319" href="#319">319</a> 			String internalSequenceId, String acksTo) throws SandeshaException {
+<a name="320" href="#320">320</a> 
+<a name="321" href="#321">321</a> 		MessageContext applicationMsg = applicationRMMsg.getMessageContext();
+<a name="322" href="#322">322</a> 		<strong>if</strong> (applicationMsg == <strong>null</strong>)
+<a name="323" href="#323">323</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"Message context is null"</span>);
+<a name="324" href="#324">324</a> 		RMMsgContext createSeqRMMessage = RMMsgCreator.createCreateSeqMsg(
+<a name="325" href="#325">325</a> 				applicationRMMsg, internalSequenceId, acksTo);
+<a name="326" href="#326">326</a> 		CreateSequence createSequencePart = (CreateSequence) createSeqRMMessage
+<a name="327" href="#327">327</a> 				.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
+<a name="328" href="#328">328</a> 		<strong>if</strong> (createSequencePart == <strong>null</strong>)
+<a name="329" href="#329">329</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(
+<a name="330" href="#330">330</a> 					<span class="string">"Create Sequence part is null for a CreateSequence message"</span>);
+<a name="331" href="#331">331</a> 
+<a name="332" href="#332">332</a> 		SequenceOffer offer = createSequencePart.getSequenceOffer();
+<a name="333" href="#333">333</a> 		<strong>if</strong> (offer != <strong>null</strong>) {
+<a name="334" href="#334">334</a> 			<em class="comment">//Offer processing</em>
+<a name="335" href="#335">335</a> 			String offeredSequenceId = offer.getIdentifer().getIdentifier();
+<a name="336" href="#336">336</a> 			SequencePropertyBean msgsBean = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SequencePropertyBean.html">SequencePropertyBean</a>();
+<a name="337" href="#337">337</a> 			msgsBean.setSequenceId(offeredSequenceId);
+<a name="338" href="#338">338</a> 			msgsBean.setName(Sandesha2Constants.SequenceProperties.RECEIVED_MESSAGES);
+<a name="339" href="#339">339</a> 			msgsBean.setValue(<span class="string">""</span>);
+<a name="340" href="#340">340</a> 
+<a name="341" href="#341">341</a> 			SequencePropertyBean offeredSequenceBean = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SequencePropertyBean.html">SequencePropertyBean</a>();
+<a name="342" href="#342">342</a> 			offeredSequenceBean
+<a name="343" href="#343">343</a> 					.setName(Sandesha2Constants.SequenceProperties.OFFERED_SEQUENCE);
+<a name="344" href="#344">344</a> 			offeredSequenceBean.setSequenceId(internalSequenceId);
+<a name="345" href="#345">345</a> 			offeredSequenceBean.setValue(offeredSequenceId);
+<a name="346" href="#346">346</a> 
+<a name="347" href="#347">347</a> 			StorageManager storageManager = <a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="348" href="#348">348</a> 					.getSandeshaStorageManager(applicationMsg
+<a name="349" href="#349">349</a> 							.getSystemContext());
+<a name="350" href="#350">350</a> 
+<a name="351" href="#351">351</a> 			SequencePropertyBeanMgr seqPropMgr = storageManager
+<a name="352" href="#352">352</a> 					.getSequencePropretyBeanMgr();
+<a name="353" href="#353">353</a> 
+<a name="354" href="#354">354</a> 			seqPropMgr.insert(msgsBean);
+<a name="355" href="#355">355</a> 			seqPropMgr.insert(offeredSequenceBean);
+<a name="356" href="#356">356</a> 		}
+<a name="357" href="#357">357</a> 
+<a name="358" href="#358">358</a> 		MessageContext createSeqMsg = createSeqRMMessage.getMessageContext();
+<a name="359" href="#359">359</a> 		createSeqMsg.setRelatesTo(<strong>null</strong>); <em class="comment">//create seq msg does not relateTo</em>
+<a name="360" href="#360">360</a> 		<em class="comment">// anything</em>
+<a name="361" href="#361">361</a> 		AbstractContext context = applicationRMMsg.getContext();
+<a name="362" href="#362">362</a> 		<strong>if</strong> (context == <strong>null</strong>)
+<a name="363" href="#363">363</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"Context is null"</span>);
+<a name="364" href="#364">364</a> 
+<a name="365" href="#365">365</a> 		StorageManager storageManager = <a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="366" href="#366">366</a> 				.getSandeshaStorageManager(applicationMsg.getSystemContext());
+<a name="367" href="#367">367</a> 		CreateSeqBeanMgr createSeqMgr = storageManager.getCreateSeqBeanMgr();
+<a name="368" href="#368">368</a> 
+<a name="369" href="#369">369</a> 		CreateSeqBean createSeqBean = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/CreateSeqBean.html">CreateSeqBean</a>(internalSequenceId,
+<a name="370" href="#370">370</a> 				createSeqMsg.getMessageID(), <strong>null</strong>);
+<a name="371" href="#371">371</a> 		createSeqMgr.insert(createSeqBean);
+<a name="372" href="#372">372</a> 
+<a name="373" href="#373">373</a> 		<strong>if</strong> (createSeqMsg.getReplyTo() == <strong>null</strong>)
+<a name="374" href="#374">374</a> 			createSeqMsg.setReplyTo(<strong>new</strong> EndpointReference(
+<a name="375" href="#375">375</a> 					Sandesha2Constants.WSA.NS_URI_ANONYMOUS));
+<a name="376" href="#376">376</a> 
+<a name="377" href="#377">377</a> 		SenderBeanMgr retransmitterMgr = storageManager
+<a name="378" href="#378">378</a> 				.getRetransmitterBeanMgr();
+<a name="379" href="#379">379</a> 
+<a name="380" href="#380">380</a> 		String key = SandeshaUtil.storeMessageContext(createSeqRMMessage
+<a name="381" href="#381">381</a> 				.getMessageContext());
+<a name="382" href="#382">382</a> 		SenderBean createSeqEntry = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SenderBean.html">SenderBean</a>();
+<a name="383" href="#383">383</a> 		createSeqEntry.setKey(key);
+<a name="384" href="#384">384</a> 		createSeqEntry.setTimeToSend(System.currentTimeMillis());
+<a name="385" href="#385">385</a> 		createSeqEntry.setMessageId(createSeqRMMessage.getMessageId());
+<a name="386" href="#386">386</a> 		createSeqEntry.setSend(<strong>true</strong>);
+<a name="387" href="#387">387</a> 		retransmitterMgr.insert(createSeqEntry);
+<a name="388" href="#388">388</a> 	}
+<a name="389" href="#389">389</a> 
+<a name="390" href="#390">390</a> 	<strong>private</strong> <strong>void</strong> processResponseMessage(<a href="../../../../org/apache/sandesha2/RMMsgContext.html">RMMsgContext</a> rmMsg,
+<a name="391" href="#391">391</a> 			String internalSequenceId, <strong>long</strong> messageNumber)
+<a name="392" href="#392">392</a> 			throws <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a> {
+<a name="393" href="#393">393</a> 
+<a name="394" href="#394">394</a> 		MessageContext msg = rmMsg.getMessageContext();
+<a name="395" href="#395">395</a> 
+<a name="396" href="#396">396</a> 		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(<a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="397" href="#397">397</a> 				.getSOAPVersion(rmMsg.getSOAPEnvelope()));
+<a name="398" href="#398">398</a> 
+<a name="399" href="#399">399</a> 		<strong>if</strong> (rmMsg == <strong>null</strong>)
+<a name="400" href="#400">400</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"Message or reques message is null"</span>);
+<a name="401" href="#401">401</a> 
+<a name="402" href="#402">402</a> 		AbstractContext context = rmMsg.getContext();
+<a name="403" href="#403">403</a> 		<strong>if</strong> (context == <strong>null</strong>)
+<a name="404" href="#404">404</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"Context is null"</span>);
+<a name="405" href="#405">405</a> 
+<a name="406" href="#406">406</a> 		StorageManager storageManager = <a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="407" href="#407">407</a> 				.getSandeshaStorageManager(msg.getSystemContext());
+<a name="408" href="#408">408</a> 		SequencePropertyBeanMgr sequencePropertyMgr = storageManager
+<a name="409" href="#409">409</a> 				.getSequencePropretyBeanMgr();
+<a name="410" href="#410">410</a> 
+<a name="411" href="#411">411</a> 		SenderBeanMgr retransmitterMgr = storageManager
+<a name="412" href="#412">412</a> 				.getRetransmitterBeanMgr();
+<a name="413" href="#413">413</a> 
+<a name="414" href="#414">414</a> 		SequencePropertyBean toBean = sequencePropertyMgr.retrieve(
+<a name="415" href="#415">415</a> 				internalSequenceId, Sandesha2Constants.SequenceProperties.TO_EPR);
+<a name="416" href="#416">416</a> 		SequencePropertyBean replyToBean = sequencePropertyMgr.retrieve(
+<a name="417" href="#417">417</a> 				internalSequenceId, Sandesha2Constants.SequenceProperties.REPLY_TO_EPR);
+<a name="418" href="#418">418</a> 
+<a name="419" href="#419">419</a> 		<em class="comment">//again - looks weird in the client side - but consistent</em>
+<a name="420" href="#420">420</a> 		SequencePropertyBean outSequenceBean = sequencePropertyMgr.retrieve(
+<a name="421" href="#421">421</a> 				internalSequenceId,
+<a name="422" href="#422">422</a> 				Sandesha2Constants.SequenceProperties.OUT_SEQUENCE_ID);
+<a name="423" href="#423">423</a> 
+<a name="424" href="#424">424</a> 		<strong>if</strong> (toBean == <strong>null</strong>)
+<a name="425" href="#425">425</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"To is null"</span>);
+<a name="426" href="#426">426</a> 
+<a name="427" href="#427">427</a> 		EndpointReference toEPR = (EndpointReference) toBean.getValue();
+<a name="428" href="#428">428</a> 		EndpointReference replyToEPR = <strong>null</strong>;
+<a name="429" href="#429">429</a> 
+<a name="430" href="#430">430</a> 		<strong>if</strong> (replyToBean != <strong>null</strong>) {
+<a name="431" href="#431">431</a> 			replyToEPR = (EndpointReference) replyToBean.getValue();
+<a name="432" href="#432">432</a> 		}
+<a name="433" href="#433">433</a> 
+<a name="434" href="#434">434</a> 		<strong>if</strong> (toEPR == <strong>null</strong> || toEPR.getAddress() == <strong>null</strong>
+<a name="435" href="#435">435</a> 				|| toEPR.getAddress() == <span class="string">""</span>)
+<a name="436" href="#436">436</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"To Property has an invalid value"</span>);
+<a name="437" href="#437">437</a> 
+<a name="438" href="#438">438</a> 		String newToStr = <strong>null</strong>;
+<a name="439" href="#439">439</a> 
+<a name="440" href="#440">440</a> 		<strong>if</strong> (msg.isServerSide()) {
+<a name="441" href="#441">441</a> 			<strong>try</strong> {
+<a name="442" href="#442">442</a> 				MessageContext requestMsg = msg.getOperationContext()
+<a name="443" href="#443">443</a> 						.getMessageContext(
+<a name="444" href="#444">444</a> 								OperationContextFactory.MESSAGE_LABEL_IN_VALUE);
+<a name="445" href="#445">445</a> 				<strong>if</strong> (requestMsg != <strong>null</strong>) {
+<a name="446" href="#446">446</a> 					newToStr = requestMsg.getReplyTo().getAddress();
+<a name="447" href="#447">447</a> 				}
+<a name="448" href="#448">448</a> 			} <strong>catch</strong> (AxisFault e) {
+<a name="449" href="#449">449</a> 				<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(e.getMessage());
+<a name="450" href="#450">450</a> 			}
+<a name="451" href="#451">451</a> 		}
+<a name="452" href="#452">452</a> 
+<a name="453" href="#453">453</a> 		<strong>if</strong> (newToStr != <strong>null</strong>)
+<a name="454" href="#454">454</a> 			rmMsg.setTo(<strong>new</strong> EndpointReference(<strong>new</strong>ToStr));
+<a name="455" href="#455">455</a> 		<strong>else</strong>
+<a name="456" href="#456">456</a> 			rmMsg.setTo(toEPR);
+<a name="457" href="#457">457</a> 
+<a name="458" href="#458">458</a> 		<strong>if</strong> (replyToEPR != <strong>null</strong>)
+<a name="459" href="#459">459</a> 			rmMsg.setReplyTo(replyToEPR);
+<a name="460" href="#460">460</a> 
+<a name="461" href="#461">461</a> 		Sequence sequence = <strong>new</strong> <a href="../../../../org/apache/sandesha2/wsrm/Sequence.html">Sequence</a>(factory);
+<a name="462" href="#462">462</a> 
+<a name="463" href="#463">463</a> 		MessageNumber msgNumber = <strong>new</strong> <a href="../../../../org/apache/sandesha2/wsrm/MessageNumber.html">MessageNumber</a>(factory);
+<a name="464" href="#464">464</a> 		msgNumber.setMessageNumber(messageNumber);
+<a name="465" href="#465">465</a> 		sequence.setMessageNumber(msgNumber);
+<a name="466" href="#466">466</a> 
+<a name="467" href="#467">467</a> 		<strong>boolean</strong> lastMessage = false;
+<a name="468" href="#468">468</a> 		<em class="comment">//setting last message</em>
+<a name="469" href="#469">469</a> 		<strong>if</strong> (msg.isServerSide()) {
+<a name="470" href="#470">470</a> 			<em class="comment">//server side</em>
+<a name="471" href="#471">471</a> 			String incomingSeqId = internalSequenceId;
+<a name="472" href="#472">472</a> 			MessageContext requestMsg = <strong>null</strong>;
+<a name="473" href="#473">473</a> 
+<a name="474" href="#474">474</a> 			<strong>try</strong> {
+<a name="475" href="#475">475</a> 				requestMsg = msg.getOperationContext().getMessageContext(
+<a name="476" href="#476">476</a> 						WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+<a name="477" href="#477">477</a> 			} <strong>catch</strong> (AxisFault e) {
+<a name="478" href="#478">478</a> 				<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(e.getMessage());
+<a name="479" href="#479">479</a> 			}
+<a name="480" href="#480">480</a> 
+<a name="481" href="#481">481</a> 			RMMsgContext reqRMMsgCtx = <a href="../../../../org/apache/sandesha2/util/MsgInitializer.html">MsgInitializer</a>
+<a name="482" href="#482">482</a> 					.initializeMessage(requestMsg);
+<a name="483" href="#483">483</a> 			Sequence requestSequence = (Sequence) reqRMMsgCtx
+<a name="484" href="#484">484</a> 					.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
+<a name="485" href="#485">485</a> 			<strong>if</strong> (requestSequence == <strong>null</strong>)
+<a name="486" href="#486">486</a> 				<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"Request Sequence is null"</span>);
+<a name="487" href="#487">487</a> 
+<a name="488" href="#488">488</a> 			<strong>if</strong> (requestSequence.getLastMessage() != <strong>null</strong>) {
+<a name="489" href="#489">489</a> 				lastMessage = <strong>true</strong>;
+<a name="490" href="#490">490</a> 				sequence.setLastMessage(<strong>new</strong> <a href="../../../../org/apache/sandesha2/wsrm/LastMessage.html">LastMessage</a>(factory));
+<a name="491" href="#491">491</a> 
+<a name="492" href="#492">492</a> 				<em class="comment">//saving the last message no.</em>
+<a name="493" href="#493">493</a> 				SequencePropertyBean lastOutMsgBean = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SequencePropertyBean.html">SequencePropertyBean</a>(
+<a name="494" href="#494">494</a> 						internalSequenceId,
+<a name="495" href="#495">495</a> 						Sandesha2Constants.SequenceProperties.LAST_OUT_MESSAGE,
+<a name="496" href="#496">496</a> 						<strong>new</strong> Long(messageNumber));
+<a name="497" href="#497">497</a> 				sequencePropertyMgr.insert(lastOutMsgBean);
+<a name="498" href="#498">498</a> 			}
+<a name="499" href="#499">499</a> 
+<a name="500" href="#500">500</a> 		} <strong>else</strong> {
+<a name="501" href="#501">501</a> 			<em class="comment">//client side</em>
+<a name="502" href="#502">502</a> 
+<a name="503" href="#503">503</a> 			ServiceContext serviceContext = msg.getServiceContext();
+<a name="504" href="#504">504</a> 			<strong>if</strong> (serviceContext != <strong>null</strong>) {
+<a name="505" href="#505">505</a> 				Object obj = serviceContext.getProperty(ClientAPI.LAST_MESSAGE);
+<a name="506" href="#506">506</a> 				<strong>if</strong> (obj != <strong>null</strong> &amp;&amp; <span class="string">"true"</span>.equals(obj)) {
+<a name="507" href="#507">507</a> 					lastMessage = <strong>true</strong>;
+<a name="508" href="#508">508</a> 					sequence.setLastMessage(<strong>new</strong> <a href="../../../../org/apache/sandesha2/wsrm/LastMessage.html">LastMessage</a>(factory));
+<a name="509" href="#509">509</a> 					<em class="comment">//saving the last message no.</em>
+<a name="510" href="#510">510</a> 					SequencePropertyBean lastOutMsgBean = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SequencePropertyBean.html">SequencePropertyBean</a>(
+<a name="511" href="#511">511</a> 							internalSequenceId,
+<a name="512" href="#512">512</a> 							Sandesha2Constants.SequenceProperties.LAST_OUT_MESSAGE,
+<a name="513" href="#513">513</a> 							<strong>new</strong> Long(messageNumber));
+<a name="514" href="#514">514</a> 					sequencePropertyMgr.insert(lastOutMsgBean);
+<a name="515" href="#515">515</a> 				}
+<a name="516" href="#516">516</a> 			}
+<a name="517" href="#517">517</a> 		}
+<a name="518" href="#518">518</a> 
+<a name="519" href="#519">519</a> 		AckRequested ackRequested = <strong>null</strong>;
+<a name="520" href="#520">520</a> 
+<a name="521" href="#521">521</a> 		<strong>boolean</strong> addAckRequested = false;
+<a name="522" href="#522">522</a> 		<strong>if</strong> (!lastMessage)
+<a name="523" href="#523">523</a> 			addAckRequested = <strong>true</strong>;
+<a name="524" href="#524">524</a> 
+<a name="525" href="#525">525</a> 		<em class="comment">//setting the Sequnece id.</em>
+<a name="526" href="#526">526</a> 		<em class="comment">//Set send = true/false depending on the availability of the out</em>
+<a name="527" href="#527">527</a> 		<em class="comment">// sequence id.</em>
+<a name="528" href="#528">528</a> 		String identifierStr = <strong>null</strong>;
+<a name="529" href="#529">529</a> 		<strong>if</strong> (outSequenceBean == <strong>null</strong> || outSequenceBean.getValue() == <strong>null</strong>) {
+<a name="530" href="#530">530</a> 			identifierStr = Sandesha2Constants.TEMP_SEQUENCE_ID;
+<a name="531" href="#531">531</a> 
+<a name="532" href="#532">532</a> 		} <strong>else</strong> {
+<a name="533" href="#533">533</a> 			identifierStr = (String) outSequenceBean.getValue();
+<a name="534" href="#534">534</a> 		}
+<a name="535" href="#535">535</a> 
+<a name="536" href="#536">536</a> 		Identifier id1 = <strong>new</strong> <a href="../../../../org/apache/sandesha2/wsrm/Identifier.html">Identifier</a>(factory);
+<a name="537" href="#537">537</a> 		id1.setIndentifer(identifierStr);
+<a name="538" href="#538">538</a> 		sequence.setIdentifier(id1);
+<a name="539" href="#539">539</a> 		rmMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE, sequence);
+<a name="540" href="#540">540</a> 
+<a name="541" href="#541">541</a> 		<strong>if</strong> (addAckRequested) {
+<a name="542" href="#542">542</a> 			ackRequested = <strong>new</strong> <a href="../../../../org/apache/sandesha2/wsrm/AckRequested.html">AckRequested</a>(factory);
+<a name="543" href="#543">543</a> 			Identifier id2 = <strong>new</strong> <a href="../../../../org/apache/sandesha2/wsrm/Identifier.html">Identifier</a>(factory);
+<a name="544" href="#544">544</a> 			id2.setIndentifer(identifierStr);
+<a name="545" href="#545">545</a> 			ackRequested.setIdentifier(id2);
+<a name="546" href="#546">546</a> 			rmMsg.setMessagePart(Sandesha2Constants.MessageParts.ACK_REQUEST,
+<a name="547" href="#547">547</a> 					ackRequested);
+<a name="548" href="#548">548</a> 		}
+<a name="549" href="#549">549</a> 
+<a name="550" href="#550">550</a> 		<strong>try</strong> {
+<a name="551" href="#551">551</a> 			rmMsg.addSOAPEnvelope();
+<a name="552" href="#552">552</a> 		} <strong>catch</strong> (AxisFault e1) {
+<a name="553" href="#553">553</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(e1.getMessage());
+<a name="554" href="#554">554</a> 		}
+<a name="555" href="#555">555</a> 
+<a name="556" href="#556">556</a> 		<em class="comment">//Retransmitter bean entry for the application message</em>
+<a name="557" href="#557">557</a> 		SenderBean appMsgEntry = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SenderBean.html">SenderBean</a>();
+<a name="558" href="#558">558</a> 		String key = <a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="559" href="#559">559</a> 				.storeMessageContext(rmMsg.getMessageContext());
+<a name="560" href="#560">560</a> 		appMsgEntry.setKey(key);
+<a name="561" href="#561">561</a> 		appMsgEntry.setTimeToSend(System.currentTimeMillis());
+<a name="562" href="#562">562</a> 		appMsgEntry.setMessageId(rmMsg.getMessageId());
+<a name="563" href="#563">563</a> 		appMsgEntry.setMessageNumber(messageNumber);
+<a name="564" href="#564">564</a> 		<strong>if</strong> (outSequenceBean == <strong>null</strong> || outSequenceBean.getValue() == <strong>null</strong>) {
+<a name="565" href="#565">565</a> 			appMsgEntry.setSend(false);
+<a name="566" href="#566">566</a> 		} <strong>else</strong> {
+<a name="567" href="#567">567</a> 			appMsgEntry.setSend(<strong>true</strong>);
+<a name="568" href="#568">568</a> 
+<a name="569" href="#569">569</a> 		}
+<a name="570" href="#570">570</a> 		appMsgEntry.setInternalSequenceId(internalSequenceId);
+<a name="571" href="#571">571</a> 		retransmitterMgr.insert(appMsgEntry);
+<a name="572" href="#572">572</a> 	}
+<a name="573" href="#573">573</a> 
+<a name="574" href="#574">574</a> 	<strong>private</strong> <strong>long</strong> getNextMsgNo(ConfigurationContext context,
+<a name="575" href="#575">575</a> 			String internalSequenceId) throws SandeshaException {
+<a name="576" href="#576">576</a> 
+<a name="577" href="#577">577</a> 		StorageManager storageManager = <a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="578" href="#578">578</a> 				.getSandeshaStorageManager(context);
+<a name="579" href="#579">579</a> 
+<a name="580" href="#580">580</a> 		SequencePropertyBeanMgr seqPropMgr = storageManager
+<a name="581" href="#581">581</a> 				.getSequencePropretyBeanMgr();
+<a name="582" href="#582">582</a> 		SequencePropertyBean nextMsgNoBean = seqPropMgr.retrieve(
+<a name="583" href="#583">583</a> 				internalSequenceId,
+<a name="584" href="#584">584</a> 				Sandesha2Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);
+<a name="585" href="#585">585</a> 		<strong>long</strong> nextMsgNo = 1;
+<a name="586" href="#586">586</a> 		<strong>boolean</strong> update = false;
+<a name="587" href="#587">587</a> 		<strong>if</strong> (nextMsgNoBean != <strong>null</strong>) {
+<a name="588" href="#588">588</a> 			update = <strong>true</strong>;
+<a name="589" href="#589">589</a> 			Long nextMsgNoLng = (Long) nextMsgNoBean.getValue();
+<a name="590" href="#590">590</a> 			nextMsgNo = nextMsgNoLng.longValue();
+<a name="591" href="#591">591</a> 		} <strong>else</strong> {
+<a name="592" href="#592">592</a> 			nextMsgNoBean = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SequencePropertyBean.html">SequencePropertyBean</a>();
+<a name="593" href="#593">593</a> 			nextMsgNoBean.setSequenceId(internalSequenceId);
+<a name="594" href="#594">594</a> 			nextMsgNoBean
+<a name="595" href="#595">595</a> 					.setName(Sandesha2Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);
+<a name="596" href="#596">596</a> 		}
+<a name="597" href="#597">597</a> 
+<a name="598" href="#598">598</a> 		nextMsgNoBean.setValue(<strong>new</strong> Long(nextMsgNo + 1));
+<a name="599" href="#599">599</a> 		<strong>if</strong> (update)
+<a name="600" href="#600">600</a> 			seqPropMgr.update(nextMsgNoBean);
+<a name="601" href="#601">601</a> 		<strong>else</strong>
+<a name="602" href="#602">602</a> 			seqPropMgr.insert(nextMsgNoBean);
+<a name="603" href="#603">603</a> 
+<a name="604" href="#604">604</a> 		<strong>return</strong> nextMsgNo;
+<a name="605" href="#605">605</a> 	}
+<a name="606" href="#606">606</a> 
+<a name="607" href="#607">607</a> 	<strong>public</strong> QName getName() {
+<a name="608" href="#608">608</a> 		<strong>return</strong> <strong>new</strong> QName(Sandesha2Constants.OUT_HANDLER_NAME);
+<a name="609" href="#609">609</a> 	}
+<a name="610" href="#610">610</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+

Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/package-frame.html
URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/package-frame.html?rev=349924&view=auto
==============================================================================
--- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/package-frame.html (added)
+++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/package-frame.html Wed Nov 30 03:11:01 2005
@@ -0,0 +1,35 @@
+
+
+  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+  <html lang="en">
+    <head>
+      <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></meta>
+      <title>Apache Sandesha2 0.9 Reference Package org.apache.sandesha2.handlers</title>
+      <link rel="stylesheet" href="../../../../stylesheet.css" type="text/css" title="style"></link>
+    </head>
+    <body>
+
+      <h3>
+        <a href="package-summary.html" target="classFrame">org.apache.sandesha2.handlers</a>
+      </h3>
+
+      <h3>Classes</h3>
+
+      <ul>
+        
+          <li>
+            <a href="SandeshaGlobalInHandler.html" target="classFrame">SandeshaGlobalInHandler</a>
+          </li>
+        
+          <li>
+            <a href="SandeshaInHandler.html" target="classFrame">SandeshaInHandler</a>
+          </li>
+        
+          <li>
+            <a href="SandeshaOutHandler.html" target="classFrame">SandeshaOutHandler</a>
+          </li>
+        
+      </ul>
+
+    </body>
+  </html>

Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/package-summary.html
URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/package-summary.html?rev=349924&view=auto
==============================================================================
--- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/package-summary.html (added)
+++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/handlers/package-summary.html Wed Nov 30 03:11:01 2005
@@ -0,0 +1,114 @@
+
+
+  
+
+  
+    
+
+    
+
+    
+
+  
+      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+      <html lang="en">
+        <head>
+          <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></meta>
+          <title>Apache Sandesha2 0.9 Reference Package </title>
+          <link rel="stylesheet" href="../../../../stylesheet.css" type="text/css" title="style"></link>
+        </head>
+        <body>
+
+          
+      
+      
+
+      <div class="overview">
+        <ul>
+          <li>
+            <a href="../../../../overview-summary.html">Overview</a>
+          </li>
+          <li class="selected">Package</li>
+        </ul>
+      </div>
+      <div class="framenoframe">
+        <ul>
+          <li>
+            <a href="../../../../index.html" target="_top">FRAMES</a>
+          </li>
+          <li>
+            <a href="package-summary.html" target="_top">NO FRAMES</a>
+          </li>
+        </ul>
+      </div>
+
+      
+
+    
+      
+      <h2>Package org.apache.sandesha2.handlers</h2>
+
+      <table class="summary">
+        <thead>
+          <tr>
+            <th>Class Summary</th>
+          </tr>
+        </thead>
+
+        <tbody>
+          
+            <tr>
+              <td>
+                <a href="SandeshaGlobalInHandler.html" target="classFrame">SandeshaGlobalInHandler</a>
+              </td>
+            </tr>
+          
+            <tr>
+              <td>
+                <a href="SandeshaInHandler.html" target="classFrame">SandeshaInHandler</a>
+              </td>
+            </tr>
+          
+            <tr>
+              <td>
+                <a href="SandeshaOutHandler.html" target="classFrame">SandeshaOutHandler</a>
+              </td>
+            </tr>
+          
+        </tbody>
+      </table>
+
+    
+      
+      
+
+      <div class="overview">
+        <ul>
+          <li>
+            <a href="../../../../overview-summary.html">Overview</a>
+          </li>
+          <li class="selected">Package</li>
+        </ul>
+      </div>
+      <div class="framenoframe">
+        <ul>
+          <li>
+            <a href="../../../../index.html" target="_top">FRAMES</a>
+          </li>
+          <li>
+            <a href="package-summary.html" target="_top">NO FRAMES</a>
+          </li>
+        </ul>
+      </div>
+
+      
+
+    
+    
+
+          <hr></hr>
+
+          Copyright &copy; 2005 Apache Web Services. All Rights Reserved.
+        </body>
+      </html>
+    

Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.html
URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.html?rev=349924&view=auto
==============================================================================
--- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.html (added)
+++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.html Wed Nov 30 03:11:01 2005
@@ -0,0 +1,254 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>AcknowledgementProcessor xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../apidocs/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a>   <em class="comment">/*</em>
+<a name="2" href="#2">2</a>   <em class="comment"> * Copyright 1999-2004 The Apache Software Foundation.</em>
+<a name="3" href="#3">3</a>   <em class="comment"> * </em>
+<a name="4" href="#4">4</a>   <em class="comment"> * Licensed under the Apache License, Version 2.0 (the "License"); you may not</em>
+<a name="5" href="#5">5</a>   <em class="comment"> * use this file except in compliance with the License. You may obtain a copy of</em>
+<a name="6" href="#6">6</a>   <em class="comment"> * the License at</em>
+<a name="7" href="#7">7</a>   <em class="comment"> * </em>
+<a name="8" href="#8">8</a>   <em class="comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em>
+<a name="9" href="#9">9</a>   <em class="comment"> * </em>
+<a name="10" href="#10">10</a>  <em class="comment"> * Unless required by applicable law or agreed to in writing, software</em>
+<a name="11" href="#11">11</a>  <em class="comment"> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT</em>
+<a name="12" href="#12">12</a>  <em class="comment"> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the</em>
+<a name="13" href="#13">13</a>  <em class="comment"> * License for the specific language governing permissions and limitations under</em>
+<a name="14" href="#14">14</a>  <em class="comment"> * the License.</em>
+<a name="15" href="#15">15</a>  <em class="comment"> *  </em>
+<a name="16" href="#16">16</a>  <em class="comment"> */</em>
+<a name="17" href="#17">17</a>  
+<a name="18" href="#18">18</a>  <strong>package</strong> <a href="../../../../org/apache/sandesha2/msgprocessors/package-summary.html">org.apache.sandesha2.msgprocessors</a>;
+<a name="19" href="#19">19</a>  
+<a name="20" href="#20">20</a>  <strong>import</strong> java.util.Collection;
+<a name="21" href="#21">21</a>  <strong>import</strong> java.util.Iterator;
+<a name="22" href="#22">22</a>  <strong>import</strong> javax.xml.namespace.QName;
+<a name="23" href="#23">23</a>  <strong>import</strong> org.apache.axis2.AxisFault;
+<a name="24" href="#24">24</a>  <strong>import</strong> org.apache.axis2.addressing.EndpointReference;
+<a name="25" href="#25">25</a>  <strong>import</strong> org.apache.axis2.context.AbstractContext;
+<a name="26" href="#26">26</a>  <strong>import</strong> org.apache.sandesha2.Sandesha2Constants;
+<a name="27" href="#27">27</a>  <strong>import</strong> org.apache.sandesha2.RMMsgContext;
+<a name="28" href="#28">28</a>  <strong>import</strong> org.apache.sandesha2.SandeshaException;
+<a name="29" href="#29">29</a>  <strong>import</strong> org.apache.sandesha2.storage.StorageManager;
+<a name="30" href="#30">30</a>  <strong>import</strong> org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+<a name="31" href="#31">31</a>  <strong>import</strong> org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
+<a name="32" href="#32">32</a>  <strong>import</strong> org.apache.sandesha2.storage.beans.SenderBean;
+<a name="33" href="#33">33</a>  <strong>import</strong> org.apache.sandesha2.storage.beans.SequencePropertyBean;
+<a name="34" href="#34">34</a>  <strong>import</strong> org.apache.sandesha2.util.RMMsgCreator;
+<a name="35" href="#35">35</a>  <strong>import</strong> org.apache.sandesha2.util.SandeshaUtil;
+<a name="36" href="#36">36</a>  <strong>import</strong> org.apache.sandesha2.wsrm.AcknowledgementRange;
+<a name="37" href="#37">37</a>  <strong>import</strong> org.apache.sandesha2.wsrm.Nack;
+<a name="38" href="#38">38</a>  <strong>import</strong> org.apache.sandesha2.wsrm.SequenceAcknowledgement;
+<a name="39" href="#39">39</a>  
+<a name="40" href="#40">40</a>  <em>/**<em>*</em></em>
+<a name="41" href="#41">41</a>  <em> * Responsible for processing an incoming acknowledgement message.</em>
+<a name="42" href="#42">42</a>  <em> * </em>
+<a name="43" href="#43">43</a>  <em> * @author Chamikara Jayalath &lt;chamikaramj@gmail.com></em>
+<a name="44" href="#44">44</a>  <em> */</em>
+<a name="45" href="#45">45</a>  
+<a name="46" href="#46">46</a>  <strong>public</strong> <strong>class</strong> <a href="../../../../org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.html">AcknowledgementProcessor</a> implements <a href="../../../../org/apache/sandesha2/msgprocessors/MsgProcessor.html">MsgProcessor</a> {
+<a name="47" href="#47">47</a>  
+<a name="48" href="#48">48</a>  	<strong>public</strong> <strong>void</strong> processMessage(<a href="../../../../org/apache/sandesha2/RMMsgContext.html">RMMsgContext</a> rmMsgCtx) throws SandeshaException {
+<a name="49" href="#49">49</a>  
+<a name="50" href="#50">50</a>  		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx
+<a name="51" href="#51">51</a>  				.getMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+<a name="52" href="#52">52</a>  		<strong>if</strong> (sequenceAck == <strong>null</strong>)
+<a name="53" href="#53">53</a>  			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"Sequence acknowledgement part is null"</span>);
+<a name="54" href="#54">54</a>  
+<a name="55" href="#55">55</a>  		AbstractContext context = rmMsgCtx.getContext();
+<a name="56" href="#56">56</a>  		<strong>if</strong> (context == <strong>null</strong>)
+<a name="57" href="#57">57</a>  			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"Context is null"</span>);
+<a name="58" href="#58">58</a>  
+<a name="59" href="#59">59</a>  		StorageManager storageManager = <a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="60" href="#60">60</a>  				.getSandeshaStorageManager(rmMsgCtx.getMessageContext()
+<a name="61" href="#61">61</a>  						.getSystemContext());
+<a name="62" href="#62">62</a>  		SenderBeanMgr retransmitterMgr = storageManager
+<a name="63" href="#63">63</a>  				.getRetransmitterBeanMgr();
+<a name="64" href="#64">64</a>  		SequencePropertyBeanMgr seqPropMgr = storageManager
+<a name="65" href="#65">65</a>  				.getSequencePropretyBeanMgr();
+<a name="66" href="#66">66</a>  
+<a name="67" href="#67">67</a>  		Iterator ackRangeIterator = sequenceAck.getAcknowledgementRanges()
+<a name="68" href="#68">68</a>  				.iterator();
+<a name="69" href="#69">69</a>  
+<a name="70" href="#70">70</a>  		Iterator nackIterator = sequenceAck.getNackList().iterator();
+<a name="71" href="#71">71</a>  		String outSequenceId = sequenceAck.getIdentifier().getIdentifier();
+<a name="72" href="#72">72</a>  		<strong>if</strong> (outSequenceId == <strong>null</strong> || <span class="string">""</span>.equals(outSequenceId))
+<a name="73" href="#73">73</a>  			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"OutSequenceId is null"</span>);
+<a name="74" href="#74">74</a>  
+<a name="75" href="#75">75</a>  		SequencePropertyBean internalSequenceBean = seqPropMgr.retrieve(
+<a name="76" href="#76">76</a>  				outSequenceId, Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
+<a name="77" href="#77">77</a>  
+<a name="78" href="#78">78</a>  		<strong>if</strong> (internalSequenceBean == <strong>null</strong> || internalSequenceBean.getValue() == <strong>null</strong>)
+<a name="79" href="#79">79</a>  			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"TempSequenceId is not set correctly"</span>);
+<a name="80" href="#80">80</a>  
+<a name="81" href="#81">81</a>  		String internalSequenceId = (String) internalSequenceBean.getValue();
+<a name="82" href="#82">82</a>  
+<a name="83" href="#83">83</a>  		<em class="comment">//Following happens in the SandeshaGlobal handler</em>
+<a name="84" href="#84">84</a>  		rmMsgCtx.getMessageContext()
+<a name="85" href="#85">85</a>  				.setProperty(Sandesha2Constants.ACK_PROCSSED, <span class="string">"true"</span>);
+<a name="86" href="#86">86</a>  
+<a name="87" href="#87">87</a>  		<em class="comment">//Removing relatesTo - Some WSRM endpoints tend to set relatesTo value</em>
+<a name="88" href="#88">88</a>  		<em class="comment">// for ack messages.</em>
+<a name="89" href="#89">89</a>  		<em class="comment">//Because of this dispatching may go wrong.</em>
+<a name="90" href="#90">90</a>  		<em class="comment">//So we set relatesTo value to null for ackMessages. (this happens in</em>
+<a name="91" href="#91">91</a>  		<em class="comment">// the SandeshaGlobal handler)</em>
+<a name="92" href="#92">92</a>  		<em class="comment">//Do this only if this is a standalone ACK.</em>
+<a name="93" href="#93">93</a>  		<strong>if</strong> (rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.ACK)
+<a name="94" href="#94">94</a>  			rmMsgCtx.setRelatesTo(<strong>null</strong>);
+<a name="95" href="#95">95</a>  
+<a name="96" href="#96">96</a>  		SenderBean input = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SenderBean.html">SenderBean</a>();
+<a name="97" href="#97">97</a>  		input.setInternalSequenceId(internalSequenceId);
+<a name="98" href="#98">98</a>  		Collection retransmitterEntriesOfSequence = retransmitterMgr
+<a name="99" href="#99">99</a>  				.find(input);
+<a name="100" href="#100">100</a> 
+<a name="101" href="#101">101</a> 		<strong>while</strong> (ackRangeIterator.hasNext()) {
+<a name="102" href="#102">102</a> 			AcknowledgementRange ackRange = (AcknowledgementRange) ackRangeIterator
+<a name="103" href="#103">103</a> 					.next();
+<a name="104" href="#104">104</a> 			<strong>long</strong> lower = ackRange.getLowerValue();
+<a name="105" href="#105">105</a> 			<strong>long</strong> upper = ackRange.getUpperValue();
+<a name="106" href="#106">106</a> 
+<a name="107" href="#107">107</a> 			<strong>for</strong> (<strong>long</strong> messageNo = lower; messageNo &lt;= upper; messageNo++) {
+<a name="108" href="#108">108</a> 				SenderBean retransmitterBean = getRetransmitterEntry(
+<a name="109" href="#109">109</a> 						retransmitterEntriesOfSequence, messageNo);
+<a name="110" href="#110">110</a> 				<strong>if</strong> (retransmitterBean != <strong>null</strong>)
+<a name="111" href="#111">111</a> 					retransmitterMgr.delete(retransmitterBean.getMessageId());
+<a name="112" href="#112">112</a> 			}
+<a name="113" href="#113">113</a> 		}
+<a name="114" href="#114">114</a> 
+<a name="115" href="#115">115</a> 		<strong>while</strong> (nackIterator.hasNext()) {
+<a name="116" href="#116">116</a> 			Nack nack = (Nack) nackIterator.next();
+<a name="117" href="#117">117</a> 			<strong>long</strong> msgNo = nack.getNackNumber();
+<a name="118" href="#118">118</a> 
+<a name="119" href="#119">119</a> 			<em class="comment">//TODO - Process Nack</em>
+<a name="120" href="#120">120</a> 		}
+<a name="121" href="#121">121</a> 
+<a name="122" href="#122">122</a> 		<em class="comment">//following get called in the SandesaInHandler</em>
+<a name="123" href="#123">123</a> 		<em class="comment">//if (justSendTerminateIfNeeded) {</em>
+<a name="124" href="#124">124</a> 		<em class="comment">//If all messages up to last message have been acknowledged.</em>
+<a name="125" href="#125">125</a> 		<em class="comment">//Add terminate Sequence message.</em>
+<a name="126" href="#126">126</a> 		SequencePropertyBean lastOutMsgBean = seqPropMgr.retrieve(
+<a name="127" href="#127">127</a> 				internalSequenceId, Sandesha2Constants.SequenceProperties.LAST_OUT_MESSAGE);
+<a name="128" href="#128">128</a> 		<strong>if</strong> (lastOutMsgBean != <strong>null</strong>) {
+<a name="129" href="#129">129</a> 			Long lastOutMsgNoLng = (Long) lastOutMsgBean.getValue();
+<a name="130" href="#130">130</a> 			<strong>if</strong> (lastOutMsgNoLng == <strong>null</strong>)
+<a name="131" href="#131">131</a> 				<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(
+<a name="132" href="#132">132</a> 						<span class="string">"Invalid object set for the Last Out Message"</span>);
+<a name="133" href="#133">133</a> 
+<a name="134" href="#134">134</a> 			<strong>long</strong> lastOutMessageNo = lastOutMsgNoLng.<strong>long</strong>Value();
+<a name="135" href="#135">135</a> 			<strong>if</strong> (lastOutMessageNo &lt;= 0)
+<a name="136" href="#136">136</a> 				<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(
+<a name="137" href="#137">137</a> 						<span class="string">"Invalid value set for the last out message"</span>);
+<a name="138" href="#138">138</a> 
+<a name="139" href="#139">139</a> 			<strong>boolean</strong> complete = SandeshaUtil.verifySequenceCompletion(
+<a name="140" href="#140">140</a> 					sequenceAck.getAcknowledgementRanges().iterator(),
+<a name="141" href="#141">141</a> 					lastOutMessageNo);
+<a name="142" href="#142">142</a> 
+<a name="143" href="#143">143</a> 			<strong>if</strong> (complete) {
+<a name="144" href="#144">144</a> 				addTerminateSequenceMessage(rmMsgCtx, outSequenceId,
+<a name="145" href="#145">145</a> 						internalSequenceId);
+<a name="146" href="#146">146</a> 			}
+<a name="147" href="#147">147</a> 
+<a name="148" href="#148">148</a> 			<em class="comment">//stopping the progress of the message further.</em>
+<a name="149" href="#149">149</a> 			rmMsgCtx.getMessageContext().setPausedTrue(
+<a name="150" href="#150">150</a> 					<strong>new</strong> QName(Sandesha2Constants.IN_HANDLER_NAME));
+<a name="151" href="#151">151</a> 		}
+<a name="152" href="#152">152</a> 	}
+<a name="153" href="#153">153</a> 
+<a name="154" href="#154">154</a> 	<strong>private</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SenderBean.html">SenderBean</a> getRetransmitterEntry(Collection collection,
+<a name="155" href="#155">155</a> 			<strong>long</strong> msgNo) {
+<a name="156" href="#156">156</a> 		Iterator it = collection.iterator();
+<a name="157" href="#157">157</a> 		<strong>while</strong> (it.hasNext()) {
+<a name="158" href="#158">158</a> 			SenderBean bean = (SenderBean) it.next();
+<a name="159" href="#159">159</a> 			<strong>if</strong> (bean.getMessageNumber() == msgNo)
+<a name="160" href="#160">160</a> 				<strong>return</strong> bean;
+<a name="161" href="#161">161</a> 		}
+<a name="162" href="#162">162</a> 
+<a name="163" href="#163">163</a> 		<strong>return</strong> <strong>null</strong>;
+<a name="164" href="#164">164</a> 	}
+<a name="165" href="#165">165</a> 
+<a name="166" href="#166">166</a> 	<strong>public</strong> <strong>void</strong> addTerminateSequenceMessage(<a href="../../../../org/apache/sandesha2/RMMsgContext.html">RMMsgContext</a> incomingAckRMMsg,
+<a name="167" href="#167">167</a> 			String outSequenceId, String internalSequenceId)
+<a name="168" href="#168">168</a> 			throws <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a> {
+<a name="169" href="#169">169</a> 
+<a name="170" href="#170">170</a> 		StorageManager storageManager = <a href="../../../../org/apache/sandesha2/util/SandeshaUtil.html">SandeshaUtil</a>
+<a name="171" href="#171">171</a> 				.getSandeshaStorageManager(incomingAckRMMsg.getMessageContext()
+<a name="172" href="#172">172</a> 						.getSystemContext());
+<a name="173" href="#173">173</a> 
+<a name="174" href="#174">174</a> 		SequencePropertyBeanMgr seqPropMgr = storageManager
+<a name="175" href="#175">175</a> 				.getSequencePropretyBeanMgr();
+<a name="176" href="#176">176</a> 
+<a name="177" href="#177">177</a> 		SequencePropertyBean terminated = seqPropMgr.retrieve(outSequenceId,
+<a name="178" href="#178">178</a> 				Sandesha2Constants.SequenceProperties.TERMINATE_ADDED);
+<a name="179" href="#179">179</a> 
+<a name="180" href="#180">180</a> 		<strong>if</strong> (terminated != <strong>null</strong> &amp;&amp; terminated.getValue() != <strong>null</strong>
+<a name="181" href="#181">181</a> 				&amp;&amp; <span class="string">"true"</span>.equals(terminated.getValue())) {
+<a name="182" href="#182">182</a> 			System.out.println(<span class="string">"TERMINATE WAS ADDED PREVIOUSLY...."</span>);
+<a name="183" href="#183">183</a> 			<strong>return</strong>;
+<a name="184" href="#184">184</a> 		}
+<a name="185" href="#185">185</a> 
+<a name="186" href="#186">186</a> 		RMMsgContext terminateRMMessage = <a href="../../../../org/apache/sandesha2/util/RMMsgCreator.html">RMMsgCreator</a>
+<a name="187" href="#187">187</a> 				.createTerminateSequenceMessage(incomingAckRMMsg, outSequenceId);
+<a name="188" href="#188">188</a> 
+<a name="189" href="#189">189</a> 		SequencePropertyBean toBean = seqPropMgr.retrieve(internalSequenceId,
+<a name="190" href="#190">190</a> 				Sandesha2Constants.SequenceProperties.TO_EPR);
+<a name="191" href="#191">191</a> 
+<a name="192" href="#192">192</a> 		EndpointReference toEPR = (EndpointReference) toBean.getValue();
+<a name="193" href="#193">193</a> 		<strong>if</strong> (toEPR == <strong>null</strong>)
+<a name="194" href="#194">194</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(<span class="string">"To EPR has an invalid value"</span>);
+<a name="195" href="#195">195</a> 
+<a name="196" href="#196">196</a> 		terminateRMMessage.setTo(<strong>new</strong> EndpointReference(toEPR.getAddress()));
+<a name="197" href="#197">197</a> 		terminateRMMessage.setFrom(<strong>new</strong> EndpointReference(
+<a name="198" href="#198">198</a> 				Sandesha2Constants.WSA.NS_URI_ANONYMOUS));
+<a name="199" href="#199">199</a> 		terminateRMMessage.setFaultTo(<strong>new</strong> EndpointReference(
+<a name="200" href="#200">200</a> 				Sandesha2Constants.WSA.NS_URI_ANONYMOUS));
+<a name="201" href="#201">201</a> 		terminateRMMessage
+<a name="202" href="#202">202</a> 				.setWSAAction(Sandesha2Constants.WSRM.Actions.ACTION_TERMINATE_SEQUENCE);
+<a name="203" href="#203">203</a> 		terminateRMMessage
+<a name="204" href="#204">204</a> 				.setSOAPAction(Sandesha2Constants.WSRM.Actions.SOAP_ACTION_TERMINATE_SEQUENCE);
+<a name="205" href="#205">205</a> 
+<a name="206" href="#206">206</a> 		<strong>try</strong> {
+<a name="207" href="#207">207</a> 			terminateRMMessage.addSOAPEnvelope();
+<a name="208" href="#208">208</a> 		} <strong>catch</strong> (AxisFault e) {
+<a name="209" href="#209">209</a> 			<strong>throw</strong> <strong>new</strong> <a href="../../../../org/apache/sandesha2/SandeshaException.html">SandeshaException</a>(e.getMessage());
+<a name="210" href="#210">210</a> 		}
+<a name="211" href="#211">211</a> 
+<a name="212" href="#212">212</a> 		String key = SandeshaUtil.storeMessageContext(terminateRMMessage
+<a name="213" href="#213">213</a> 				.getMessageContext());
+<a name="214" href="#214">214</a> 		SenderBean terminateBean = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SenderBean.html">SenderBean</a>();
+<a name="215" href="#215">215</a> 		terminateBean.setKey(key);
+<a name="216" href="#216">216</a> 
+<a name="217" href="#217">217</a> 		<em class="comment">//Set a retransmitter lastSentTime so that terminate will be send with</em>
+<a name="218" href="#218">218</a> 		<em class="comment">// some delay.</em>
+<a name="219" href="#219">219</a> 		<em class="comment">//Otherwise this get send before return of the current request (ack).</em>
+<a name="220" href="#220">220</a> 		terminateBean.setTimeToSend(System.currentTimeMillis()
+<a name="221" href="#221">221</a> 				+ Sandesha2Constants.TERMINATE_DELAY);
+<a name="222" href="#222">222</a> 
+<a name="223" href="#223">223</a> 		terminateBean.setMessageId(terminateRMMessage.getMessageId());
+<a name="224" href="#224">224</a> 		terminateBean.setSend(<strong>true</strong>);
+<a name="225" href="#225">225</a> 		terminateBean.setReSend(false);
+<a name="226" href="#226">226</a> 
+<a name="227" href="#227">227</a> 		SenderBeanMgr retramsmitterMgr = storageManager
+<a name="228" href="#228">228</a> 				.getRetransmitterBeanMgr();
+<a name="229" href="#229">229</a> 
+<a name="230" href="#230">230</a> 		SequencePropertyBean terminateAdded = <strong>new</strong> <a href="../../../../org/apache/sandesha2/storage/beans/SequencePropertyBean.html">SequencePropertyBean</a>();
+<a name="231" href="#231">231</a> 		terminateAdded.setName(Sandesha2Constants.SequenceProperties.TERMINATE_ADDED);
+<a name="232" href="#232">232</a> 		terminateAdded.setSequenceId(outSequenceId);
+<a name="233" href="#233">233</a> 		terminateAdded.setValue(<span class="string">"true"</span>);
+<a name="234" href="#234">234</a> 
+<a name="235" href="#235">235</a> 		seqPropMgr.insert(terminateAdded);
+<a name="236" href="#236">236</a> 
+<a name="237" href="#237">237</a> 		retramsmitterMgr.insert(terminateBean);
+<a name="238" href="#238">238</a> 
+<a name="239" href="#239">239</a> 	}
+<a name="240" href="#240">240</a> 
+<a name="241" href="#241">241</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+



Mime
View raw message