Author: amila
Date: Mon Jun  2 21:46:55 2008
New Revision: 17804
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=17804

Log:
Changed the sample to use Mercury


Modified:
   
branches/wsas/java/2.3/wsas/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java

Modified: 
branches/wsas/java/2.3/wsas/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java
URL: 
http://wso2.org/svn/browse/wso2/branches/wsas/java/2.3/wsas/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java?rev=17804&r1=17803&r2=17804&view=diff
==============================================================================
--- 
branches/wsas/java/2.3/wsas/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java
       (original)
+++ 
branches/wsas/java/2.3/wsas/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java
       Mon Jun  2 21:46:55 2008
@@ -40,6 +40,10 @@
 import org.wso2.utils.NetworkUtils;
 import org.wso2.wsas.security.WSS4JUtil;
 import org.wso2.www.types.client.*;
+import org.wso2.mercury.callback.MercuryErrorCallback;
+import org.wso2.mercury.exception.RMException;
+import org.wso2.mercury.util.MercuryClientConstants;
+import org.wso2.mercury.client.MercuryClient;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -60,7 +64,7 @@
     private static final String INVOCATION_TYPE_ASYNC = "async";
     private static final String INVOCATION_TYPE_SYNC = "sync";
     private static final String MODULE_SECURITY = "rampart";
-    private static final String MODULE_RM = "sandesha2";
+    private static final String MODULE_RM = "Mercury";
     private static String invocationType = null;
     private static String qosValue = null;
 
@@ -299,27 +303,19 @@
         }
     }
 
+
     private void configureRM() throws AxisFault, IOException {
-        stub._getServiceClient().engageModule(new QName(MODULE_RM));
-        stub._getServiceClient().engageModule(new QName(
-                org.apache.axis2.Constants.MODULE_ADDRESSING));
+        stub._getServiceClient().engageModule(MODULE_RM);
+        
stub._getServiceClient().engageModule(org.apache.axis2.Constants.MODULE_ADDRESSING);
 
         Options clientOptions = stub._getServiceClient().getOptions();
-
-
-        String sequenceKey = UUIDGenerator.getUUID();  //sequence key for thie 
sequence.
-        clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY, 
sequenceKey);
-
-        clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER,
-                                  new SandeshaListenerImpl());
-
-        clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
         clientOptions.setUseSeparateListener(true);
-        clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER,
-                                  new SandeshaListenerImpl());
 
-        String offeredSequenceId = UUIDGenerator.getUUID();
-        clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID, 
offeredSequenceId);
+        clientOptions.setProperty(MercuryClientConstants.ERROR_CALLBACK,
+                                  new MercuryErrorCallbackImpl());
+        MercuryClient mercuryClient = new 
MercuryClient(stub._getServiceClient());
+        mercuryClient.setRMSSequenceRetransmitTime(5000);
+
     }
 
     private void configureMail() throws AxisFault {
@@ -361,9 +357,9 @@
      */
     private int configureSecurity(String[] args, EndpointReference epr)
             throws AxisFault, IOException, XMLStreamException {
-        stub._getServiceClient().engageModule(new QName(MODULE_SECURITY));
+        stub._getServiceClient().engageModule(MODULE_SECURITY);
         stub._getServiceClient()
-                .engageModule(new 
QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
+                .engageModule(org.apache.axis2.Constants.MODULE_ADDRESSING);
         String clientSSLStore = wso2wsasHome + File.separator + "conf" + 
File.separator +
                                 "client-truststore.jks";
 
@@ -630,8 +626,7 @@
             }
 
             EndpointReference epr = new EndpointReference(serviceEPR);
-            BufferedReader console = new BufferedReader(new InputStreamReader(
-                    System.in));
+            BufferedReader console = new BufferedReader(new 
InputStreamReader(System.in));
 
             System.out.println("COMMODITY QUOTE SAMPLE CLIENT");
             System.out.println("=============================\n");
@@ -718,13 +713,10 @@
                            "       : endpoint url of the CommodityQuote 
service");
     }
 
-    private static class SandeshaListenerImpl implements SandeshaListener {
-        public void onError(AxisFault fault) {
-            System.out.println("ERROR:" + fault.getMessage());
-        }
+    private static class MercuryErrorCallbackImpl implements 
MercuryErrorCallback {
 
-        public void onTimeOut(SequenceReport report) {
-            System.out.println("ERROR: RM Sequence timed out");
+        public void onError(RMException rmException) {
+            System.out.println("ERROR: " + rmException.getMessage());
         }
     }
 

_______________________________________________
Wsas-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev

Reply via email to