You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by da...@apache.org on 2006/07/19 13:15:45 UTC

svn commit: r423437 - in /webservices/sandesha/trunk/c: include/ include/sandesha2/ src/util/

Author: damitha
Date: Wed Jul 19 04:15:44 2006
New Revision: 423437

URL: http://svn.apache.org/viewvc?rev=423437&view=rev
Log:
New files added and more coding

Added:
    webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h
    webservices/sandesha/trunk/c/include/sandesha2_msg_init.h
    webservices/sandesha/trunk/c/include/sandesha2_rm_elements.h
    webservices/sandesha/trunk/c/src/util/msg_init.c
Modified:
    webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h
    webservices/sandesha/trunk/c/include/sandesha2_sender.h
    webservices/sandesha/trunk/c/src/util/Makefile.am
    webservices/sandesha/trunk/c/src/util/error.c
    webservices/sandesha/trunk/c/src/util/msg_creator.c

Modified: webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h?rev=423437&r1=423436&r2=423437&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h Wed Jul 19 04:15:44 2006
@@ -165,7 +165,14 @@
          * Can't decide the RM version
          */
         SANDESHA2_ERROR_CREATE_SEQ_MSG_DOES_NOT_HAVE_VALID_RM_NS_VALUE,
-        
+
+        /* Application message is NULL */
+        SANDESHA2_ERROR_APPLICATION_MSG_NULL, 
+        /* Configuration Context is NULL */
+        SANDESHA2_ERROR_CONF_CTX_NULL,
+        /* Cannot find the rmVersion of the given message */
+        SANDESHA2_ERROR_CANNOT_FIND_RM_VERSION_OF_GIVEN_MSG,
+
         /** The following has to be the last error value all the time.
             All other error codes should appear above this.
             SANDESHA_ERROR_LAST is used to track the number of error codes present

Added: webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h?rev=423437&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h (added)
+++ webservices/sandesha/trunk/c/include/sandesha2_msg_creator.h Wed Jul 19 04:15:44 2006
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SANDESHA2_MSG_CREATOR_H
+#define SANDESHA2_MSG_CREATOR_H
+
+/**
+ * @file sandesha2_msg_creator.h
+ * @brief Sandesha In Memory Message creator Interface
+ */
+
+#include <axis2_allocator.h>
+#include <axis2_env.h>
+#include <axis2_error.h>
+#include <axis2_string.h>
+#include <axis2_utils.h>
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2_msg_ctx.h>
+#include <axis2_msg_ctx.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct sandesha2_msg_creator sandesha2_msg_creator_t;
+typedef struct sandesha2_msg_creator_ops sandesha2_msg_creator_ops_t;
+
+/** @defgroup sandesha2_msg_creator In Memory Message creator
+  * @ingroup sandesha2
+  * @{
+  */
+
+/**
+ * Create a new create_seq_msg
+ * @param application_rm_msg
+ * @param internal_seq_id
+ * @param acks_to
+ * @return
+ */
+sandesha2_msg_ctx_t *AXIS2_CALL
+sandesha2_msg_creator_create_create_seq_msg(
+        const axis2_env_t *env,
+        sandesha2_msg_ctx_t *application_rm_msg, 
+        axis2_char_t *internal_seq_id,
+        axis2_char_t *acks_to,
+        sandesha2_storage_mgr_t *storage_mgr);
+
+/**
+ * Create a new create_seq_response message.
+ * @param create_seq_msg
+ * @param out_msg
+ * @param new_seq_id
+ * @return
+ */
+sandesha2_msg_ctx_t *
+sandesha2_msg_creator_create_create_seq_response_msg(
+        const axis2_env_t *env,
+        sandesha2_msg_ctx_t *create_seq_msg,
+        axis2_msg_ctx_t *out_msg,
+        axis2_char_t *new_seq_id,
+        sandesha2_storage_mgr_t *storage_mgr);
+ 
+/**
+ * Create a new close_seq_response message.
+ * @param close_seq_msg
+ * @param out_msg
+ * @param storage_mgr
+ * @return
+ */
+sandesha2_msg_ctx_t *
+sandesha2_msg_creator_create_close_seq_response_msg(
+        const axis2_env_t *env,
+        sandesha2_msg_ctx_t *close_seq_msg,
+        axis2_msg_ctx_t *out_msg,
+        sandesha2_storage_mgr_t *storage_mgr);
+
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif /* SANDESHA2_MSG_CREATOR_H */

Added: webservices/sandesha/trunk/c/include/sandesha2_msg_init.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_msg_init.h?rev=423437&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_msg_init.h (added)
+++ webservices/sandesha/trunk/c/include/sandesha2_msg_init.h Wed Jul 19 04:15:44 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SANDESHA2_MSG_INIT_H
+#define SANDESHA2_MSG_INIT_H
+
+/**
+ * @file sandesha2_msg_init.h
+ * @brief Sandesha Message init Interface
+ *  This class is used to create an RMMessageContext out of an MessageContext.
+ * 
+ */
+
+#include <axis2_allocator.h>
+#include <axis2_env.h>
+#include <axis2_error.h>
+#include <axis2_string.h>
+#include <axis2_utils.h>
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2_msg_ctx.h>
+#include <axis2_msg_ctx.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct sandesha2_msg_init sandesha2_msg_init_t;
+typedef struct sandesha2_msg_init_ops sandesha2_msg_init_ops_t;
+
+/** @defgroup sandesha2_msg_init In Memory Message init
+  * @ingroup sandesha2
+  * @{
+  */
+
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif /* SANDESHA2_MSG_INIT_H */

Added: webservices/sandesha/trunk/c/include/sandesha2_rm_elements.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_rm_elements.h?rev=423437&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_rm_elements.h (added)
+++ webservices/sandesha/trunk/c/include/sandesha2_rm_elements.h Wed Jul 19 04:15:44 2006
@@ -0,0 +1,287 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#ifndef SANDESHA2_RM_ELEMENTS_H
+#define SANDESHA2_RM_ELEMENTS_H
+
+/**
+  * @file sandesha2_rm_elements.h
+  * @brief 
+  */
+
+#include <axis2_utils_defines.h>
+#include <axis2_env.h>
+#include <axiom_envelope.h>
+#include <sandesha2_seq.h>
+#include <sandesha2_seq_ack.h>
+#include <sandesha2_create_seq.h>
+#include <sandesha2_create_seq_res.h>
+#include <sandesha2_terminate_seq.h>
+#include <sandesha2_terminate_seq_res.h>
+#include <sandesha2_close_seq.h>
+#include <sandesha2_close_seq_res.h>
+#include <sandesha2_ack_requested.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** 
+ * @ingroup sandesha2_rm_elements
+ * @{
+ */
+ 
+ typedef struct sandesha2_rm_elements_ops sandesha2_rm_elements_ops_t;
+ typedef struct sandesha2_rm_elements sandesha2_rm_elements_t;
+ /**
+ * @brief Sandesha2 RM Elements ops struct
+ * Encapsulator struct for ops of sandesha2_rm_elements
+ */
+AXIS2_DECLARE_DATA struct sandesha2_rm_elements_ops
+{
+    axis2_status_t (AXIS2_CALL *
+    free) (
+        void *rm_elements,
+        const axis2_env_t *env);
+
+    axis2_status_t (AXIS2_CALL *
+    from_soap_envelope) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        axiom_soap_envelope_t *envelope,
+        axis2_char_t *action);
+
+    axiom_soap_envelope_t *(AXIS2_CALL *
+    to_soap_envelope) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        axiom_soap_envelope_t *envelope);
+	
+    sandesha2_create_seq_t *(AXIS2_CALL *
+    get_create_seq) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+
+    sandesha2_create_seq_res_t *(AXIS2_CALL *
+    get_create_seq_response) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+
+    sandesha22_seq_t *(AXIS2_CALL *
+    get_seq) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+
+    sandesha2_seq_ack_t *(AXIS2_CALL *
+    get_seq_ack) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+
+    sandesha2_terminate_seq_t *(AXIS2_CALL *
+    get_terminate_seq) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+
+    sandesha2_terminate_seq_res_t *(AXIS2_CALL *
+    get_terminate_seq_response) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+	
+    axis2_status_t (AXIS2_CALL *
+    set_create_seq) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        sandesha2_create_seq_t *create_seq);
+
+    axis2_status_t (AXIS2_CALL *
+    set_create_seq_response) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        sandesha2_create_seq_res_t *create_seq_res);
+
+    axis2_status_t (AXIS2_CALL *
+    set_seq) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        sandesha2_seq_t *seq);
+
+    axis2_status_t (AXIS2_CALL *
+    set_seq_ack) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        sandesha2_seq_ack_t *seq_ack);
+
+    axis2_status_t (AXIS2_CALL *
+    set_terminate_seq) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        sandesha2_terminate_seq_t *terminate_seq);
+
+    axis2_status_t (AXIS2_CALL *
+    set_termiate_seq_response) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        sandesha2_terminate_seq_res_t *terminate_seq_res);
+	
+    sandesha2_ack_requested_t *(AXIS2_CALL *
+    get_ack_requested) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+
+    axis2_status_t (AXIS2_CALL *
+    set_ack_requested) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        sandesha2_ack_requested_t *ack_requested);
+
+    sandesha2_close_seq_t *(AXIS2_CALL *
+    get_close_seq) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+
+    axis2_status_t (AXIS2_CALL *
+    set_close_seq) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        sandesha2_close_seq_t *close_seq);
+
+    sandesha2_close_seq_res_t *(AXIS2_CALL *
+    get_close_seq_response) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+
+    axis2_status_t (AXIS2_CALL *
+    set_close_seq_response) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env,
+        sandesha2_close_seq_res_t *close_seq_res);
+
+    axis2_char_t *(AXIS2_CALL *
+    get_addressing_ns_value) (
+        sandesha2_rm_elements_t *rm_elements,
+        const axis2_env_t *env);
+};
+
+/**
+ * @brief sandesha2_rm_elements_ops
+ *    sandesha2_rm_elements_ops
+ */
+AXIS2_DECLARE_DATA struct sandesha2_rm_elements
+{
+    sandesha2_rm_elements_ops_t *ops;
+};
+
+AXIS2_EXTERN sandesha2_rm_elements_t* AXIS2_CALL
+sandesha2_rm_elements_create(
+        const axis2_env_t *env);
+
+/************************** Start of function macros **************************/
+#define SANDESHA2_RM_ELEMENTS_FREE(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->free (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_FROM_SOAP_ENVELOPE(storage_man, env, envelope, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     from_soap_envelope (storage_man, env, envelope, env))
+
+#define SANDESHA2_RM_ELEMENTS_TO_SOAP_ENVELOPE(storage_man, env, envelope) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     to_soap_envelope (storage_man, env, envelope))
+
+#define SANDESHA2_RM_ELEMENTS_GET_CREATE_SEQ(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_create_seq (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_GET_CREATE_SEQ_RESPONSE(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_create_seq_response (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_GET_SEQ(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_seq (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_GET_SEQ_ACK(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_seq_ack (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_GET_TERMINATE_SEQ(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_terminate_seq (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_GET_TERMINATE_SEQ_RESPONSE(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_terminate_seq_response (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_SET_CREATE_SEQ(storage_man, env, create_seq) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     set_create_seq (storage_man, env, create_seq))
+
+#define SANDESHA2_RM_ELEMENTS_SET_CREATE_SEQ_RESPONSE(storage_man, env, create_seq_res) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     set_create_seq_response (storage_man, env, create_seq_res))
+
+#define SANDESHA2_RM_ELEMENTS_SET_SEQ(storage_man, env, seq) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     set_seq (storage_man, env, seq))
+
+#define SANDESHA2_RM_ELEMENTS_SET_SEQ_ACK(storage_man, env, seq_ack) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     set_seq_ack (storage_man, env, seq_ack))
+
+#define SANDESHA2_RM_ELEMENTS_SET_TERMINATE_SEQ(storage_man, env, terminate_seq) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     set_terminate_seq (storage_man, env, terminate_seq))
+
+#define SANDESHA2_RM_ELEMENTS_SET_TERMINATE_SEQ_RESPONSE(storage_man, env, terminate_seq_ack) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     set_terminate_seq_response (storage_man, env, terminate_seq_ack))
+
+#define SANDESHA2_RM_ELEMENTS_GET_ACK_REQUESTED(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_ack_requested (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_SET_ACK_REQUESTED(storage_man, env, ack_requested) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     set_ack_requested (storage_man, env, ack_requested))
+
+#define SANDESHA2_RM_ELEMENTS_GET_CLOSE_SEQ(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_close_seq (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_SET_CLOSE_SEQ(storage_man, env, close_seq) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     set_close_seq (storage_man, env, close_seq))
+
+#define SANDESHA2_RM_ELEMENTS_GET_CLOSE_SEQ_RESPONSE(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_close_seq_response (storage_man, env))
+
+#define SANDESHA2_RM_ELEMENTS_SET_CLOSE_SEQ_RESPONSE(storage_man, env, close_seq_res) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     set_close_seq_response (storage_man, env, close_seq_res))
+
+#define SANDESHA2_RM_ELEMENTS_GET_ADDRESSING_NS_VALUE(storage_man, env) \
+    (((sandesha2_rm_elements_t *) storage_man)->ops->\
+     get_addressing_ns_value (storage_man, env))
+
+/************************** End of function macros ****************************/
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*SANDESHA2_RM_ELEMENTS_H*/

Modified: webservices/sandesha/trunk/c/include/sandesha2_sender.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_sender.h?rev=423437&r1=423436&r2=423437&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_sender.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_sender.h Wed Jul 19 04:15:44 2006
@@ -75,7 +75,7 @@
             const axis2_env_t *env);
 
     axis2_status_t (AXIS2_CALL *
-    run_sender_for_seq) (
+    run_for_seq) (
             sandesha2_sender_t *sender,
             const axis2_env_t *env,
             axis2_conf_ctx_t *conf_ctx,

Modified: webservices/sandesha/trunk/c/src/util/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/Makefile.am?rev=423437&r1=423436&r2=423437&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/Makefile.am (original)
+++ webservices/sandesha/trunk/c/src/util/Makefile.am Wed Jul 19 04:15:44 2006
@@ -7,7 +7,8 @@
                             fault_data.c\
                             fault_mgr.c\
                             ack_mgr.c \
-							seq_mgr.c\
+							seq_mgr.c \
+							msg_creator.c \
                             terminate_mgr.c
 
 INCLUDES = -I$(top_builddir)/include \

Modified: webservices/sandesha/trunk/c/src/util/error.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/error.c?rev=423437&r1=423436&r2=423437&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/error.c (original)
+++ webservices/sandesha/trunk/c/src/util/error.c Wed Jul 19 04:15:44 2006
@@ -150,10 +150,15 @@
         "AcksTo is NULL";
     sandesha2_error_messages[SANDESHA2_ERROR_CREATE_SEQ_MSG_DOES_NOT_HAVE_WSA_ACTION_VALUE] = 
         "Create sequence message does not have the WSA:Action value";
-    SANDESHA2_ERROR_CREATE_SEQ_MSG_DOES_NOT_HAVE_VALID_RM_NS_VALUE,
+    sandesha2_error_messages[SANDESHA2_ERROR_CREATE_SEQ_MSG_DOES_NOT_HAVE_VALID_RM_NS_VALUE]=
         "Create sequence message does not has a valid RM namespace value. \
         Can't decide the RM version";
-        
+    sandesha2_error_messages[SANDESHA2_ERROR_APPLICATION_MSG_NULL]=
+        "Application message is NULL";
+    sandesha2_error_messages[SANDESHA2_ERROR_CONF_CTX_NULL]=
+        "Configuration Context is NULL";
+    sandesha2_error_messages[SANDESHA2_ERROR_CANNOT_FIND_RM_VERSION_OF_GIVEN_MSG]=
+        "Cannot find the rmVersion of the given message";
 
     return AXIS2_SUCCESS;
 }

Modified: webservices/sandesha/trunk/c/src/util/msg_creator.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_creator.c?rev=423437&r1=423436&r2=423437&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_creator.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_creator.c Wed Jul 19 04:15:44 2006
@@ -28,6 +28,7 @@
 #include <sandesha2_address.h>
 #include <sandesha2_seq_offer.h>
 #include <sandesha2_accept.h>
+#include "../client/sandesha2_client_constants.h"
 
 #include <axis2_conf_ctx.h>
 #include <axis2_ctx.h>
@@ -36,6 +37,9 @@
 #include <axis2_log.h>
 #include <axis2_uuid_gen.h>
 #include <axis2_addr.h>
+#include <axiom_soap_envelope.h>
+#include <axiom_soap_body.h>
+#include <axiom_node.h>
 
 /**
  * Create a new create_seq_msg
@@ -94,7 +98,7 @@
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
         return NULL;
     }
-    seq_pro_mgr = SANDESHA2_STORAGE_MGR_GET_SEQ_PROPERTY_MGR(storage_mgr, env);
+    seq_prop_mgr = SANDESHA2_STORAGE_MGR_GET_SEQ_PROPERTY_MGR(storage_mgr, env);
     /* Creating by copying common contents. (This will not see contexts except
      * for conf_ctx)
      */
@@ -104,7 +108,7 @@
     sandesha2_msg_creator_init_creation(env, application_msg_ctx, 
             create_seq_msg_ctx);
     create_seq_op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(create_seq_msg_ctx, env);
-    create_seq_msg_id = sandesha2_uuid_gen(env);
+    create_seq_msg_id = axis2_uuid_gen(env);
     AXIS2_MSG_CTX_SET_MSG_ID(create_seq_msg_ctx, env, create_seq_msg_id);
     AXIS2_CONF_CTX_REGISTER_OP_CTX(ctx, env, create_seq_msg_id, 
             create_seq_op_ctx);
@@ -118,7 +122,7 @@
         axis2_array_list_t *outflow = NULL;
         axis2_array_list_t *out_fault_flow = NULL;
         axis2_array_list_t *in_fault_flow = NULL;
-        axis2_array_list_t *in_flow = NULL;
+        axis2_array_list_t *inflow = NULL;
 
         outflow = AXIS2_OP_GET_PHASES_OUTFLOW(app_msg_op_desc, env);
         AXIS2_OP_SET_PHASES_OUTFLOW(create_seq_op, env, outflow);
@@ -131,9 +135,9 @@
     }
     AXIS2_MSG_CTX_SET_OP(create_seq_msg_ctx, env, create_seq_op);
     temp_to = SANDESHA2_MSG_CTX_GET_TO(application_rm_msg, env); 
-    AXIS2_MSG_CTX_SET_TO(create_seq_msg_ctx, env, create_seq_op, temp_to);
+    AXIS2_MSG_CTX_SET_TO(create_seq_msg_ctx, env, temp_to);
     temp_reply_to = SANDESHA2_MSG_CTX_GET_REPLY_TO(application_rm_msg, env); 
-    AXIS2_MSG_CTX_SET_REPLY_TO(create_seq_msg_ctx, env, create_seq_op, temp_reply_to);
+    AXIS2_MSG_CTX_SET_REPLY_TO(create_seq_msg_ctx, env, temp_reply_to);
     create_seq_rm_msg = sandesha2_msg_ctx_create(env, create_seq_msg_ctx);
     rm_version = sandesha2_utils_get_rm_version(env, internal_seq_id, storage_mgr);
     if(rm_version == NULL)
@@ -153,14 +157,16 @@
     {
         axis2_char_t *offered_seq = NULL;
         axis2_property_t *property = NULL;
+        axis2_ctx_t *ctx = NULL;
 
-        property = AXIS2_MSG_CTX_GET_PROPERTY(application_msg_ctx, env, 
+        ctx = AXIS2_MSG_CTX_GET_BASE(application_msg_ctx, env);
+        property = AXIS2_CTX_GET_PROPERTY(ctx, env, 
                 SANDESHA2_CLIENT_OFFERED_SEQ_ID, AXIS2_FALSE);
         offered_seq = AXIS2_PROPERTY_GET_VALUE(property, env);
         if(offered_seq && 0 != AXIS2_STRCMP("", offered_seq))
         {
             sandesha2_seq_offer_t *offer_part = NULL;
-            sandesha2_identifer_t *identifier = NULL;
+            sandesha2_identifier_t *identifier = NULL;
 
             offer_part = sandesha2_seq_offer_create(env, rm_ns_value);
             identifier = sandesha2_identifier_create(env, rm_ns_value);
@@ -205,7 +211,8 @@
             addressing_ns_value);
     SANDESHA2_CREATE_SEQ_SET_ACKS_TO(create_seq_part, env,  temp_acks_to);
     SANDESHA2_MSG_CTX_SET_MSG_PART(create_seq_rm_msg, env, 
-            SANDESHA2_MSG_PART_CREATE_SEQ, create_seq_part);
+            SANDESHA2_MSG_PART_CREATE_SEQ, (sandesha2_iom_rm_part_t *) 
+            create_seq_part);
     SANDESHA2_MSG_CTX_ADD_SOAP_ENVELOPE(create_seq_rm_msg, env);
     temp_action = sandesha2_spec_specific_consts_get_create_seq_action(env, 
             rm_version);
@@ -231,34 +238,33 @@
         sandesha2_msg_ctx_t *create_seq_msg,
         axis2_msg_ctx_t *out_msg,
         axis2_char_t *new_seq_id,
-        axis2_storage_mgr_t *storage_mgr)
+        sandesha2_storage_mgr_t *storage_mgr)
 {
     axis2_conf_ctx_t *conf_ctx = NULL;
     axis2_ctx_t *ctx = NULL;
     axis2_msg_ctx_t *temp_msg_ctx = NULL;
     axis2_property_t *prop = NULL;
-    sandesha2_iom_rm_element_t *msg_part = NULL;
-    sandesha2_create_seq_t *cs = NULL;
     axis2_char_t *rm_version = NULL;
     axis2_char_t *rm_ns_value = NULL;
     axis2_char_t *addressing_ns_value = NULL;
+    axis2_char_t *new_msg_id = NULL;
     axis2_char_t *temp_action = NULL;
-    sandesha2_create_seq_res_t *response = NULL;
-    sandesha2_identifier_t *identifier = NULL;
-    sandesha2_seq_offer_t *offer = NULL;
     axiom_soap_envelope_t *envelope = NULL;
     axiom_soap_envelope_t *temp_envelope = NULL;
     axiom_soap_body_t *temp_soap_body = NULL;
     axiom_node_t *temp_om_node = NULL;
-    axis2_char_t *new_msg_id = NULL;
+    sandesha2_create_seq_res_t *response = NULL;
+    sandesha2_identifier_t *identifier = NULL;
+    sandesha2_seq_offer_t *offer = NULL;
     sandesha2_msg_ctx_t *create_seq_response = NULL;
-    axis2_msg_ctx_t *temp_msg_ctx = NULL;
+    sandesha2_iom_rm_element_t *msg_part = NULL;
+    sandesha2_create_seq_t *cs = NULL;
     int soap_version = -1;
 
     temp_msg_ctx = SANDESHA2_MSG_CTX_GET_MSG_CTX(create_seq_msg, env);
     conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(temp_msg_ctx, env);
-    msg_part = SANDESHA2_MSG_CTX_GET_MSG_PART(create_seq_msg, env, 
-            SANDESHA2_MSG_PART_CREATE_SEQ);
+    msg_part = (sandesha2_iom_rm_element_t *) SANDESHA2_MSG_CTX_GET_MSG_PART(
+            create_seq_msg, env, SANDESHA2_MSG_PART_CREATE_SEQ);
     cs = (sandesha2_create_seq_t *) msg_part;
     rm_version = sandesha2_utils_get_rm_version(env, new_seq_id, storage_mgr);
     if(rm_version == NULL)
@@ -271,7 +277,8 @@
     rm_ns_value = sandesha2_spec_specific_consts_get_rm_ns_val(env, rm_version);
     addressing_ns_value = sandesha2_utils_get_seq_property(env, new_seq_id, 
             SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, storage_mgr);
-    response = sandesha2_create_seq_res(env, rm_ns_value, addressing_ns_value);
+    response = sandesha2_create_seq_res_create(env, rm_ns_value, 
+            addressing_ns_value);
     identifier = sandesha2_identifier_create(env, rm_ns_value);
     SANDESHA2_IDENTIFIER_SET_IDENTIFIER(identifier, env, new_seq_id);
     SANDESHA2_CREATE_SEQ_RES_SET_IDENTIFIER(response, env, identifier);
@@ -287,13 +294,13 @@
         {
             sandesha2_accept_t *accept = NULL;
             axis2_endpoint_ref_t *acks_to_epr = NULL;
-            sandesha2_acks_to = NULL;
+            sandesha2_acks_to_t *acks_to = NULL;
             sandesha2_address_t *address = NULL;
 
             accept = sandesha2_accept_create(env, rm_ns_value, addressing_ns_value);
             acks_to_epr = SANDESHA2_MSG_CTX_GET_TO(create_seq_msg, env);
-            acks_to = sandesha2_acks_to_create(env, rm_ns_value, addressing_ns_value);
-            address = sandesha2_address_create(env, addressing_ns_value);
+            address = sandesha2_address_create(env, addressing_ns_value, acks_to_epr);
+            acks_to = sandesha2_acks_to_create(env, address, rm_ns_value, addressing_ns_value);
             SANDESHA2_ADDRESS_SET_EPR(address, env, acks_to_epr);
             SANDESHA2_ACKS2_TO_SET_ADDRESS(acks_to, env, address);
             SANDESHA2_ACCEPT_SET_ACKS_TO(accept, env, acks_to);
@@ -345,7 +352,7 @@
         const axis2_env_t *env,
         sandesha2_msg_ctx_t *close_seq_msg,
         axis2_msg_ctx_t *out_msg,
-        axis2_storage_mgr_t *storage_mgr)
+        sandesha2_storage_mgr_t *storage_mgr)
 {
     axis2_conf_ctx_t *conf_ctx = NULL;
     axis2_ctx_t *ctx = NULL;

Added: webservices/sandesha/trunk/c/src/util/msg_init.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_init.c?rev=423437&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_init.c (added)
+++ webservices/sandesha/trunk/c/src/util/msg_init.c Wed Jul 19 04:15:44 2006
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#include <sandesha2_msg_init.h>
+#include <sandesha2_storage_mgr.h>
+#include <sandesha2_seq_property_mgr.h>
+#include <sandesha2_spec_specific_consts.h>
+#include <sandesha2_utils.h>
+#include <sandesha2_ack_mgr.h>
+#include <sandesha2_constants.h>
+#include <sandesha2_msg_ctx.h>
+#include <sandesha2_create_seq.h>
+#include <sandesha2_create_seq_res.h>
+#include <sandesha2_acks_to.h>
+#include <sandesha2_address.h>
+#include <sandesha2_seq_offer.h>
+#include <sandesha2_accept.h>
+#include "../client/sandesha2_client_constants.h"
+
+#include <axis2_conf_ctx.h>
+#include <axis2_ctx.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_property.h>
+#include <axis2_log.h>
+#include <axis2_uuid_gen.h>
+#include <axis2_addr.h>
+#include <axiom_soap_envelope.h>
+#include <axiom_soap_body.h>
+#include <axiom_node.h>
+
+
+/**
+ * Called to create a rmMessageContext out of an message context. Finds out things like rm version and message type
+ * as well.
+ * 
+ * @param ctx
+ * @param assumedRMNamespace
+ * this is used for validation (to find out weather the rmNamespace of the current message
+ * is equal to the regietered rmNamespace of the sequence). 
+ * If null validation will not happen.
+ * 
+ * @return
+ * @throws SandeshaException
+ */
+public static RMMsgContext initializeMessage(MessageContext ctx)
+        throws SandeshaException {
+    RMMsgContext rmMsgCtx = new RMMsgContext(ctx);
+    
+    populateRMMsgContext(ctx, rmMsgCtx);
+    validateMessage(rmMsgCtx);
+    return rmMsgCtx;
+}
+
+	/**
+	 * Adds the message parts the the RMMessageContext.
+	 * 
+	 * @param msgCtx
+	 * @param rmMsgContext
+	 */
+	private static void populateRMMsgContext(MessageContext msgCtx,
+			RMMsgContext rmMsgContext) throws SandeshaException {
+
+		//if client side and the addressing version is not set. assuming the default addressing version
+		String addressingNamespace = (String) msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+		if (addressingNamespace==null && !msgCtx.isServerSide())
+			addressingNamespace = AddressingConstants.Final.WSA_NAMESPACE;
+		
+		RMElements elements = new RMElements(addressingNamespace);
+		elements.fromSOAPEnvelope(msgCtx.getEnvelope(), msgCtx.getWSAAction());
+
+		String rmNamespace = null;
+		
+		if (elements.getCreateSequence() != null) {
+			rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ,
+					elements.getCreateSequence());
+			rmNamespace = elements.getCreateSequence().getNamespaceValue();
+		}
+
+		if (elements.getCreateSequenceResponse() != null) {
+			rmMsgContext.setMessagePart(
+					Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE, elements
+							.getCreateSequenceResponse());
+			rmNamespace = elements.getCreateSequenceResponse().getNamespaceValue();
+		}
+
+		if (elements.getSequence() != null) {
+			rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE,
+					elements.getSequence());
+			rmNamespace = elements.getSequence().getNamespaceValue();	
+		}
+
+		if (elements.getSequenceAcknowledgement() != null) {
+			rmMsgContext.setMessagePart(
+					Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT, elements
+							.getSequenceAcknowledgement());
+			rmNamespace = elements.getSequenceAcknowledgement().getNamespaceValue();
+		}
+
+		if (elements.getTerminateSequence() != null) {
+			rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ,
+					elements.getTerminateSequence());
+			rmNamespace = elements.getTerminateSequence().getNamespaceValue();
+		}
+		
+		if (elements.getTerminateSequenceResponse() != null) {
+			rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE,
+					elements.getTerminateSequenceResponse());
+			rmNamespace = elements.getTerminateSequenceResponse().getNamespaceValue();
+		}
+
+		if (elements.getAckRequested() != null) {
+			rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.ACK_REQUEST,
+					elements.getAckRequested());
+			rmNamespace = elements.getAckRequested().getNamespaceValue();
+		}
+		
+		if (elements.getCloseSequence() != null) {
+			rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE,
+					elements.getCloseSequence());
+			rmNamespace = elements.getCloseSequence().getNamespaceValue();
+		}
+		
+		if (elements.getCloseSequenceResponse() != null) {
+			rmMsgContext.setMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE_RESPONSE,
+					elements.getCloseSequenceResponse());
+			rmNamespace = elements.getCloseSequenceResponse().getNamespaceValue();
+		}
+		
+		rmMsgContext.setRMNamespaceValue(rmNamespace);
+		
+		String addressingNamespaceValue = elements.getAddressingNamespaceValue();
+		if (addressingNamespaceValue!=null)
+			rmMsgContext.setAddressingNamespaceValue(addressingNamespaceValue);
+	}
+
+	/**
+	 * This is used to validate the message.
+	 * Also set an Message type. Possible types are given in the Sandesha2Constants.MessageTypes interface.
+	 * 
+	 * @param rmMsgCtx
+	 * @return
+	 * @throws SandeshaException
+	 */
+	private static boolean validateMessage(RMMsgContext rmMsgCtx)
+			throws SandeshaException {
+
+		ConfigurationContext configContext = rmMsgCtx.getMessageContext().getConfigurationContext();
+		AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
+		StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext,axisConfiguration);
+		SequencePropertyBeanMgr sequencePropertyBeanMgr = storageManager.getSequencePropertyBeanMgr();
+		
+		String sequenceID = null;
+		
+		CreateSequence createSequence = (CreateSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ);
+		CreateSequenceResponse createSequenceResponse = (CreateSequenceResponse) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CREATE_SEQ_RESPONSE);
+		TerminateSequence terminateSequence = (TerminateSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ);
+		TerminateSequenceResponse terminateSequenceResponse = (TerminateSequenceResponse) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.TERMINATE_SEQ_RESPONSE);
+		SequenceAcknowledgement sequenceAcknowledgement = (SequenceAcknowledgement) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+		Sequence sequence = (Sequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE);
+		AckRequested ackRequest = (AckRequested) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.ACK_REQUEST);
+		CloseSequence closeSequence = (CloseSequence) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE);
+		CloseSequenceResponse closeSequenceResponse = (CloseSequenceResponse) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE_RESPONSE);
+		
+		//Setting message type.
+		if (createSequence != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ);
+		}else if (createSequenceResponse != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CREATE_SEQ_RESPONSE);
+			sequenceID = createSequenceResponse.getIdentifier().getIdentifier();
+		}else if (terminateSequence != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
+			sequenceID = terminateSequence.getIdentifier().getIdentifier();
+		}else if (terminateSequenceResponse != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ_RESPONSE);
+			sequenceID = terminateSequenceResponse.getIdentifier().getIdentifier();
+		}else if (rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.SEQUENCE) != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.APPLICATION);
+			sequenceID = sequence.getIdentifier().getIdentifier();
+		} else if (sequenceAcknowledgement != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.ACK);
+			sequenceID = sequenceAcknowledgement.getIdentifier().getIdentifier();
+		} else if (ackRequest != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.ACK_REQUEST);
+			sequenceID = ackRequest.getIdentifier().getIdentifier(); 
+		} else if (closeSequence != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CLOSE_SEQUENCE);
+			sequenceID = closeSequence.getIdentifier().getIdentifier(); 
+		} else if (closeSequenceResponse != null) {
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.CLOSE_SEQUENCE_RESPONSE);
+			sequenceID = closeSequenceResponse.getIdentifier().getIdentifier(); 
+		} else
+			rmMsgCtx.setMessageType(Sandesha2Constants.MessageTypes.UNKNOWN);
+
+		String propertyKey = null;
+		if (rmMsgCtx.getMessageContext().getFLOW()==MessageContext.IN_FLOW) {
+			propertyKey = sequenceID;
+		} else {
+			SequencePropertyBean internalSequenceIDBean = sequencePropertyBeanMgr.retrieve(sequenceID,Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID);
+			if (internalSequenceIDBean!=null) {
+				propertyKey = internalSequenceIDBean.getValue();
+			}
+		}
+		
+        String rmNamespace = rmMsgCtx.getRMNamespaceValue();
+        if (sequenceID!=null) {
+        	String specVersion = SandeshaUtil.getRMVersion(propertyKey,storageManager);
+    		
+        	String sequenceRMNamespace = null;
+        	if (specVersion!=null)
+    			sequenceRMNamespace = SpecSpecificConstants.getRMNamespaceValue(specVersion);
+    		if (sequenceRMNamespace!=null && rmNamespace!=null) {
+    			if (!sequenceRMNamespace.equals(rmNamespace)) {
+    				throw new SandeshaException ("Given message has rmNamespace value, which is different from the " +
+    						"reqistered namespace for the sequence");
+    			}
+    		}
+        }
+		
+		return true;
+	}
+
+}



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