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/11 13:32:40 UTC

svn commit: r420803 - in /webservices/sandesha/trunk/c: configure.ac include/sandesha2/sandesha2_error.h src/storage/inmemory/in_memory_storage_manager.c src/util/error.c

Author: damitha
Date: Tue Jul 11 04:32:39 2006
New Revision: 420803

URL: http://svn.apache.org/viewvc?rev=420803&view=rev
Log:
Fixed problems in error struct. More work on in_memory_storage_manager

Added:
    webservices/sandesha/trunk/c/src/util/error.c
Modified:
    webservices/sandesha/trunk/c/configure.ac
    webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h
    webservices/sandesha/trunk/c/src/storage/inmemory/in_memory_storage_manager.c

Modified: webservices/sandesha/trunk/c/configure.ac
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/configure.ac?rev=420803&r1=420802&r2=420803&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/configure.ac (original)
+++ webservices/sandesha/trunk/c/configure.ac Tue Jul 11 04:32:39 2006
@@ -90,14 +90,13 @@
 AC_SUBST(AXIS2INC)
 AC_SUBST(UTILINC)
 
-AC_CONFIG_FILES([Makefile
+AC_CONFIG_FILES([Makefile \
     src/Makefile \
     src/util/Makefile \
     src/wsrm/Makefile\
     src/transport/Makefile\
     src/workers/Makefile\
     src/msgprocessors/Makefile\
-    src/util/Makefile\
     src/storage/Makefile\
     src/storage/beans/Makefile\
     src/storage/inmemory/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=420803&r1=420802&r2=420803&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2/sandesha2_error.h Tue Jul 11 04:32:39 2006
@@ -90,7 +90,11 @@
         /* NULL to epr is specified */
         SANDESHA2_ERROR_NULL_TO,
         /* NULL sequnce given for processing */
-        SANDESHA2_ERROR_NULL_SEQUENCE
+        SANDESHA2_ERROR_NULL_SEQUENCE,
+        /* Storage Map not present */
+        SANDESHA2_ERROR_STORAGE_MAP_NOT_PRESENT,
+        /* Entry is not present for updating */
+        SANDESHA2_ERROR_ENTRY_IS_NOT_PRESENT_FOR_UPDATING,
         /** 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/storage/inmemory/in_memory_storage_manager.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/inmemory/in_memory_storage_manager.c?rev=420803&r1=420802&r2=420803&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/inmemory/in_memory_storage_manager.c (original)
+++ webservices/sandesha/trunk/c/src/storage/inmemory/in_memory_storage_manager.c Tue Jul 11 04:32:39 2006
@@ -356,31 +356,68 @@
     conf_ctx = sandesha2_in_memory_storage_mgr_get_ctx(storage, env);
     ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
     property = AXIS2_CTX_GET_PROPERTY(ctx, env, SANDESHA2_MSG_MAP_KEY);
+    if(!property)
+    {
+        property = axis2_property_create(env);
+    }
     storage_map = (axis2_hash_t *) AXIS2_PROPERTY_GET_VALUE(property, env);
     if(!storage_map)
     {
         storage_map = axis2_hash_make(env);
-
+        AXIS2_PROPERTY_SET_VALUE(property, env, storage_map);
+        AXIS2_CTX_SET_PROPERTY(ctx, env, SANDESHA2_MSG_MAP_KEY, property);
+    }
+    if(!key)
+    {
+        key = axis2_uuid_gen(env);
     }
+    axis2_hash_set(storage_map, key, AXIS2_HASH_KEY_STRING, msg_ctx);
+    return AXIS2_SUCCESS;
+}
+			
+axis2_status_t AXIS2_CALL
+sandesha2_in_memory_storage_mgr_update_msg_ctx(
+        sandesha2_in_memory_storage_mgr_t *storage,
+        const axis2_env_t *env,
+        axis2_char_t *key,
+        axis2_msg_ctx_t *msg_ctx)
+{
+    sandesha2_in_memory_storage_mgr_impl_t *storage_impl = NULL;
+    axis2_hash_t *storage_map = NULL;
+    axis2_property_t *property = NULL;
+    axis2_conf_ctx_t *conf_ctx = NULL;
+    axis2_ctx_t *ctx = NULL;
 
-    return (axis2_msg_ctx_t *) axis2_hash_get(storage_map, key, AXIS2_HASH_KEY_STRING);
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    storage_impl = SANDESHA2_INTF_TO_IMPL(storage);
+   
+    conf_ctx = sandesha2_in_memory_storage_mgr_get_ctx(storage, env);
+    ctx = AXIS2_CONF_CTX_GET_BASE(conf_ctx, env);
+    property = AXIS2_CTX_GET_PROPERTY(ctx, env, SANDESHA2_MSG_MAP_KEY);
+    if(!property)
+    {
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_STORAGE_MAP_NOT_PRESENT, 
+                AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }
+    storage_map = (axis2_hash_t *) AXIS2_PROPERTY_GET_VALUE(property, env);
+    if(!storage_map)
+    {
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_STORAGE_MAP_NOT_PRESENT, 
+                AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }
+    old_entry = axis2_hash_get(storage_map, key, AXIS2_HASH_KEY_STRING);
+    if(!old_entry)
+    {
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_ENTRY_IS_NOT_PRESENT_FOR_UPDATING, 
+                AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }
+    return sandesha2_in_memory_storage_mgr
+    return AXIS2_SUCCESS;
 }
 	
-
-	public void storeMessageContext(String key,MessageContext msgContext) {
-		HashMap storageMap = (HashMap) getContext().getProperty(MESSAGE_MAP_KEY);
-		
-		if (storageMap==null) {
-			storageMap = new HashMap ();
-			getContext().setProperty(MESSAGE_MAP_KEY,storageMap);
-		}
-		
-		if (key==null)
-		    key = SandeshaUtil.getUUID();
-		
-		storageMap.put(key,msgContext);
-		
-	}
 
 	public void updateMessageContext(String key,MessageContext msgContext) throws SandeshaStorageException { 
 		HashMap storageMap = (HashMap) getContext().getProperty(MESSAGE_MAP_KEY);

Added: webservices/sandesha/trunk/c/src/util/error.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/error.c?rev=420803&view=auto
==============================================================================
--- webservices/sandesha/trunk/c/src/util/error.c (added)
+++ webservices/sandesha/trunk/c/src/util/error.c Tue Jul 11 04:32:39 2006
@@ -0,0 +1,172 @@
+/*
+ * 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 <stdlib.h>
+#include <sandesha2_error.h>
+#include <axis2_error_default.h>
+
+const axis2_char_t * AXIS2_CALL 
+sandesha2_error_impl_get_message (const axis2_error_t *error);
+      
+axis2_status_t AXIS2_CALL
+sandesha2_error_impl_set_error_number (axis2_error_t *error, axis2_error_codes_t error_number);
+
+axis2_status_t AXIS2_CALL
+sandesha2_error_impl_set_status_code (axis2_error_t *error, axis2_status_codes_t status_code);
+
+axis2_status_t AXIS2_CALL
+sandesha2_error_impl_get_status_code (axis2_error_t *error);
+
+/* array to hold error messages */
+const axis2_char_t* sandesha2_error_messages[AXIS2_ERROR_LAST];
+
+axis2_status_t AXIS2_CALL
+sandesha2_error_init()
+{
+    int i = 0;
+    for (i = 0; i < AXIS2_ERROR_LAST; i++)
+    {
+        sandesha2_error_messages[i] = "Unknown Error :(";
+    }
+    sandesha2_error_messages[AXIS2_ERROR_NONE] = "No Error";
+        /* A namespace that is not supported by Sandesha2 */
+    sandesha2_error_messages[SANDESHA2_ERROR_UNSUPPORTED_NS] = 
+    "A namespace that is not supported by Sandesha2";
+    /* Object cannot generated since the om_element corresponding to
+     * that is NULL 
+     */
+    sandesha2_error_messages[SANDESHA2_ERROR_NULL_OM_ELEMENT] = 
+    "Object cannot generated since the om_element corresponding to \
+        that is NULL";
+    /* The om element has no child elements or attributes */
+    sandesha2_error_messages[SANDESHA2_ERROR_EMPTY_OM_ELEMENT] = 
+    "The om element has no child elements or attributes";
+    /*  om_element cannot be generated since the element corresponding 
+     * to that is NULL
+     */
+    sandesha2_error_messages[SANDESHA2_ERROR_TO_OM_NULL_ELEMENT] = 
+    "om_element cannot be generated since the element corresponding \
+        to that is NULL";
+    /* Required OM attribute is NULL */
+    sandesha2_error_messages[SANDESHA2_ERROR_NULL_OM_ATTRIBUTE] = 
+    "Required OM attribute is NULL";
+    /* An invalid number found during object to om conversion  */
+    sandesha2_error_messages[SANDESHA2_ERROR_TO_OM_INVALID_NUMBER] = 
+    "An invalid number found during object to om conversion";
+    /* Ack Final now allowed in the spec  */
+    sandesha2_error_messages[SANDESHA2_ERROR_ACK_FINAL_NOT_ALLOWED] = 
+    "Ack Final now allowed in the spec";
+    /* Ack None now allowed in the spec  */
+    sandesha2_error_messages[SANDESHA2_ERROR_ACK_NONE_NOT_ALLOWED] = 
+    "Ack None now allowed in the spec";
+
+    /* 'To' Address is not set */
+    sandesha2_error_messages[SANDESHA2_ERROR_TO_ADDRESS_IS_NOT_SET] = 
+        "'To' address is not set";
+    /* 'To' Address is not set */
+    sandesha2_error_messages[SANDESHA2_ERROR_SVC_CTX_IS_NULL] = 
+        "Service context is NULL";
+    /* Non Unique Result */
+    sandesha2_error_messages[SANDESHA2_ERROR_NON_UNIQUE_RESULT] = 
+        "Result is Not Unique";
+    /* Key is NULL. Cannot insert */
+    sandesha2_error_messages[SANDESHA2_ERROR_KEY_IS_NULL] = 
+        "Key is NULL, Cannot insert";
+    /* Storage Map not present */
+    sandesha2_error_messages[SANDESHA2_ERROR_STORAGE_MAP_NOT_PRESENT] = 
+        "Storage Map not present";
+    sandesha2_error_messages[SANDESHA2_ERROR_ENTRY_IS_NOT_PRESENT_FOR_UPDATING] =
+        "Entry is not present for updating";
+
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_error_impl_free (axis2_error_t *error)
+{
+    if (NULL != error && NULL != error->ops)
+    {
+        free (error->ops);
+    }
+    if (NULL != error)
+    {
+        free (error); 
+    }
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_error_t* AXIS2_CALL
+sandesha2_error_create (axis2_allocator_t * allocator)
+{
+    axis2_error_t *error = NULL;
+    if (!allocator)
+        return NULL;
+
+    error = axis2_error_create(allocator);
+
+    if (!error)
+        return NULL;
+
+    error->ops->get_extended_message = sandesha2_error_impl_get_message;
+    error->ops->set_error_number = sandesha2_error_impl_set_error_number;
+    error->ops->set_status_code = sandesha2_error_impl_set_status_code;
+    error->ops->get_status_code = sandesha2_error_impl_get_status_code;
+    error->ops->free            = sandesha2_error_impl_free;
+
+    return error;
+}
+
+const axis2_char_t * AXIS2_CALL
+sandesha2_error_impl_get_message (
+        const axis2_error_t *error)
+{
+    if (error && error->error_number >= AXIS2_ERROR_NONE && error->error_number 
+            < AXIS2_ERROR_LAST)
+    {
+        return AXIS2_ERROR_GET_MESSAGE(error);
+    }
+    else if(error && error->error_number >= SANDESHA2_ERROR_NONE && error->
+            error_number < SANDESHA2_ERROR_LAST)
+    {
+        return sandesha2_error_messages[error->error_number];
+    }
+    
+    return "Invalid Error Number";
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_error_impl_set_error_number (
+        axis2_error_t *error, 
+        axis2_error_codes_t error_number)
+{
+    error->error_number = error_number; 
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_error_impl_set_status_code (axis2_error_t *error, axis2_status_codes_t status_code)
+{
+    error->status_code = status_code; 
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+sandesha2_error_impl_get_status_code (
+        axis2_error_t *error)
+{
+    return error->status_code;
+}
+



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