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/20 15:01:57 UTC
svn commit: r423922 - in /webservices/sandesha/trunk/c: ./
include/sandesha2/ src/handlers/ src/msgprocessors/ src/util/
Author: damitha
Date: Thu Jul 20 06:01:56 2006
New Revision: 423922
URL: http://svn.apache.org/viewvc?rev=423922&view=rev
Log:
Added new file called msg_processor_creator.
More work on in hander
Added:
webservices/sandesha/trunk/c/src/msgprocessors/msg_processor_creator.c
Modified:
webservices/sandesha/trunk/c/configure.ac
webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h
webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c
webservices/sandesha/trunk/c/src/msgprocessors/Makefile.am
webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
webservices/sandesha/trunk/c/src/util/error.c
Modified: webservices/sandesha/trunk/c/configure.ac
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/configure.ac?rev=423922&r1=423921&r2=423922&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/configure.ac (original)
+++ webservices/sandesha/trunk/c/configure.ac Thu Jul 20 06:01:56 2006
@@ -121,6 +121,7 @@
src/wsrm/Makefile\
src/transport/Makefile\
src/workers/Makefile\
+ src/handlers/Makefile\
src/msgprocessors/Makefile\
src/storage/Makefile\
src/storage/beans/Makefile\
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=423922&r1=423921&r2=423922&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h Thu Jul 20 06:01:56 2006
@@ -63,6 +63,8 @@
SANDESHA2_ERROR_TO_ADDRESS_NOT_SET,
/* Service Context is NULL */
SANDESHA2_ERROR_SVC_CTX_NULL,
+ /* Service is NULL */
+ SANDESHA2_ERROR_SVC_NULL,
/* Result is not unique */
SANDESHA2_ERROR_NON_UNIQUE_RESULT,
/* Key is NULL. Cannot insert */
@@ -83,8 +85,6 @@
SANDESHA2_ERROR_SEQ_NOT_EXIST,
/* RM Spec version is invalid */
SANDESHA2_ERROR_INVALID_SPEC_VERSION,
- /* NULL axis2 configuration context */
- SANDESHA2_ERROR_NULL_CONF_CTX,
/* Error occured while sending ack */
SANDESHA2_ERROR_SENDING_ACK,
/* NULL to epr is specified */
@@ -176,6 +176,10 @@
* reqistered namespace for the sequence
*/
SANDESHA2_ERROR_RM_NS_VALUE_IS_DIFFERENT_FROM_REGISTERED_NS_FOR_SEQ,
+ /* Cannot initialize the message */
+ SANDESHA2_ERROR_CANNOT_INIT_MSG,
+ /* Error in processing the message */
+ SANDESHA2_ERROR_CANNOT_PROCESS_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
Modified: webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c?rev=423922&r1=423921&r2=423922&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_in_handler.c Thu Jul 20 06:01:56 2006
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-#include <axis2_sandesha2_mod.h>
-#include <axis2_sandesha2.h>
#include <axis2_handler_desc.h>
#include <axis2_array_list.h>
#include <axis2_svc.h>
@@ -26,8 +24,14 @@
#include <sandesha2_msg_ctx.h>
#include <sandesha2_transaction.h>
#include <sandesha2_msg_processor.h>
+#include <sandesha2_msg_init.h>
#include <sandesha2_constants.h>
+#include <sandesha2_utils.h>
+axis2_qname_t *AXIS2_CALL
+axis2_sandesha2_in_handler_get_qname(
+ struct axis2_handler *handler,
+ const axis2_env_t *env);
axis2_status_t AXIS2_CALL
axis2_sandesha2_in_handler_invoke(
@@ -69,9 +73,13 @@
struct axis2_msg_ctx *msg_ctx)
{
axis2_property_t *property = NULL;
+ axis2_property_t *temp_prop = NULL;
axis2_status_t status = AXIS2_FAILURE;
axis2_conf_ctx_t *conf_ctx = NULL;
- axis2_char_t *done = NULL;
+ axis2_conf_t *conf = NULL;
+ axis2_ctx_t *ctx = NULL;
+ axis2_ctx_t *temp_ctx = NULL;
+ axis2_char_t *str_done = NULL;
axis2_char_t *reinjected_msg = NULL;
axis2_char_t *within_transaction_str = NULL;
axis2_bool_t within_transaction = AXIS2_FALSE;
@@ -87,6 +95,7 @@
AXIS2_LOG_INFO(env->log, "Starting sandesha2 in handler .........");
+ temp_ctx = AXIS2_MSG_CTX_GET_BASE(msg_ctx, env);
conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
if(conf_ctx == NULL)
{
@@ -94,7 +103,141 @@
AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
return AXIS2_FAILURE;
}
+ ctx = AXIS2_MSG_CTX_GET_BASE(msg_ctx, env);
+ temp_prop = AXIS2_CTX_GET_PROPERTY(ctx, env,
+ SANDESHA2_APPLICATION_PROCESSING_DONE, AXIS2_FALSE);
+ str_done = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(temp_prop, env);
+ if(str_done && 0 == AXIS2_STRCMP(SANDESHA2_VALUE_TRUE, str_done))
+ return AXIS2_SUCCESS;
+ temp_prop = AXIS2_CTX_GET_PROPERTY(ctx, env, SANDESHA2_REINJECTED_MESSAGE,
+ AXIS2_FALSE);
+ reinjected_msg = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(temp_prop, env);
+ if(reinjected_msg && 0 == AXIS2_STRCMP(SANDESHA2_VALUE_TRUE, reinjected_msg))
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "Exit: sandesha2_in_handler::invoke, reinjected_msg");
+ return AXIS2_SUCCESS; /* Reinjected Messages are not processed by
+ sandesha2 inflow handlers */
+ }
+ conf = AXIS2_CONF_CTX_GET_CONF(conf_ctx, env);
+ storage_mgr = sandesha2_utils_get_storage_mgr(env, conf_ctx, conf);
+ temp_prop = AXIS2_CTX_GET_PROPERTY(temp_ctx, env,
+ SANDESHA2_WITHIN_TRANSACTION, AXIS2_FALSE);
+ within_transaction_str = (axis2_char_t *) AXIS2_PROPERTY_GET_VALUE(temp_prop, env);
+ if(within_transaction_str && 0 == AXIS2_STRCMP(SANDESHA2_VALUE_TRUE,
+ within_transaction_str))
+ {
+ within_transaction = AXIS2_TRUE;
+ }
+ if(AXIS2_TRUE != within_transaction)
+ {
+ axis2_property_t *prop = NULL;
+
+ transaction = SANDESHA2_STORAGE_MGR_GET_TRANSACTION(storage_mgr, env);
+ prop = axis2_property_create(env);
+ AXIS2_PROPERTY_SET_SCOPE(prop, env, AXIS2_SCOPE_APPLICATION);
+ AXIS2_PROPERTY_SET_VALUE(prop, env, SANDESHA2_VALUE_TRUE);
+ AXIS2_CTX_SET_PROPERTY(temp_ctx, env, SANDESHA2_WITHIN_TRANSACTION, prop,
+ AXIS2_FALSE);
+ }
+ svc = AXIS2_MSG_CTX_GET_SVC(msg_ctx, env);
+ if(svc == NULL)
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Axis2 Service is NULL");
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SVC_NULL, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
+ if(AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
+ {
+ /* Message should not be sent in an exception situation */
+ AXIS2_MSG_CTX_PAUSE(msg_ctx, env);
+ if(AXIS2_TRUE != within_transaction)
+ {
+ axis2_property_t *prop = NULL;
+
+ SANDESHA2_TRANSACTION_ROLLBACK(transaction, env);
+ prop = axis2_property_create(env);
+ AXIS2_PROPERTY_SET_SCOPE(prop, env, AXIS2_SCOPE_APPLICATION);
+ AXIS2_PROPERTY_SET_VALUE(prop, env, SANDESHA2_VALUE_FALSE);
+ AXIS2_CTX_SET_PROPERTY(temp_ctx, env, SANDESHA2_WITHIN_TRANSACTION,
+ prop, AXIS2_FALSE);
+ rolled_back = AXIS2_TRUE;
+
+ }
+ if(AXIS2_TRUE != within_transaction && AXIS2_TRUE != rolled_back)
+ {
+ axis2_property_t *prop = NULL;
+
+ SANDESHA2_TRANSACTION_COMMIT(transaction, env);
+ prop = axis2_property_create(env);
+ AXIS2_PROPERTY_SET_SCOPE(prop, env, AXIS2_SCOPE_APPLICATION);
+ AXIS2_PROPERTY_SET_VALUE(prop, env, SANDESHA2_VALUE_FALSE);
+ AXIS2_CTX_SET_PROPERTY(temp_ctx, env, SANDESHA2_WITHIN_TRANSACTION,
+ prop, AXIS2_FALSE);
+ }
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Cannot initialize the message");
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_INIT_MSG,
+ AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ /*
+ * TODO Validate the message
+ * SANDESHA2_MSG_VALIDATOR_VALIDATE(env, rm_msg_ctx, storage_mgr);
+ */
+ msg_processor = sandesha2_msg_processor_get_msg_processor(env, rm_msg_ctx);
+ if(msg_processor)
+ SANDESHA2_MSG_PROCESSOR_PROCESS_IN_MSG(msg_processor, env, rm_msg_ctx);
+ if(AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
+ {
+ /* Message should not be sent in an exception situation */
+ AXIS2_MSG_CTX_PAUSE(msg_ctx, env);
+ if(AXIS2_TRUE != within_transaction)
+ {
+ axis2_property_t *prop = NULL;
+
+ SANDESHA2_TRANSACTION_ROLLBACK(transaction, env);
+ prop = axis2_property_create(env);
+ AXIS2_PROPERTY_SET_SCOPE(prop, env, AXIS2_SCOPE_APPLICATION);
+ AXIS2_PROPERTY_SET_VALUE(prop, env, SANDESHA2_VALUE_FALSE);
+ AXIS2_CTX_SET_PROPERTY(temp_ctx, env, SANDESHA2_WITHIN_TRANSACTION, prop);
+ rolled_back = AXIS2_TRUE;
+ }
+ if(AXIS2_TRUE != within_transaction && AXIS2_TRUE != rolled_back)
+ {
+ axis2_property_t *prop = NULL;
+
+ SANDESHA2_TRANSACTION_COMMIT(transaction, env);
+ prop = axis2_property_create(env);
+ AXIS2_PROPERTY_SET_SCOPE(prop, env, AXIS2_SCOPE_APPLICATION);
+ AXIS2_PROPERTY_SET_VALUE(prop, env, SANDESHA2_VALUE_FALSE);
+ AXIS2_CTX_SET_PROPERTY(temp_ctx, env, SANDESHA2_WITHIN_TRANSACTION, prop);
+ }
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Error in processing the message");
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_PROCESS_MSG,
+ AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+ if(AXIS2_TRUE != within_transaction && AXIS2_TRUE != rolled_back)
+ {
+ axis2_property_t *prop = NULL;
+ SANDESHA2_TRANSACTION_COMMIT(transaction, env);
+ prop = axis2_property_create(env);
+ AXIS2_PROPERTY_SET_SCOPE(prop, env, AXIS2_SCOPE_APPLICATION);
+ AXIS2_PROPERTY_SET_VALUE(prop, env, SANDESHA2_VALUE_FALSE);
+ AXIS2_CTX_SET_PROPERTY(temp_ctx, env, SANDESHA2_WITHIN_TRANSACTION, prop);
+ }
+ AXIS2_LOG_INFO(env->log, "Exit: sandesha2_in_handler::invoke");
+
return AXIS2_SUCCESS;
+}
+
+axis2_qname_t *AXIS2_CALL
+axis2_sandesha2_in_handler_get_qname(
+ struct axis2_handler *handler,
+ const axis2_env_t *env)
+{
+ return axis2_qname_creaet(env, SANDESHA2_IN_HANDLER_NAME, NULL, NULL);
}
Modified: webservices/sandesha/trunk/c/src/msgprocessors/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/Makefile.am?rev=423922&r1=423921&r2=423922&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/Makefile.am (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/Makefile.am Thu Jul 20 06:01:56 2006
@@ -8,7 +8,9 @@
close_seq_msg_processor.c\
create_seq_res_msg_processor.c\
terminate_seq_msg_processor.c\
- terminate_seq_res_msg_processor.c
+ terminate_seq_res_msg_processor.c \
+ msg_processor_creator.c
INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/include/sandesha2 \
@AXIS2INC@
Modified: webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c?rev=423922&r1=423921&r2=423922&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Thu Jul 20 06:01:56 2006
@@ -933,7 +933,7 @@
env), env);
if(NULL == conf_ctx)
{
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_CONF_CTX, AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
return AXIS2_FAILURE;
}
ack_requested = (sandesha2_ack_requested_t*)SANDESHA2_MSG_CTX_GET_MSG_PART(
Added: webservices/sandesha/trunk/c/src/msgprocessors/msg_processor_creator.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/msg_processor_creator.c?rev=423922&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/msg_processor_creator.c (added)
+++ webservices/sandesha/trunk/c/src/msgprocessors/msg_processor_creator.c Thu Jul 20 06:01:56 2006
@@ -0,0 +1,69 @@
+/*
+ * 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/sandesha2_msg_processor.h>
+#include <sandesha2/sandesha2_seq_ack.h>
+#include <sandesha2/sandesha2_ack_requested.h>
+#include <sandesha2/sandesha2_create_seq.h>
+#include <sandesha2/sandesha2_spec_specific_consts.h>
+#include <sandesha2/sandesha2_constants.h>
+#include <sandesha2/sandesha2_utils.h>
+#include <sandesha2/sandesha2_msg_ctx.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_ack_requested.h>
+#include <sandesha2_close_seq.h>
+#include <sandesha2_close_seq_res.h>
+#include <axis2_string.h>
+#include <stdio.h>
+/**
+ * @brief Application Message Processor Creator struct impl
+ * Sandesha2 App Msg Processor Creator
+ */
+sandesha2_msg_processor_t *AXIS2_CALL
+sandesha2_msg_processor_create_msg_processor(
+ axis2_env_t *env,
+ sandesha2_msg_ctx_t *rm_msg_ctx)
+{
+ int msg_type = -1;
+
+ msg_type = SANDESHA2_MSG_CTX_GET_MSG_TYPE(rm_msg_ctx, env);
+ switch(msg_type)
+ {
+ case SANDESHA2_MSG_TYPE_CREATE_SEQ:
+ return (sandesha2_msg_processor_t *) sandesha2_create_seq_msg_processor(env);
+ case SANDESHA2_MSG_TYPE_TERMINATE_SEQ:
+ return (sandesha2_msg_processor_t *) sandesha2_terminate_seq_msg_processor(env);
+ case SANDESHA2_MSG_TYPE_TERMINATE_SEQ_RESPONSE:
+ return (sandesha2_msg_processor_t *) sandesha2_terminate_seq_res_msg_processor(env);
+ case SANDESHA2_MSG_TYPE_APPLICATION:
+ return (sandesha2_msg_processor_t *) sandesha2_app_msg_processor(env);
+ case SANDESHA2_MSG_TYPE_CREATE_SEQ_RESPONSE:
+ return (sandesha2_msg_processor_t *) sandesha2_create_seq_res_msg_processor(env);
+ case SANDESHA2_MSG_TYPE_ACK:
+ return (sandesha2_msg_processor_t *) sandesha2_ack_msg_processor(env);
+ case SANDESHA2_MSG_TYPE_CLOSE_SEQ:
+ return (sandesha2_msg_processor_t *) sandesha2_close_seq_msg_processor(env);
+ case SANDESHA2_MSG_TYPE_ACK_REQUEST:
+ return (sandesha2_msg_processor_t *) sandesha2_ack_req_msg_processor(env);
+ default :
+ return NULL;
+ }
+ return NULL;
+}
+
Modified: webservices/sandesha/trunk/c/src/util/error.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/error.c?rev=423922&r1=423921&r2=423922&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/error.c (original)
+++ webservices/sandesha/trunk/c/src/util/error.c Thu Jul 20 06:01:56 2006
@@ -79,6 +79,8 @@
/* Service Context is NULL */
sandesha2_error_messages[SANDESHA2_ERROR_SVC_CTX_NULL] =
"Service context is NULL";
+ sandesha2_error_messages[SANDESHA2_ERROR_SVC_NULL]=
+ "Service is NULL";
/* Non Unique Result */
sandesha2_error_messages[SANDESHA2_ERROR_NON_UNIQUE_RESULT] =
"Result is Not Unique";
@@ -162,6 +164,10 @@
sandesha2_error_messages[SANDESHA2_ERROR_RM_NS_VALUE_IS_DIFFERENT_FROM_REGISTERED_NS_FOR_SEQ]=
"Given message has rmNamespace value, which is different from the \
reqistered namespace for the sequence";
+ sandesha2_error_messages[SANDESHA2_ERROR_CANNOT_INIT_MSG]=
+ "Cannot initialize the message";
+ sandesha2_error_messages[SANDESHA2_ERROR_CANNOT_PROCESS_MSG]=
+ "Error in processing the message";
return AXIS2_SUCCESS;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org