Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/Sender.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/Sender.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/Sender.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/Sender.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,279 @@ + + + +Sender xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 1999-2004 The Apache Software Foundation.
+3    * 
+4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+5    * use this file except in compliance with the License. You may obtain a copy of
+6    * the License at
+7    * 
+8    * http://www.apache.org/licenses/LICENSE-2.0
+9    * 
+10   * Unless required by applicable law or agreed to in writing, software
+11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+13   * License for the specific language governing permissions and limitations under
+14   * the License.
+15   *  
+16   */
+17  package org.apache.sandesha2.workers;
+18  
+19  import java.util.Collection;
+20  import java.util.Iterator;
+21  import org.apache.axis2.AxisFault;
+22  import org.apache.axis2.context.ConfigurationContext;
+23  import org.apache.axis2.context.MessageContext;
+24  import org.apache.axis2.context.ServiceContext;
+25  import org.apache.axis2.engine.AxisEngine;
+26  import org.apache.axis2.soap.SOAPEnvelope;
+27  import org.apache.sandesha2.AcknowledgementManager;
+28  import org.apache.sandesha2.Sandesha2Constants;
+29  import org.apache.sandesha2.RMMsgContext;
+30  import org.apache.sandesha2.SandeshaException;
+31  import org.apache.sandesha2.TerminateManager;
+32  import org.apache.sandesha2.Sandesha2Constants.ClientAPI;
+33  import org.apache.sandesha2.storage.StorageManager;
+34  import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+35  import org.apache.sandesha2.storage.beans.SenderBean;
+36  import org.apache.sandesha2.util.MessageRetransmissionAdjuster;
+37  import org.apache.sandesha2.util.MsgInitializer;
+38  import org.apache.sandesha2.util.SandeshaUtil;
+39  import org.apache.sandesha2.wsrm.TerminateSequence;
+40  
+41  /***
+42   * This is responsible for sending and re-sending messages of Sandesha2. This represent a thread that keep running all
+43   * the time. This keep looking at the Sender table to find out any entries that should be sent.
+44   * 
+45   * @author Chamikara Jayalath <chamikaramj@gmail.com>
+46   */
+47  
+48  public class Sender extends Thread {
+49  
+50  	private boolean senderStarted = false;
+51  
+52  	private ConfigurationContext context = null;
+53  
+54  	public synchronized void stopSender() {
+55  		senderStarted = false;
+56  	}
+57  
+58  	public synchronized boolean isSenderStarted() {
+59  		return senderStarted;
+60  	}
+61  
+62  	public void run() {
+63  
+64  		while (senderStarted) {
+65  			try {
+66  				if (context == null)
+67  					throw new SandeshaException(
+68  							"Can't continue the Sender. Context is null");
+69  
+70  				StorageManager storageManager = SandeshaUtil
+71  						.getSandeshaStorageManager(context);
+72  
+73  				SenderBeanMgr mgr = storageManager
+74  						.getRetransmitterBeanMgr();
+75  				Collection coll = mgr.findMsgsToSend();
+76  				Iterator iter = coll.iterator();
+77  
+78  				while (iter.hasNext()) {
+79  
+80  					SenderBean bean = (SenderBean) iter.next();
+81  					String key = (String) bean.getKey();
+82  					MessageContext msgCtx = SandeshaUtil
+83  							.getStoredMessageContext(key);
+84  
+85  					try {
+86  						RMMsgContext rmMsgCtx = MsgInitializer
+87  								.initializeMessage(msgCtx);
+88  
+89  						updateMessage(msgCtx);
+90  
+91  						ServiceContext serviceContext = msgCtx
+92  								.getServiceContext();
+93  						Object debug = null;
+94  						if (serviceContext != null) {
+95  							debug = serviceContext
+96  									.getProperty(ClientAPI.SANDESHA_DEBUG_MODE);
+97  							if (debug != null && "on".equals(debug)) {
+98  								System.out
+99  										.println("DEBUG: Sender is sending a '"
+100 												+ SandeshaUtil
+101 														.getMessageTypeString(rmMsgCtx
+102 																.getMessageType())
+103 												+ "' message.");
+104 							}
+105 						}
+106 
+107 						if (rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.APPLICATION) {
+108 							//piggybacking if an ack if available for the same
+109 							// sequence.
+110 							AcknowledgementManager
+111 									.piggybackAckIfPresent(rmMsgCtx);
+112 						}
+113 
+114 						try {
+115 							new AxisEngine(context).send(msgCtx);
+116 						} catch (Exception e) {
+117 							//Exception is sending. retry later
+118 							System.out
+119 									.println("Exception thrown in sending...");
+120 							e.printStackTrace();
+121 						}
+122 
+123 						MessageRetransmissionAdjuster retransmitterAdjuster = new MessageRetransmissionAdjuster();
+124 						retransmitterAdjuster.adjustRetransmittion(bean);
+125 
+126 						mgr.update(bean);
+127 
+128 						if (!msgCtx.isServerSide())
+129 							checkForSyncResponses(msgCtx);
+130 						
+131 						
+132 						if (rmMsgCtx.getMessageType()==Sandesha2Constants.MessageTypes.TERMINATE_SEQ) {
+133 							//terminate sending side.
+134 							TerminateSequence terminateSequence = (TerminateSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
+135 							String sequenceID = terminateSequence.getIdentifier().getIdentifier();
+136 							ConfigurationContext configContext = msgCtx.getSystemContext();
+137 							
+138 							TerminateManager.terminateSendingSide(configContext,sequenceID);
+139 						}
+140 
+141 					} catch (AxisFault e1) {
+142 						e1.printStackTrace();
+143 					} catch (Exception e3) {
+144 						e3.printStackTrace();
+145 					}
+146 
+147 					//changing the values of the sent bean.
+148 					//bean.setLastSentTime(System.currentTimeMillis());
+149 					//bean.setSentCount(bean.getSentCount() + 1);
+150 
+151 					//update if resend=true otherwise delete. (reSend=false
+152 					// means
+153 					// send only once).
+154 					if (bean.isReSend())
+155 						mgr.update(bean);
+156 					else
+157 						mgr.delete(bean.getMessageId());
+158 
+159 				}
+160 			} catch (SandeshaException e) {
+161 				e.printStackTrace();
+162 				return;
+163 			}
+164 
+165 			try {
+166 				Thread.sleep(2000);
+167 			} catch (InterruptedException e1) {
+168 				//e1.printStackTrace();
+169 				System.out.println("Sender was interupted...");
+170 				e1.printStackTrace();
+171 				System.out.println("End printing Interrupt...");
+172 			}
+173 		}
+174 
+175 	}
+176 
+177 	private boolean isResponseExpected(RMMsgContext rmMsgCtx) {
+178 		boolean responseExpected = false;
+179 
+180 		if (rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.CREATE_SEQ) {
+181 			responseExpected = true;
+182 		}
+183 		if (rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.APPLICATION) {
+184 			//a ack may arrive. (not a application response)
+185 			if (rmMsgCtx.getMessageContext().getAxisOperation()
+186 					.getMessageExchangePattern().equals(
+187 							org.apache.wsdl.WSDLConstants.MEP_URI_IN_OUT)) {
+188 				responseExpected = true;
+189 			}
+190 		}
+191 
+192 		return true;
+193 	}
+194 
+195 	public void start(ConfigurationContext context) {
+196 		senderStarted = true;
+197 		this.context = context;
+198 		super.start();
+199 	}
+200 
+201 	private void updateMessage(MessageContext msgCtx1) throws SandeshaException {
+202 		try {
+203 			RMMsgContext rmMsgCtx1 = MsgInitializer.initializeMessage(msgCtx1);
+204 			rmMsgCtx1.addSOAPEnvelope();
+205 
+206 		} catch (AxisFault e) {
+207 			throw new SandeshaException("Exception in updating contexts");
+208 		}
+209 
+210 	}
+211 
+212 	private void checkForSyncResponses(MessageContext msgCtx) throws AxisFault {
+213 
+214 		boolean responsePresent = (msgCtx
+215 				.getProperty(MessageContext.TRANSPORT_IN) != null);
+216 
+217 		if (responsePresent) {
+218 			//create the response
+219 			MessageContext response = new MessageContext(msgCtx
+220 					.getSystemContext(), msgCtx.getSessionContext(), msgCtx
+221 					.getTransportIn(), msgCtx.getTransportOut());
+222 			response.setProperty(MessageContext.TRANSPORT_IN, msgCtx
+223 					.getProperty(MessageContext.TRANSPORT_IN));
+224 
+225 			response.setServerSide(false);
+226 
+227 			//If request is REST we assume the response is REST, so set the
+228 			// variable
+229 			response.setDoingREST(msgCtx.isDoingREST());
+230 			response
+231 					.setServiceGroupContextId(msgCtx.getServiceGroupContextId());
+232 			response.setServiceGroupContext(msgCtx.getServiceGroupContext());
+233 			response.setServiceContext(msgCtx.getServiceContext());
+234 			response.setAxisService(msgCtx.getAxisService());
+235 			response.setAxisServiceGroup(msgCtx.getAxisServiceGroup());
+236 
+237 			//setting the in-flow.
+238 			//ArrayList inPhaseHandlers =
+239 			// response.getAxisOperation().getRemainingPhasesInFlow();
+240 			/*
+241 			 * if (inPhaseHandlers==null || inPhaseHandlers.isEmpty()) {
+242 			 * ArrayList phases =
+243 			 * msgCtx.getSystemContext().getAxisConfiguration().getInPhasesUptoAndIncludingPostDispatch();
+244 			 * response.getAxisOperation().setRemainingPhasesInFlow(phases); }
+245 			 */
+246 
+247 			//Changed following from TransportUtils to SandeshaUtil since op.
+248 			// context is anavailable.
+249 			SOAPEnvelope resenvelope = null;
+250 			try {
+251 				resenvelope = SandeshaUtil.createSOAPMessage(response, msgCtx
+252 						.getEnvelope().getNamespace().getName());
+253 			} catch (AxisFault e) {
+254 				//TODO: change to log.debug
+255 				e.printStackTrace();
+256 			}
+257 
+258 			if (resenvelope != null) {
+259 				AxisEngine engine = new AxisEngine(msgCtx.getSystemContext());
+260 				response.setEnvelope(resenvelope);
+261 				engine.receive(response);
+262 			}
+263 		}
+264 	}
+265 
+266 }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/package-frame.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/package-frame.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/package-frame.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/package-frame.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,31 @@ + + + + + + + Apache Sandesha2 0.9 Reference Package org.apache.sandesha2.workers + + + + +

+ org.apache.sandesha2.workers +

+ +

Classes

+ + + + + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/package-summary.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/package-summary.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/package-summary.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/workers/package-summary.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + Apache Sandesha2 0.9 Reference Package + + + + + + + + +
+ +
+
+ +
+ + + + + +

Package org.apache.sandesha2.workers

+ + + + + + + + + + + + + + + + + + + +
Class Summary
+ InOrderInvoker +
+ Sender +
+ + + + + +
+ +
+
+ +
+ + + + + + +
+ + Copyright © 2005 Apache Web Services. All Rights Reserved. + + + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/Accept.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/Accept.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/Accept.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/Accept.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,110 @@ + + + +Accept xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright  1999-2004 The Apache Software Foundation.
+3    *
+4    *  Licensed under the Apache License, Version 2.0 (the "License");
+5    *  you may not use this file except in compliance with the License.
+6    *  You may obtain a copy of the License at
+7    *
+8    *      http://www.apache.org/licenses/LICENSE-2.0
+9    *
+10   *  Unless required by applicable law or agreed to in writing, software
+11   *  distributed under the License is distributed on an "AS IS" BASIS,
+12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+13   *  See the License for the specific language governing permissions and
+14   *  limitations under the License.
+15   *
+16   */
+17  package org.apache.sandesha2.wsrm;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.apache.axis2.om.OMElement;
+22  import org.apache.axis2.om.OMException;
+23  import org.apache.axis2.om.OMNamespace;
+24  import org.apache.axis2.soap.SOAPFactory;
+25  import org.apache.sandesha2.Sandesha2Constants;
+26  
+27  /***
+28   * @author Chamikara Jayalath <chamikaramj@gmail.com>
+29   * @author Sanka Samaranayaka <ssanka@gmail.com>
+30   * @author Saminda Abeyruwan  <saminda@opensource.lk>
+31   */
+32  
+33  public class Accept implements IOMRMElement {
+34  	private OMElement acceptElement;
+35  
+36  	private AcksTo acksTo;
+37  	
+38  	private SOAPFactory factory;
+39  
+40  	OMNamespace rmNamespace = null; 
+41  
+42  	public Accept(SOAPFactory factory) {
+43  		this.factory = factory;
+44  		rmNamespace = factory.createOMNamespace(
+45  				Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.NS_PREFIX_RM);
+46  		acceptElement = factory.createOMElement(
+47  				Sandesha2Constants.WSRM.ACCEPT, rmNamespace);
+48  	}
+49  
+50  	public OMElement getOMElement() throws OMException {
+51  		return acceptElement;
+52  	}
+53  
+54  	public Object fromOMElement(OMElement element) throws OMException {
+55  
+56  		OMElement acceptPart = element.getFirstChildWithName(new QName(
+57  				Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.ACCEPT));
+58  		if (acceptPart == null)
+59  			throw new OMException(
+60  					"Passed element does not contain an Accept part");
+61  
+62  		acksTo = new AcksTo(factory);
+63  		acksTo.fromOMElement(acceptPart);
+64  
+65  		acceptElement = factory.createOMElement(
+66  				Sandesha2Constants.WSRM.ACCEPT, rmNamespace);
+67  
+68  		return this;
+69  	}
+70  
+71  	public OMElement toOMElement(OMElement element) throws OMException {
+72  
+73  		if (acceptElement == null)
+74  			throw new OMException(
+75  					"Cant add Accept part since the internal element is null");
+76  
+77  		if (acksTo == null)
+78  			throw new OMException(
+79  					"Cant add Accept part since AcksTo object is null");
+80  
+81  		acksTo.toOMElement(acceptElement);
+82  		element.addChild(acceptElement);
+83  
+84  		acceptElement = factory.createOMElement(
+85  				Sandesha2Constants.WSRM.ACCEPT, rmNamespace);
+86  
+87  		return element;
+88  	}
+89  
+90  	public void setAcksTo(AcksTo acksTo) {
+91  		this.acksTo = acksTo;
+92  	}
+93  
+94  	public AcksTo getAcksTo() {
+95  		return acksTo;
+96  	}
+97  }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AckRequested.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AckRequested.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AckRequested.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AckRequested.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,159 @@ + + + +AckRequested xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright  1999-2004 The Apache Software Foundation.
+3    *
+4    *  Licensed under the Apache License, Version 2.0 (the "License");
+5    *  you may not use this file except in compliance with the License.
+6    *  You may obtain a copy of the License at
+7    *
+8    *      http://www.apache.org/licenses/LICENSE-2.0
+9    *
+10   *  Unless required by applicable law or agreed to in writing, software
+11   *  distributed under the License is distributed on an "AS IS" BASIS,
+12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+13   *  See the License for the specific language governing permissions and
+14   *  limitations under the License.
+15   *
+16   */
+17  package org.apache.sandesha2.wsrm;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.apache.axis2.om.OMElement;
+22  import org.apache.axis2.om.OMException;
+23  import org.apache.axis2.om.OMNamespace;
+24  import org.apache.axis2.soap.SOAPEnvelope;
+25  import org.apache.axis2.soap.SOAPFactory;
+26  import org.apache.axis2.soap.SOAPHeader;
+27  import org.apache.axis2.soap.SOAPHeaderBlock;
+28  import org.apache.sandesha2.Sandesha2Constants;
+29  
+30  /***
+31   * Represent the AckRequested header block.
+32   * 
+33   * @author Chamikara Jayalath <chamikaramj@gmail.com>
+34   * @author Sanka Samaranayaka <ssanka@gmail.com>
+35   * @author Saminda Abeyruwan  <saminda@opensource.lk>
+36   */
+37  
+38  public class AckRequested implements IOMRMPart {
+39  	private OMElement ackRequestedElement;
+40  
+41  	private Identifier identifier;
+42  
+43  	private MessageNumber messageNumber;
+44  	
+45  	private SOAPFactory factory;
+46  
+47  	OMNamespace rmNamespace = null;
+48  
+49  	public AckRequested(SOAPFactory factory) {
+50  		this.factory = factory;
+51  		rmNamespace = factory.createOMNamespace(
+52  				Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.NS_PREFIX_RM);
+53  		ackRequestedElement = factory.createOMElement(
+54  				Sandesha2Constants.WSRM.ACK_REQUESTED, rmNamespace);
+55  	}
+56  
+57  	public OMElement getOMElement() throws OMException {
+58  		return ackRequestedElement;
+59  	}
+60  
+61  	public Object fromOMElement(OMElement header) throws OMException {
+62  
+63  		if (header == null || !(header instanceof SOAPHeader))
+64  			throw new OMException(
+65  					"Cant add the Ack Requested part to a non-header element");
+66  
+67  		OMElement ackReqPart = header.getFirstChildWithName(new QName(
+68  				Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.ACK_REQUESTED));
+69  
+70  		if (ackReqPart == null)
+71  			throw new OMException(
+72  					"the passed element does not contain an ack requested part");
+73  
+74  		identifier = new Identifier(factory);
+75  		identifier.fromOMElement(ackReqPart);
+76  
+77  		OMElement msgNoPart = ackReqPart.getFirstChildWithName(new QName(
+78  				Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.MSG_NUMBER));
+79  
+80  		if (msgNoPart != null) {
+81  			messageNumber = new MessageNumber(factory);
+82  			messageNumber.fromOMElement(ackReqPart);
+83  		}
+84  
+85  		ackRequestedElement = factory.createOMElement(
+86  				Sandesha2Constants.WSRM.ACK_REQUESTED, rmNamespace);
+87  
+88  		return this;
+89  	}
+90  
+91  	public OMElement toOMElement(OMElement header) throws OMException {
+92  
+93  		if (header == null || !(header instanceof SOAPHeader))
+94  			throw new OMException(
+95  					"Cant add the Ack Requested part to a non-header element");
+96  
+97  		if (identifier == null)
+98  			throw new OMException(
+99  					"Cant add ack Req block since the identifier is null");
+100 
+101 		SOAPHeader SOAPHdr = (SOAPHeader) header;
+102 		SOAPHeaderBlock ackReqHdrBlock = SOAPHdr.addHeaderBlock(
+103 				Sandesha2Constants.WSRM.ACK_REQUESTED, rmNamespace);
+104 		ackReqHdrBlock.setMustUnderstand(true);
+105 
+106 		identifier.toOMElement(ackReqHdrBlock);
+107 
+108 		if (messageNumber != null) {
+109 			messageNumber.toOMElement(ackReqHdrBlock);
+110 		}
+111 
+112 		ackRequestedElement = factory.createOMElement(
+113 				Sandesha2Constants.WSRM.ACK_REQUESTED, rmNamespace);
+114 
+115 		return header;
+116 	}
+117 
+118 	public void setIdentifier(Identifier identifier) {
+119 		this.identifier = identifier;
+120 	}
+121 
+122 	public void setMessageNumber(MessageNumber messageNumber) {
+123 		this.messageNumber = messageNumber;
+124 	}
+125 
+126 	public Identifier getIdentifier() {
+127 		return identifier;
+128 	}
+129 
+130 	public MessageNumber getMessageNumber() {
+131 		return messageNumber;
+132 	}
+133 
+134 	public void toSOAPEnvelope(SOAPEnvelope envelope) {
+135 		SOAPHeader header = envelope.getHeader();
+136 		
+137 		//detach if already exist.
+138 		OMElement elem = header.getFirstChildWithName(new QName(Sandesha2Constants.WSRM.NS_URI_RM,
+139 				Sandesha2Constants.WSRM.ACK_REQUESTED));
+140 		if (elem!=null)
+141 			elem.detach();
+142 		
+143 		toOMElement(header);
+144 	}
+145 
+146 }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AcknowledgementRange.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AcknowledgementRange.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AcknowledgementRange.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AcknowledgementRange.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,142 @@ + + + +AcknowledgementRange xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright  1999-2004 The Apache Software Foundation.
+3    *
+4    *  Licensed under the Apache License, Version 2.0 (the "License");
+5    *  you may not use this file except in compliance with the License.
+6    *  You may obtain a copy of the License at
+7    *
+8    *      http://www.apache.org/licenses/LICENSE-2.0
+9    *
+10   *  Unless required by applicable law or agreed to in writing, software
+11   *  distributed under the License is distributed on an "AS IS" BASIS,
+12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+13   *  See the License for the specific language governing permissions and
+14   *  limitations under the License.
+15   *
+16   */
+17  package org.apache.sandesha2.wsrm;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.apache.axis2.om.OMAttribute;
+22  import org.apache.axis2.om.OMElement;
+23  import org.apache.axis2.om.OMException;
+24  import org.apache.axis2.om.OMNamespace;
+25  import org.apache.axis2.soap.SOAPFactory;
+26  import org.apache.sandesha2.Sandesha2Constants;
+27  
+28  /***
+29   * @author Chamikara Jayalath <chamikaramj@gmail.com>
+30   * @author Sanka Samaranayaka <ssanka@gmail.com>
+31   * @author Saminda Abeyruwan  <saminda@opensource.lk>
+32   */
+33  
+34  public class AcknowledgementRange implements IOMRMElement {
+35  	private OMElement acknowledgementRangeElement;
+36  
+37  	private long upperValue;
+38  
+39  	private long lowerValue;
+40  	
+41  	private SOAPFactory factory;
+42  
+43  	OMNamespace rmNamespace = null;
+44  
+45  	public AcknowledgementRange(SOAPFactory factory) {
+46  		this.factory = factory;
+47  		rmNamespace = factory.createOMNamespace(
+48  				Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.NS_PREFIX_RM);
+49  		acknowledgementRangeElement = factory.createOMElement(
+50  				Sandesha2Constants.WSRM.ACK_RANGE, rmNamespace);
+51  	}
+52  
+53  	public OMElement getOMElement() throws OMException {
+54  		return acknowledgementRangeElement;
+55  	}
+56  
+57  	public Object fromOMElement(OMElement ackRangePart) throws OMException {
+58  
+59  		if (ackRangePart == null)
+60  			throw new OMException("The passed element is null");
+61  
+62  		OMAttribute lowerAttrib = ackRangePart.getAttribute(new QName(
+63  				Sandesha2Constants.WSRM.LOWER));
+64  		OMAttribute upperAttrib = ackRangePart.getAttribute(new QName(
+65  				Sandesha2Constants.WSRM.UPPER));
+66  
+67  		if (lowerAttrib == null || upperAttrib == null)
+68  			throw new OMException(
+69  					"Passed element does not contain upper or lower attributes");
+70  
+71  		try {
+72  			long lower = Long.parseLong(lowerAttrib.getAttributeValue());
+73  			long upper = Long.parseLong(upperAttrib.getAttributeValue());
+74  			upperValue = upper;
+75  			lowerValue = lower;
+76  		} catch (Exception ex) {
+77  			throw new OMException(
+78  					"The ack range does not have proper long values for Upper and Lower attributes");
+79  		}
+80  
+81  		acknowledgementRangeElement = factory.createOMElement(
+82  				Sandesha2Constants.WSRM.ACK_RANGE, rmNamespace);
+83  
+84  		return this;
+85  	}
+86  
+87  	public OMElement toOMElement(OMElement sequenceAckElement)
+88  			throws OMException {
+89  
+90  		if (sequenceAckElement == null)
+91  			throw new OMException(
+92  					"Cant set Ack Range part since element is null");
+93  
+94  		if (upperValue <= 0 || lowerValue <= 0 || lowerValue > upperValue)
+95  			throw new OMException(
+96  					"Cant set Ack Range part since Upper or Lower is not set to the correct value");
+97  
+98  		OMAttribute lowerAttrib = factory.createOMAttribute(
+99  				Sandesha2Constants.WSRM.LOWER, null, Long.toString(lowerValue));
+100 		OMAttribute upperAttrib = factory.createOMAttribute(
+101 				Sandesha2Constants.WSRM.UPPER, null, Long.toString(upperValue));
+102 
+103 		acknowledgementRangeElement.addAttribute(lowerAttrib);
+104 		acknowledgementRangeElement.addAttribute(upperAttrib);
+105 
+106 		sequenceAckElement.addChild(acknowledgementRangeElement);
+107 
+108 		acknowledgementRangeElement = factory.createOMElement(
+109 				Sandesha2Constants.WSRM.ACK_RANGE, rmNamespace);
+110 
+111 		return sequenceAckElement;
+112 	}
+113 
+114 	public long getLowerValue() {
+115 		return lowerValue;
+116 	}
+117 
+118 	public void setLowerValue(long lowerValue) {
+119 		this.lowerValue = lowerValue;
+120 	}
+121 
+122 	public long getUpperValue() {
+123 		return upperValue;
+124 	}
+125 
+126 	public void setUpperValue(long upperValue) {
+127 		this.upperValue = upperValue;
+128 	}
+129 }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AcksTo.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AcksTo.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AcksTo.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/AcksTo.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,118 @@ + + + +AcksTo xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright  1999-2004 The Apache Software Foundation.
+3    *
+4    *  Licensed under the Apache License, Version 2.0 (the "License");
+5    *  you may not use this file except in compliance with the License.
+6    *  You may obtain a copy of the License at
+7    *
+8    *      http://www.apache.org/licenses/LICENSE-2.0
+9    *
+10   *  Unless required by applicable law or agreed to in writing, software
+11   *  distributed under the License is distributed on an "AS IS" BASIS,
+12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+13   *  See the License for the specific language governing permissions and
+14   *  limitations under the License.
+15   *
+16   */
+17  package org.apache.sandesha2.wsrm;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.apache.axis2.om.OMElement;
+22  import org.apache.axis2.om.OMException;
+23  import org.apache.axis2.om.OMNamespace;
+24  import org.apache.axis2.soap.SOAPFactory;
+25  import org.apache.sandesha2.Sandesha2Constants;
+26  
+27  /***
+28   * @author Chamikara Jayalath <chamikaramj@gmail.com>
+29   * @author Sanka Samaranayaka <ssanka@gmail.com>
+30   * @author Saminda Abeyruwan  <saminda@opensource.lk>
+31   */
+32  
+33  public class AcksTo implements IOMRMElement {
+34  
+35  	private Address address;
+36  
+37  	private OMElement acksToElement;
+38  
+39  	//private OMElement addressElement;
+40  
+41  	private SOAPFactory factory;
+42  	
+43  	OMNamespace rmNamespace = null;
+44  
+45  	public AcksTo(SOAPFactory factory) {
+46  		this.factory = factory;
+47  		rmNamespace = factory.createOMNamespace(
+48  				Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.NS_PREFIX_RM);
+49  		acksToElement = factory.createOMElement(
+50  				Sandesha2Constants.WSRM.ACKS_TO, rmNamespace);
+51  	}
+52  	
+53  	public AcksTo (Address address,SOAPFactory factory) {
+54  		this (factory);
+55  		this.address = address;
+56  	}
+57  
+58  	public OMElement getOMElement() throws OMException {
+59  		return acksToElement;
+60  	}
+61  
+62  	public Object fromOMElement(OMElement element) throws OMException {
+63  		OMElement acksToPart = element.getFirstChildWithName(new QName(
+64  				Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.ACKS_TO));
+65  
+66  		if (acksToPart == null)
+67  			throw new OMException(
+68  					"Passed element does not contain an acksTo part");
+69  
+70  		address = new Address(factory);
+71  		address.fromOMElement(acksToPart);
+72  
+73  		acksToElement = factory.createOMElement(
+74  				Sandesha2Constants.WSRM.ACKS_TO, rmNamespace);
+75  
+76  		return this;
+77  	}
+78  
+79  	public OMElement toOMElement(OMElement element) throws OMException {
+80  
+81  		if (acksToElement == null)
+82  			throw new OMException("Cant set AcksTo. AcksTo element is null");
+83  		if (address == null)
+84  			throw new OMException("Cant set AcksTo. Address is null");
+85  
+86  		OMElement acksToPart = element.getFirstChildWithName(new QName(
+87  				Sandesha2Constants.WSA.NS_URI_ADDRESSING, Sandesha2Constants.WSRM.ACKS_TO));
+88  
+89  		address.toOMElement(acksToElement);
+90  		element.addChild(acksToElement);
+91  
+92  		acksToElement =factory.createOMElement(
+93  				Sandesha2Constants.WSRM.ACKS_TO, rmNamespace);
+94  
+95  		return element;
+96  	}
+97  
+98  	public Address getAddress() {
+99  		return address;
+100 	}
+101 
+102 	public void setAddress(Address address) {
+103 		this.address = address;
+104 	}
+105 }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/Address.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/Address.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/Address.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref/org/apache/sandesha2/wsrm/Address.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,109 @@ + + + +Address xref + + + +
View Javadoc
+
+1   /*
+2    * Created on Sep 1, 2005
+3    *
+4    * TODO To change the template for this generated file go to
+5    * Window - Preferences - Java - Code Style - Code Templates
+6    */
+7   package org.apache.sandesha2.wsrm;
+8   
+9   import javax.xml.namespace.QName;
+10  
+11  import org.apache.axis2.addressing.EndpointReference;
+12  import org.apache.axis2.om.OMElement;
+13  import org.apache.axis2.om.OMException;
+14  import org.apache.axis2.om.OMNamespace;
+15  import org.apache.axis2.soap.SOAPFactory;
+16  import org.apache.sandesha2.Sandesha2Constants;
+17  
+18  /***
+19   * @author Chamikara Jayalath <chamikaramj@gmail.com>
+20   * @author Sanka Samaranayaka <ssanka@gmail.com>
+21   * @author Saminda Abeyruwan  <saminda@opensource.lk>
+22   */
+23  
+24  public class Address implements IOMRMElement {
+25  
+26  	EndpointReference epr = null;
+27  
+28  	OMElement addressElement;
+29  	
+30  	SOAPFactory factory;
+31  
+32  	OMNamespace rmNamespace = null;
+33  
+34  	public Address(SOAPFactory factory) {
+35  		this.factory = factory;
+36  		rmNamespace = factory.createOMNamespace(Sandesha2Constants.WSA.NS_URI_ADDRESSING,
+37  				Sandesha2Constants.WSA.NS_PREFIX_ADDRESSING);
+38  		addressElement = factory.createOMElement(
+39  				Sandesha2Constants.WSA.ADDRESS, rmNamespace);
+40  	}
+41  	
+42  	public Address (EndpointReference epr,SOAPFactory factory) {
+43  		this(factory);
+44  		this.epr = epr;
+45  	}
+46  
+47  	public Object fromOMElement(OMElement element) throws OMException {
+48  
+49  		OMElement addressPart = element.getFirstChildWithName(new QName(
+50  				Sandesha2Constants.WSA.NS_URI_ADDRESSING, Sandesha2Constants.WSA.ADDRESS));
+51  		if (addressPart == null)
+52  			throw new OMException(
+53  					"Cant find an Address element in the given part");
+54  		String addressText = addressPart.getText();
+55  		if (addressText == null || addressText == "")
+56  			throw new OMException(
+57  					"Passed element does not have a valid address text");
+58  
+59  		addressElement = addressPart;
+60  		epr = new EndpointReference(addressText);
+61  		addressElement = factory.createOMElement(
+62  				Sandesha2Constants.WSA.ADDRESS, rmNamespace);
+63  		return this;
+64  
+65  	}
+66  
+67  	public OMElement getOMElement() throws OMException {
+68  		return addressElement;
+69  	}
+70  
+71  	public OMElement toOMElement(OMElement element) throws OMException {
+72  		if (addressElement == null)
+73  			throw new OMException(
+74  					"Cant set Address. The address element is null");
+75  
+76  		if (epr == null || epr.getAddress() == null || epr.getAddress() == "")
+77  			throw new OMException(
+78  					"cant set the address. The address value is not valid");
+79  
+80  		addressElement.setText(epr.getAddress());
+81  		element.addChild(addressElement);
+82  
+83  		addressElement = factory.createOMElement(
+84  				Sandesha2Constants.WSA.ADDRESS, rmNamespace);
+85  
+86  		return element;
+87  	}
+88  
+89  	public EndpointReference getEpr() {
+90  		return epr;
+91  	}
+92  
+93  	public void setEpr(EndpointReference epr) {
+94  		this.epr = epr;
+95  	}
+96  }
+
+
+ +