You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/12/02 09:14:14 UTC

svn commit: r351628 - in /webservices/axis2/trunk/c/modules/core/addr/src: Makefile.am any_content_type.c relates_to.c

Author: samisa
Date: Fri Dec  2 00:14:07 2005
New Revision: 351628

URL: http://svn.apache.org/viewcvs?rev=351628&view=rev
Log:
Added compiling source for any content type

Added:
    webservices/axis2/trunk/c/modules/core/addr/src/any_content_type.c
Modified:
    webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am
    webservices/axis2/trunk/c/modules/core/addr/src/relates_to.c

Modified: webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am?rev=351628&r1=351627&r2=351628&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am Fri Dec  2 00:14:07 2005
@@ -1,6 +1,6 @@
 lib_LTLIBRARIES = libaxis2_addr.la
 AM_CPPFLAGS = $(CPPFLAGS)
-libaxis2_addr_la_SOURCES = relates_to.c svc_name.c
+libaxis2_addr_la_SOURCES = relates_to.c svc_name.c any_content_type.c
 
 libaxis2_addr_la_LIBADD = $(LDFLAGS)
 INCLUDES = -I${CUTEST_HOME}/include \

Added: webservices/axis2/trunk/c/modules/core/addr/src/any_content_type.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/addr/src/any_content_type.c?rev=351628&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/addr/src/any_content_type.c (added)
+++ webservices/axis2/trunk/c/modules/core/addr/src/any_content_type.c Fri Dec  2 00:14:07 2005
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ */
+ 
+ /** <wsa:RelatesTo RelationshipType="..."?>xs:anyURI</wsa:RelatesTo> */
+
+#include <axis2_any_content_type.h>
+#include <axis2_string.h>
+
+typedef struct axis2_any_content_type_impl
+{
+    axis2_any_content_type_t any_content_type;    
+    /** map of values in the any contetnt type  */
+    axis2_hash_t *value_map;
+} axis2_any_content_type_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(any_content_type) ((axis2_any_content_type_impl_t *)any_content_type)
+
+axis2_status_t AXIS2_CALL axis2_any_content_type_add_value(struct axis2_any_content_type *any_content_type, axis2_env_t **env, axis2_qname_t *qname, axis2_char_t *value); 
+axis2_char_t* AXIS2_CALL axis2_any_content_type_get_value(struct axis2_any_content_type *any_content_type, axis2_env_t **env, axis2_qname_t *qname);
+axis2_hash_t* AXIS2_CALL axis2_any_content_type_get_value_map(struct axis2_any_content_type *any_content_type, axis2_env_t **env);
+axis2_status_t AXIS2_CALL axis2_any_content_type_free (struct axis2_any_content_type *any_content_type, 
+                                               axis2_env_t **env);
+
+
+axis2_any_content_type_t* AXIS2_CALL axis2_any_content_type_create(axis2_env_t **env) 
+{
+    axis2_any_content_type_impl_t *any_content_type_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    any_content_type_impl = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_any_content_type_impl_t) );
+    if (!any_content_type_impl)
+    { 
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;        
+    }
+
+    any_content_type_impl->any_content_type.ops = NULL;
+    any_content_type_impl->value_map = NULL;
+    
+    any_content_type_impl->value_map  = axis2_hash_make(env);
+    
+    if (!(any_content_type_impl->value_map ))
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        axis2_any_content_type_free(&(any_content_type_impl->any_content_type), env);
+        return NULL;        
+    }
+    
+    /* initialize operations */
+    any_content_type_impl->any_content_type.ops  = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_any_content_type_ops_t) );
+    if (!any_content_type_impl->any_content_type.ops)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        axis2_any_content_type_free(&(any_content_type_impl->any_content_type), env);
+        return NULL;        
+    }
+
+    any_content_type_impl->any_content_type.ops->add_value = axis2_any_content_type_add_value;
+    any_content_type_impl->any_content_type.ops->get_value = axis2_any_content_type_get_value;
+    any_content_type_impl->any_content_type.ops->get_value_map = axis2_any_content_type_get_value_map;
+    any_content_type_impl->any_content_type.ops->free = axis2_any_content_type_free;
+    
+    return &(any_content_type_impl->any_content_type);
+}
+
+/**
+ * Method addReferenceValue
+ *
+ * @param name
+ * @param value
+ */
+axis2_status_t AXIS2_CALL axis2_any_content_type_add_value(struct axis2_any_content_type *any_content_type, axis2_env_t **env, axis2_qname_t *qname, axis2_char_t *value) 
+{
+    axis2_any_content_type_impl_t *any_content_type_impl = NULL;
+    
+    AXIS2_FUNC_PARAM_CHECK(any_content_type, env, AXIS2_FAILURE);
+    
+    any_content_type_impl = AXIS2_INTF_TO_IMPL(any_content_type);
+    
+    if (any_content_type_impl->value_map)
+    {
+        axis2_hash_set(any_content_type_impl->value_map, qname, sizeof(axis2_qname_t), value);
+    }
+    return AXIS2_SUCCESS;
+}
+
+/**
+ * Method getReferenceValue
+ *
+ * @param qname
+ * @return
+ */
+axis2_char_t* AXIS2_CALL axis2_any_content_type_get_value(struct axis2_any_content_type *any_content_type, axis2_env_t **env, axis2_qname_t *qname) 
+{
+    axis2_any_content_type_impl_t *any_content_type_impl = NULL;
+    
+    AXIS2_FUNC_PARAM_CHECK(any_content_type, env, NULL);
+    
+    any_content_type_impl = AXIS2_INTF_TO_IMPL(any_content_type);
+    
+    if (any_content_type_impl->value_map)
+    {
+        return axis2_hash_get(any_content_type_impl->value_map, qname, sizeof(axis2_qname_t));
+    }
+    return NULL;
+}
+
+axis2_hash_t* AXIS2_CALL axis2_any_content_type_get_value_map(struct axis2_any_content_type *any_content_type, axis2_env_t **env) 
+{
+    AXIS2_FUNC_PARAM_CHECK(any_content_type, env, NULL);
+    return AXIS2_INTF_TO_IMPL(any_content_type)->value_map;
+}
+
+axis2_status_t AXIS2_CALL axis2_any_content_type_free (struct axis2_any_content_type *any_content_type, 
+                                               axis2_env_t **env)
+{
+    axis2_any_content_type_impl_t *any_content_type_impl = NULL;
+    
+    AXIS2_FUNC_PARAM_CHECK(any_content_type, env, AXIS2_FAILURE);
+    
+    any_content_type_impl = AXIS2_INTF_TO_IMPL(any_content_type);
+    
+    if (any_content_type_impl->any_content_type.ops)
+    {
+        AXIS2_FREE((*env)->allocator, any_content_type_impl->any_content_type.ops);
+        any_content_type_impl->any_content_type.ops = NULL;
+    }
+    
+    if (any_content_type_impl->value_map)
+    {
+        axis2_hash_free(any_content_type_impl->value_map, env);
+        any_content_type_impl->value_map = NULL;
+    }    
+    
+    AXIS2_FREE((*env)->allocator, any_content_type_impl);
+    any_content_type_impl = NULL;
+    
+    return AXIS2_SUCCESS;
+}

Modified: webservices/axis2/trunk/c/modules/core/addr/src/relates_to.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/addr/src/relates_to.c?rev=351628&r1=351627&r2=351628&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/addr/src/relates_to.c (original)
+++ webservices/axis2/trunk/c/modules/core/addr/src/relates_to.c Fri Dec  2 00:14:07 2005
@@ -86,6 +86,10 @@
         return NULL;        
     }
 
+    relates_to_impl->relates_to.ops->get_value = axis2_relates_to_get_value;
+    relates_to_impl->relates_to.ops->set_value = axis2_relates_to_set_value;
+    relates_to_impl->relates_to.ops->get_relationship_type = axis2_relates_to_get_relationship_type;
+    relates_to_impl->relates_to.ops->set_relationship_type = axis2_relates_to_set_relationship_type;
     relates_to_impl->relates_to.ops->free = axis2_relates_to_free;
 
     return &(relates_to_impl->relates_to);