svn commit: r689119 - in /webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008: include/ src/util/ src/wsrm/

[email protected]
Newsgroups gmane.comp.apache.webservices.fx.devel
Message-ID <[email protected]>
Author: damitha
Date: Tue Aug 26 08:55:29 2008
New Revision: 689119

URL: http://svn.apache.org/viewvc?rev=689119&view=rev
Log:
Adding endpoint construct into sequence offer in RM 1.1

Modified:
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_offer.h
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/Makefile.am
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/endpoint.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h?rev=689119&r1=689118&r2=689119&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_constants.h Tue Aug 26 08:55:29 2008
@@ -153,6 +153,7 @@
     #define SANDESHA2_WSRM_COMMON_MESSAGE_PENDING "MessagePending"
     #define SANDESHA2_WSRM_COMMON_PENDING "pending"
     #define SANDESHA2_WSRM_COMMON_MAKE_CONNECTION "MakeConnection"
+    #define SANDESHA2_WSRM_COMMON_ENDPOINT "Endpoint"
     
     /* Message Context Properties */
     #define SANDESHA2_MSG_CTX_PROP_INTERNAL_SEQUENCE_ID "Sandesha2InternalSequenceId"

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_offer.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_offer.h?rev=689119&r1=689118&r2=689119&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_offer.h (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_seq_offer.h Tue Aug 26 08:55:29 2008
@@ -24,6 +24,7 @@
 
 #include <sandesha2_error.h>
 #include <sandesha2_identifier.h>
+#include <sandesha2_endpoint.h>
 #include <sandesha2_expires.h>
 
 #ifdef __cplusplus
@@ -46,7 +47,8 @@
 AXIS2_EXTERN sandesha2_seq_offer_t* AXIS2_CALL
 sandesha2_seq_offer_create(
     const axutil_env_t *env, 
-    axis2_char_t *ns_value);
+    axis2_char_t *ns_value,
+	axis2_char_t *addr_ns_val);
 
 axis2_status_t AXIS2_CALL 
 sandesha2_seq_offer_free(
@@ -64,6 +66,17 @@
     const axutil_env_t *env, 
     sandesha2_identifier_t *identifier);
 
+sandesha2_endpoint_t * AXIS2_CALL
+sandesha2_seq_offer_get_endpoint(
+    sandesha2_seq_offer_t *seq_offer,
+    const axutil_env_t *env);
+
+axis2_status_t AXIS2_CALL                 
+sandesha2_seq_offer_set_endpoint(
+    sandesha2_seq_offer_t *seq_offer,
+    const axutil_env_t *env, 
+    sandesha2_endpoint_t *endpoint);
+
 sandesha2_expires_t * AXIS2_CALL                    	
 sandesha2_seq_offer_get_expires(
     sandesha2_seq_offer_t *seq_offer,

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c?rev=689119&r1=689118&r2=689119&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c Tue Aug 26 08:55:29 2008
@@ -106,6 +106,7 @@
     sandesha2_address_t *temp_address = NULL;
     sandesha2_acks_to_t *temp_acks_to = NULL;
     axutil_property_t *property = NULL;
+    const axis2_char_t *reply_to_address = NULL;
 
     application_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(application_rm_msg, env);
     if(!application_msg_ctx)
@@ -160,7 +161,8 @@
     {
         axis2_endpoint_ref_t *reply_to_epr = NULL;
 
-        reply_to_epr = axis2_endpoint_ref_create(env, axis2_endpoint_ref_get_address(temp_reply_to, env));
+        reply_to_address = axis2_endpoint_ref_get_address(temp_reply_to, env);
+        reply_to_epr = axis2_endpoint_ref_create(env, reply_to_address);
         if(reply_to_epr)
         {
             axis2_msg_ctx_set_reply_to(create_seq_msg_ctx, env, reply_to_epr);
@@ -205,11 +207,26 @@
         {
             sandesha2_seq_offer_t *offer_part = NULL;
             sandesha2_identifier_t *identifier = NULL;
+            sandesha2_endpoint_t *endpoint = NULL;
 
-            offer_part = sandesha2_seq_offer_create(env, rm_ns_value);
+            offer_part = sandesha2_seq_offer_create(env, rm_ns_value, addressing_ns_value);
             identifier = sandesha2_identifier_create(env, rm_ns_value);
             sandesha2_identifier_set_identifier(identifier, env, offered_seq);
             sandesha2_seq_offer_set_identifier(offer_part, env, identifier);
+
+            if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, rm_version))
+            {
+                axis2_endpoint_ref_t *reply_to_epr = NULL;
+                sandesha2_address_t *address = NULL;
+
+                reply_to_epr = axis2_endpoint_ref_create(env, reply_to_address);
+                address = sandesha2_address_create(env, rm_ns_value, reply_to_epr);
+                endpoint = sandesha2_endpoint_create(env, address, rm_ns_value, 
+                        addressing_ns_value);
+
+                sandesha2_seq_offer_set_endpoint(offer_part, env, endpoint);
+            }
+
             sandesha2_create_seq_set_seq_offer(create_seq_part, env, offer_part);
         }
     }

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/Makefile.am?rev=689119&r1=689118&r2=689119&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/Makefile.am (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/Makefile.am Tue Aug 26 08:55:29 2008
@@ -3,6 +3,7 @@
 
 libsandesha2_wsrm_la_SOURCES = ack_final.c\
                                identifier.c\
+                               endpoint.c\
                                address.c\
                                acks_to.c\
 							   nack.c\

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c?rev=689119&r1=689118&r2=689119&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c Tue Aug 26 08:55:29 2008
@@ -173,7 +173,7 @@
     if(offer_part)
     {
         create_seq->seq_offer = sandesha2_seq_offer_create(env, 
-            create_seq->rm_ns_val);  
+            create_seq->rm_ns_val, create_seq->addr_ns_val);  
         if(!create_seq->seq_offer)
         {
             return NULL;

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/endpoint.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/endpoint.c?rev=689119&r1=689118&r2=689119&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/endpoint.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/endpoint.c Tue Aug 26 08:55:29 2008
@@ -116,26 +116,31 @@
     AXIS2_PARAM_CHECK(env->error, om_node, NULL);
      
     om_element = axiom_node_get_data_element(om_node, env);
-    if(NULL == om_element)
+    if(!om_element)
     {
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_OM_ELEMENT,
-            AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_OM_ELEMENT, AXIS2_FAILURE);
         return NULL;
     }
     endpoint_qname = axutil_qname_create(env, SANDESHA2_WSRM_COMMON_ENDPOINT,
         endpoint->rm_ns_val, NULL);
-    if(NULL == endpoint_qname)
+
+    if(!endpoint_qname)
     {
         return NULL;
     }
+
     endpoint_part = axiom_element_get_first_child_with_qname(om_element, env,
         endpoint_qname, om_node, &endpoint_node);
+
     if(endpoint_qname)
+    {
         axutil_qname_free(endpoint_qname, env);
-    if(NULL == endpoint_part)
+    }
+
+    if(!endpoint_part)
     {
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_OM_ELEMENT,
-            AXIS2_FAILURE);
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                "Endpoint is not set. It means this is not RM 1.1 Create Sequence Message");
         return NULL;
     }
 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c?rev=689119&r1=689118&r2=689119&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c Tue Aug 26 08:55:29 2008
@@ -24,8 +24,10 @@
 struct sandesha2_seq_offer_t
 {
 	sandesha2_identifier_t *identifier;
+	sandesha2_endpoint_t *endpoint;
 	sandesha2_expires_t *expires;
 	axis2_char_t *ns_val;
+    axis2_char_t *addr_ns_val;
 };
 
 static axis2_bool_t AXIS2_CALL 
@@ -36,10 +38,12 @@
 AXIS2_EXTERN sandesha2_seq_offer_t* AXIS2_CALL
 sandesha2_seq_offer_create(
     const axutil_env_t *env,  
-    axis2_char_t *ns_val)
+    axis2_char_t *ns_val,
+	axis2_char_t *addr_ns_val)
 {
     sandesha2_seq_offer_t *seq_offer = NULL;
     AXIS2_PARAM_CHECK(env->error, ns_val, NULL);
+    AXIS2_PARAM_CHECK(env->error, addr_ns_val, NULL);
     
     if(AXIS2_FALSE == sandesha2_seq_offer_is_namespace_supported(env, ns_val))
     {
@@ -55,8 +59,11 @@
 		AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
 	}
+
     seq_offer->ns_val = (axis2_char_t *)axutil_strdup(env, ns_val);
+    seq_offer->addr_ns_val = (axis2_char_t *)axutil_strdup(env, addr_ns_val);
     seq_offer->identifier = NULL;
+    seq_offer->endpoint = NULL;
     seq_offer->expires = NULL;
     
 	return seq_offer;
@@ -74,11 +81,23 @@
         seq_offer->ns_val = NULL;
     }
 
+    if(seq_offer->addr_ns_val)
+    {
+        AXIS2_FREE(env->allocator, seq_offer->addr_ns_val);
+        seq_offer->addr_ns_val = NULL;
+    }
+
     if(seq_offer->identifier)
     {
         sandesha2_identifier_free(seq_offer->identifier, env);
         seq_offer->identifier = NULL;
     }
+    
+    if(seq_offer->endpoint)
+    {
+        sandesha2_endpoint_free(seq_offer->endpoint, env);
+        seq_offer->endpoint = NULL;
+    }
 
     seq_offer->expires = NULL;
 	AXIS2_FREE(env->allocator, seq_offer);
@@ -132,13 +151,25 @@
             AXIS2_FAILURE);
         return NULL;
     }
-    seq_offer->identifier = sandesha2_identifier_create(env, 
-        seq_offer->ns_val); 
-    if(NULL == seq_offer->identifier)
+
+    seq_offer->identifier = sandesha2_identifier_create(env, seq_offer->ns_val); 
+    if(!seq_offer->identifier)
     {
         return NULL;
     }
+
     sandesha2_identifier_from_om_node(seq_offer->identifier, env, so_node);
+
+    seq_offer->endpoint = sandesha2_endpoint_create(env, NULL, seq_offer->ns_val, 
+            seq_offer->addr_ns_val); 
+
+    if(!seq_offer->endpoint)
+    {
+        return NULL;
+    }
+
+    sandesha2_endpoint_from_om_node(seq_offer->endpoint, env, so_node);
+
     exp_qname = axutil_qname_create(env, SANDESHA2_WSRM_COMMON_EXPIRES,
         seq_offer->ns_val, NULL);
     if(NULL == exp_qname)
@@ -174,31 +205,38 @@
     
     AXIS2_PARAM_CHECK(env->error, om_node, NULL);
     
-    if(NULL == seq_offer->identifier)
+    if(!seq_offer->identifier)
     {
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_TO_OM_NULL_ELEMENT, 
-            AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_TO_OM_NULL_ELEMENT, AXIS2_FAILURE);
         return NULL;
     }
-    rm_ns = axiom_namespace_create(env, seq_offer->ns_val,
-        SANDESHA2_WSRM_COMMON_NS_PREFIX_RM);
-    if(NULL == rm_ns)
+    
+    rm_ns = axiom_namespace_create(env, seq_offer->ns_val, SANDESHA2_WSRM_COMMON_NS_PREFIX_RM);
+    if(!rm_ns)
     {
         return NULL;
     }
-    so_element = axiom_element_create(env, NULL, 
-        SANDESHA2_WSRM_COMMON_SEQ_OFFER, rm_ns, &so_node);
-    if(NULL == so_element)
+
+    so_element = axiom_element_create(env, NULL, SANDESHA2_WSRM_COMMON_SEQ_OFFER, rm_ns, &so_node);
+    if(!so_element)
     {
         return NULL;
     }
+
     sandesha2_identifier_to_om_node(seq_offer->identifier, env, so_node);
-    if(NULL != seq_offer->expires)
+
+    if(seq_offer->endpoint)
     {
-        sandesha2_seq_offer_to_om_node((sandesha2_seq_offer_t *)
-            seq_offer->expires, env, so_node);
+        sandesha2_endpoint_to_om_node(seq_offer->endpoint, env, so_node);
     }
+
+    if(seq_offer->expires)
+    {
+        sandesha2_seq_offer_to_om_node((sandesha2_seq_offer_t *) seq_offer->expires, env, so_node);
+    }
+
     axiom_node_add_child((axiom_node_t*)om_node, env, so_node);
+
     return (axiom_node_t*)om_node;
 }
 
@@ -226,6 +264,30 @@
  	return AXIS2_SUCCESS;
 }
 
+sandesha2_endpoint_t * AXIS2_CALL
+sandesha2_seq_offer_get_endpoint(
+    sandesha2_seq_offer_t *seq_offer,
+    const axutil_env_t *env)
+{
+	return seq_offer->endpoint;
+}                    	
+
+axis2_status_t AXIS2_CALL                 
+sandesha2_seq_offer_set_endpoint(
+    sandesha2_seq_offer_t *seq_offer,
+    const axutil_env_t *env, 
+    sandesha2_endpoint_t *endpoint)
+{
+ 	if(seq_offer->endpoint)
+	{
+		sandesha2_endpoint_free(seq_offer->endpoint, env);
+		seq_offer->endpoint = NULL;	
+	}
+
+	seq_offer->endpoint = endpoint;
+ 	return AXIS2_SUCCESS;
+}
+
 sandesha2_expires_t * AXIS2_CALL                    	
 sandesha2_seq_offer_get_expires(
     sandesha2_seq_offer_t *seq_offer,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.