You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2006/11/12 12:06:54 UTC

svn commit: r473921 - in /webservices/sandesha/trunk/java/src/org/apache/sandesha2: i18n/SandeshaMessageKeys.java i18n/resource.properties util/RMMsgCreator.java util/SandeshaUtil.java

Author: chamikara
Date: Sun Nov 12 03:06:53 2006
New Revision: 473921

URL: http://svn.apache.org/viewvc?view=rev&rev=473921
Log:
Things from commit 473920 to the branch.

Modified:
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java?view=diff&rev=473921&r1=473920&r2=473921
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/SandeshaMessageKeys.java Sun Nov 12 03:06:53 2006
@@ -236,6 +236,9 @@
 	
 	public static final String cannotFindTransportInDesc = "cannotFindTransportInDesc";
 	public static final String toEPRNotSet = "toEPRNotSet";
+	public static final String toBeanNotSet = "toBeanNotSet";
+	public static final String replyToBeanNotSet = "replyToBeanNotSet";
+	    
     
     public final static String errorRetrievingSecurityToken = "errorRetrievingSecurityToken";
 	public final static String proofOfPossessionNotVerified = "proofOfPossessionNotVerified";

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties?view=diff&rev=473921&r1=473920&r2=473921
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties Sun Nov 12 03:06:53 2006
@@ -261,6 +261,8 @@
 invalidMsgNumberList=Invalid msg number list
 cannotFindReqMsgFromOpContext=Cannot find the request message from the operation context
 toEPRNotSet=To EPR has not been set in the given message
+toBeanNotSet=The 'To' Sequence Property Bean has not been set for the sequence.
+replyToBeanNotSet=The 'ReplyTo' Sequence Property Bean has not been set for the sequence.
 cannotFindTransportInDesc=Cannot find the transport in description {0} in the ConfigurationContext
 invalidOfferNoResponseEndpoint=Cannot derive a valid offer from the given infomation. No Endpoint for receiving messages.
 invalidElementFoundWithinElement=Found invalid ''{0}'' element within ''{1}'' element

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java?view=diff&rev=473921&r1=473920&r2=473921
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/RMMsgCreator.java Sun Nov 12 03:06:53 2006
@@ -89,7 +89,6 @@
 		if (context == null)
 			throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.configContextNotSet));
 
-		SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropertyBeanMgr();
 		MessageContext createSeqmsgContext;
 		try {
 			// creating by copying common contents. (this will not set contexts
@@ -110,14 +109,6 @@
 		} catch (AxisFault e) {
 			throw new SandeshaException(e.getMessage());
 		}
-
-		createSeqmsgContext.setTo(applicationRMMsg.getTo());
-		EndpointReference referenceReplyTo = applicationMsgContext.getReplyTo();
-		
-		if (referenceReplyTo!=null) {
-			EndpointReference createSeqReplyTo = new EndpointReference (referenceReplyTo.getAddress());
-        	createSeqmsgContext.setReplyTo(createSeqReplyTo);
-		}
         
 		RMMsgContext createSeqRMMsg = new RMMsgContext(createSeqmsgContext);
 
@@ -140,9 +131,12 @@
 			EndpointReference offeredEndpoint = (EndpointReference) applicationMsgContext
 					.getProperty(SandeshaClientConstants.OFFERED_ENDPOINT);
 			
-			if (offeredEndpoint==null)
-				offeredEndpoint = applicationMsgContext.getReplyTo();  //using replyTo as the Endpoint if it is not specified
+			if (offeredEndpoint==null) {
+				EndpointReference replyTo = applicationMsgContext.getReplyTo();  //using replyTo as the Endpoint if it is not specified
 			
+				if (replyTo!=null)
+					offeredEndpoint = SandeshaUtil.cloneEPR(replyTo);
+			}
 			if (offeredSequence != null && !"".equals(offeredSequence)) {
 				SequenceOffer offerPart = new SequenceOffer(rmNamespaceValue);
 				Identifier identifier = new Identifier(rmNamespaceValue);
@@ -163,34 +157,43 @@
 				}
 			}
 		}
+		
+		String to = SandeshaUtil.getSequenceProperty(sequencePropertyKey,
+				Sandesha2Constants.SequenceProperties.TO_EPR, storageManager);
+		String replyTo = SandeshaUtil.getSequenceProperty(sequencePropertyKey,
+				Sandesha2Constants.SequenceProperties.REPLY_TO_EPR,
+				storageManager);
+
+		if (replyTo == null) {
+			// using wsa:Anonymous as ReplyTo
+
+			String addressingNamespace = applicationRMMsg
+					.getAddressingNamespaceValue();
+			if (AddressingConstants.Submission.WSA_NAMESPACE
+					.equals(addressingNamespace))
+				replyTo = AddressingConstants.Submission.WSA_ANONYMOUS_URL;
+			else
+				replyTo = AddressingConstants.Final.WSA_ANONYMOUS_URL;
+		}
 
-		//TODO remove setting addressing values following two beans.
-		SequencePropertyBean replyToBean = seqPropMgr.retrieve(sequencePropertyKey,
-				Sandesha2Constants.SequenceProperties.REPLY_TO_EPR);
-		SequencePropertyBean toBean = seqPropMgr.retrieve(sequencePropertyKey,
-				Sandesha2Constants.SequenceProperties.TO_EPR);
+		if (to == null) {
+			String message = SandeshaMessageHelper
+					.getMessage(SandeshaMessageKeys.toBeanNotSet);
+			throw new SandeshaException(message);
+		}
 
-		if (toBean == null || toBean.getValue() == null)
-			throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.toEPRNotValid, null));
+		// TODO store and retrieve a full EPR instead of just the address.
+		EndpointReference toEPR = new EndpointReference(to);
+		EndpointReference replyToEPR = new EndpointReference(replyTo);
 
-		EndpointReference toEPR = new EndpointReference(toBean.getValue());
-		EndpointReference replyToEPR = null;
+		createSeqRMMsg.setTo(toEPR);
+		createSeqRMMsg.setReplyTo(replyToEPR);
 
 		String anonymousURI = SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespaceValue);
 
 		if (acksToEPR==null || acksToEPR.getAddress() == null || "".equals(acksToEPR.getAddress()))
 			acksToEPR = new EndpointReference(anonymousURI);
 
-		if (replyToBean != null && replyToBean.getValue() != null)
-			replyToEPR = new EndpointReference(replyToBean.getValue());
-
-		if (createSeqRMMsg.getTo() == null)
-			createSeqRMMsg.setTo(toEPR);
-
-		// ReplyTo will be set only if not null.
-		if (replyToEPR != null)
-			createSeqRMMsg.setReplyTo(replyToEPR);
-
 
 		AcksTo acksTo = new AcksTo(acksToEPR,rmNamespaceValue,addressingNamespaceValue);
 		createSequencePart.setAcksTo(acksTo);
@@ -359,7 +362,7 @@
 			if (outSequenceId != null && !"".equals(outSequenceId)) {
 
 				Accept accept = new Accept(rmNamespaceValue, addressingNamespaceValue);
-				EndpointReference acksToEPR = createSeqMessage.getTo();
+				EndpointReference acksToEPR = SandeshaUtil.cloneEPR (createSeqMessage.getTo());
 				
 				//putting the To EPR as the AcksTo for the response sequence.
 				AcksTo acksTo = new AcksTo(acksToEPR,rmNamespaceValue, addressingNamespaceValue);

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java?view=diff&rev=473921&r1=473920&r2=473921
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SandeshaUtil.java Sun Nov 12 03:06:53 2006
@@ -24,6 +24,7 @@
 import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.StringTokenizer;
 
 import javax.xml.namespace.QName;
@@ -43,6 +44,7 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
@@ -1169,5 +1171,26 @@
 		pollingManager.shedulePollingRequest(sequenceId);
 	}
 
+	public static EndpointReference cloneEPR (EndpointReference epr) {
+		EndpointReference newEPR = new EndpointReference (epr.getAddress());
+		Map referenceParams = epr.getAllReferenceParameters();
+		
+		if (referenceParams != null) {
+			for (Iterator keys = referenceParams.keySet().iterator(); keys
+					.hasNext();) {
+				Object key = keys.next();
+				Object referenceParam = referenceParams.get(key);
+
+				if (referenceParam instanceof OMElement) {
+					OMElement clonedElement = ((OMElement) referenceParam)
+							.cloneOMElement();
+					clonedElement.setText("false");
+					newEPR.addReferenceParameter(clonedElement);
+				}
+			}
+		}
+		
+		return newEPR;
+	}
 	
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org