axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r388891 [1/2] - in /webservices/axis2/trunk/c: ./ include/ modules/xml/ modules/xml/attachments/ modules/xml/om/
Date Sun, 26 Mar 2006 10:00:09 GMT
Author: samisa
Date: Sun Mar 26 02:00:06 2006
New Revision: 388891

URL: http://svn.apache.org/viewcvs?rev=388891&view=rev
Log:
Applied the MTOM related patch. Thanks to Kapila for the patch.

Added:
    webservices/axis2/trunk/c/modules/xml/attachments/
    webservices/axis2/trunk/c/modules/xml/attachments/Makefile.am
    webservices/axis2/trunk/c/modules/xml/attachments/attachments_mime_helper.c
    webservices/axis2/trunk/c/modules/xml/attachments/axis2_data_handler.h
    webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_body_part.h
    webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_output.h
    webservices/axis2/trunk/c/modules/xml/attachments/data_handler.c
    webservices/axis2/trunk/c/modules/xml/attachments/mime_body_part.c
    webservices/axis2/trunk/c/modules/xml/attachments/mime_output.c
    webservices/axis2/trunk/c/modules/xml/om/axis2_om_output_format.h
    webservices/axis2/trunk/c/modules/xml/om/om_output_format.c
Modified:
    webservices/axis2/trunk/c/configure.ac
    webservices/axis2/trunk/c/include/axis2_om_output.h
    webservices/axis2/trunk/c/include/axis2_om_text.h
    webservices/axis2/trunk/c/modules/xml/Makefile.am
    webservices/axis2/trunk/c/modules/xml/om/Makefile.am
    webservices/axis2/trunk/c/modules/xml/om/om_output.c
    webservices/axis2/trunk/c/modules/xml/om/om_text.c

Modified: webservices/axis2/trunk/c/configure.ac
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/configure.ac?rev=388891&r1=388890&r2=388891&view=diff
==============================================================================
--- webservices/axis2/trunk/c/configure.ac (original)
+++ webservices/axis2/trunk/c/configure.ac Sun Mar 26 02:00:06 2006
@@ -213,6 +213,7 @@
     modules/xml/parser/libxml2/Makefile \
     modules/xml/soap/Makefile \
     modules/xml/om/Makefile \
+    modules/xml/attachments/Makefile \
     modules/util/Makefile \
     modules/platforms/unix/Makefile \
     modules/wsdl/Makefile \

Modified: webservices/axis2/trunk/c/include/axis2_om_output.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_output.h?rev=388891&r1=388890&r2=388891&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_output.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_output.h Sun Mar 26 02:00:06 2006
@@ -45,6 +45,7 @@
     */
     typedef struct axis2_om_output axis2_om_output_t;
     typedef struct axis2_om_output_ops axis2_om_output_ops_t;
+    struct axis2_om_text;
     
 AXIS2_DECLARE_DATA struct axis2_om_output_ops
 {
@@ -140,6 +141,14 @@
 	axis2_status_t (AXIS2_CALL *
 	write_xml_version_encoding)(axis2_om_output_t *om_output,
 							    axis2_env_t **env);
+
+    axis2_bool_t (AXIS2_CALL *is_optimized)
+                                  (axis2_om_output_t *om_output,
+                                   axis2_env_t **env);                               
+
+    axis2_char_t* (AXIS2_CALL *get_next_content_id)
+                                    (axis2_om_output_t *om_output,
+                                    axis2_env_t **env);
 };  
     
 
@@ -176,6 +185,11 @@
                       axis2_env_t **env,
                       axis2_om_types_t type,
                       int no_of_args, ...);
+                      
+AXIS2_DECLARE(axis2_status_t)
+axis2_om_output_write_optimized(axis2_om_output_t *om_output, 
+                      axis2_env_t **env, 
+                      struct axis2_om_text *om_text);
 /************** Macros ********************************************************/
 
 #define AXIS2_OM_OUTPUT_FREE(output, env) \
@@ -216,6 +230,13 @@
 
 #define AXIS2_OM_OUTPUT_WRITE_XML_VERSION_ENCODING(output, env) \
         ((output)->ops->write_xml_version_encoding(output, env))
+
+#define AXIS2_OM_OUTPUT_IS_OPTIMIZED(output, env) \
+        ((output)->ops->is_optimized(output, env))
+
+#define AXIS2_OM_OUTPUT_GET_NEXT_CONTENT_ID(om_output, env) \
+        ((om_output)->ops->get_next_content_id(om_output, env))
+
    
 /** @} */
 

Modified: webservices/axis2/trunk/c/include/axis2_om_text.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_text.h?rev=388891&r1=388890&r2=388891&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_text.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_text.h Sun Mar 26 02:00:06 2006
@@ -91,6 +91,15 @@
         get_value)(struct axis2_om_text *om_text,
                    axis2_env_t **env);                                               
                                                
+        axis2_status_t (AXIS2_CALL *
+        set_optimize)(struct axis2_om_text *om_text,
+                        axis2_env_t **env,
+                        const axis2_bool_t optimize);
+
+        axis2_status_t (AXIS2_CALL *
+        set_is_binary)(struct axis2_om_text *om_text,
+                        axis2_env_t **env,
+                        const axis2_bool_t is_binary);
                                                                                                 
     } axis2_om_text_ops_t;
 
@@ -136,6 +145,10 @@
 /** set text value */
 #define AXIS2_OM_TEXT_SET_VALUE(om_text, env, value) \
         ((om_text)->ops->set_value(om_text, env, value))
+#define AXIS2_OM_TEXT_SET_OPTIMIZE(om_text, env, optimize) \
+        ((om_text)->ops->set_optimize(om_text, env, optimize))
+#define AXIS2_OM_TEXT_SET_IS_BINARY(om_text, env, is_binary) \
+        ((om_text)->ops->set_is_binary(om_text, env, is_binary))    
               
 
 

Modified: webservices/axis2/trunk/c/modules/xml/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/Makefile.am?rev=388891&r1=388890&r2=388891&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/xml/Makefile.am Sun Mar 26 02:00:06 2006
@@ -1,2 +1,2 @@
 TESTS =
-SUBDIRS = parser om soap
+SUBDIRS = parser om soap attachments

Added: webservices/axis2/trunk/c/modules/xml/attachments/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/attachments/Makefile.am?rev=388891&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/attachments/Makefile.am (added)
+++ webservices/axis2/trunk/c/modules/xml/attachments/Makefile.am Sun Mar 26 02:00:06 2006
@@ -0,0 +1,12 @@
+TESTS =
+lib_LTLIBRARIES = libaxis2_attachments.la
+AM_CPPFLAGS = $(CPPFLAGS)
+libaxis2_attachments_la_SOURCES = mime_output.c \
+					data_handler.c \
+					mime_body_part.c	
+
+libaxis2_attachments_la_LIBADD =  ../../util/libaxis2_util.la 
+INCLUDES = -I$(top_builddir)/include \
+            -I$(top_builddir)/modules/util \
+            -I$(top_builddir)/modules/xml/parser \
+            -I$(top_builddir)/modules/platforms

Added: webservices/axis2/trunk/c/modules/xml/attachments/attachments_mime_helper.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/attachments/attachments_mime_helper.c?rev=388891&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/attachments/attachments_mime_helper.c (added)
+++ webservices/axis2/trunk/c/modules/xml/attachments/attachments_mime_helper.c Sun Mar 26 02:00:06 2006
@@ -0,0 +1,122 @@
+/*
+ * 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 <axis2_om_text.h>
+#include <axis2_om_output.h>
+#include <axis2_string.h>
+
+/* ops */
+axis2_status_t AXIS2_CALL
+axis2_om_text_free (axis2_om_text_t * om_text,
+                    axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL 
+axis2_om_text_serialize (axis2_om_text_t * om_text,
+                         axis2_env_t **env,
+                         axis2_om_output_t * om_output);
+
+
+
+
+AXIS2_DECLARE(axis2_om_text_t*)
+axis2_om_text_create (axis2_env_t **env,
+                      axis2_om_node_t * parent,
+                      const axis2_char_t * value,
+                      axis2_om_node_t **node)
+{
+
+    axis2_om_text_impl_t *om_text = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK((*env)->error, node, NULL);
+
+    *node = axis2_om_node_create (env);
+
+    if (!(*node))
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+    
+    om_text = (axis2_om_text_impl_t *) AXIS2_MALLOC ((*env)->allocator,
+                                          sizeof (axis2_om_text_impl_t));
+
+    if (!om_text)
+    {
+        AXIS2_FREE ((*env)->allocator, *node);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    om_text->value = NULL;
+    if (value)
+        om_text->value = (axis2_char_t *) AXIS2_STRDUP(value,env);
+
+    /* om_text->attribute = NULL; */
+    om_text->content_id = NULL;
+    om_text->mime_type = NULL;
+
+    AXIS2_OM_NODE_SET_DATA_ELEMENT((*node), env, om_text);
+    AXIS2_OM_NODE_SET_NODE_TYPE((*node), env, AXIS2_OM_TEXT);
+    AXIS2_OM_NODE_SET_BUILD_STATUS((*node), env, AXIS2_FALSE);
+
+    if (parent && AXIS2_OM_NODE_GET_NODE_TYPE(parent, env) == AXIS2_OM_ELEMENT)
+    {
+        AXIS2_OM_NODE_SET_PARENT((*node), env, parent);
+        AXIS2_OM_NODE_ADD_CHILD (parent, env, (*node));
+    }
+
+    /* ops */
+    om_text->om_text.ops = NULL;
+    om_text->om_text.ops = (axis2_om_text_ops_t *) AXIS2_MALLOC((*env)->allocator,
+                                              sizeof (axis2_om_text_ops_t));
+
+    if (!om_text->om_text.ops)
+    {
+        AXIS2_FREE ((*env)->allocator, om_text->value);
+        AXIS2_FREE ((*env)->allocator, om_text);
+        AXIS2_FREE ((*env)->allocator, *node);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    om_text->om_text.ops->free = axis2_om_text_free;
+    om_text->om_text.ops->serialize = axis2_om_text_serialize;
+    om_text->om_text.ops->set_value = axis2_om_text_set_value;
+    om_text->om_text.ops->get_value = axis2_om_text_get_value;
+
+    return &(om_text->om_text);
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_om_text_free (axis2_om_text_t * om_text,
+                    axis2_env_t **env)
+{
+    AXIS2_FUNC_PARAM_CHECK(om_text, env, AXIS2_FAILURE);
+
+    if (AXIS2_INTF_TO_IMPL(om_text)->value)
+        AXIS2_FREE ((*env)->allocator, AXIS2_INTF_TO_IMPL(om_text)->value);
+
+    if (om_text->ops)
+        AXIS2_FREE ((*env)->allocator, om_text->ops);
+
+    if (om_text)
+        AXIS2_FREE ((*env)->allocator, AXIS2_INTF_TO_IMPL(om_text));
+
+    return AXIS2_SUCCESS;
+}
+

Added: webservices/axis2/trunk/c/modules/xml/attachments/axis2_data_handler.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/attachments/axis2_data_handler.h?rev=388891&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/attachments/axis2_data_handler.h (added)
+++ webservices/axis2/trunk/c/modules/xml/attachments/axis2_data_handler.h Sun Mar 26 02:00:06 2006
@@ -0,0 +1,116 @@
+/*
+ * 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 AXIS2_DATA_HANDLER_H
+#define AXIS2_DATA_HANDLER_H
+
+/**
+ * @file axis2_data_handler.h
+ * @brief axis2 data_handler interface
+ */
+
+#include <axis2.h>
+#include <axis2_error.h>
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axis2_allocator.h>
+#include <axis2_string.h>
+#include <axis2_array_list.h>
+#include <axis2_handler_desc.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/* This should be moved to header file later axis2_defines.h*/    
+#define axis2_byte_t char
+	
+typedef struct axis2_data_handler_ops axis2_data_handler_ops_t;
+typedef struct axis2_data_handler axis2_data_handler_t;	
+
+/*
+      private final DataSource ds;
+      private final DataFlavor flavor;
+      private CommandMap commandMap;
+      private DataContentHandler dch;
+*/
+
+/** @defgroup axis2_data_handler Flow
+  * @ingroup axis2_data_handler
+  * @{
+  */
+
+/** 
+ * @brief Flow ops struct
+ * Encapsulator struct for ops of axis2_data_handler
+ */
+struct axis2_data_handler_ops
+{
+	axis2_char_t * (AXIS2_CALL *get_content_type)(axis2_data_handler_t *data_handler, axis2_env_t **env); 
+	
+	axis2_byte_t * (AXIS2_CALL *get_input_stream)(axis2_data_handler_t *data_handler, axis2_env_t **env); 
+
+	axis2_status_t (AXIS2_CALL *write_to)(axis2_data_handler_t *data_handler, axis2_env_t **env, \
+							axis2_byte_t output_stream);
+
+	/** Deallocate memory
+     * @return status code
+     */
+    axis2_status_t (AXIS2_CALL *free) (axis2_data_handler_t *data_handler, axis2_env_t **env);
+};
+
+/** 
+ * @brief Flow struct
+ *	Flow  
+ */ 
+struct axis2_data_handler
+{
+	axis2_data_handler_ops_t *ops;
+	
+	/*
+    axis2_char_t type;
+    *void handler;	
+	*/
+};
+
+/**
+ * Creates data_handler struct
+ * @return pointer to newly created data_handler
+ */
+AXIS2_DECLARE(axis2_data_handler_t *) 
+axis2_data_handler_create (axis2_env_t **env, void *data, axis2_char_t *data_type);
+
+/*************************** Function macros **********************************/
+
+#define AXIS2_DATA_HANDLER_FREE(data_handler, env) ((data_handler)->ops->free (data_handler, env))
+
+#define AXIS2_DATA_HANDLER_GET_CONTENT_TYPE(data_handler, env) ((data_handler)->ops->get_content_type (data_handler, env))
+
+#define AXIS2_DATA_HANDLER_GET_INPUT_STREAM(data_handler, env) ((data_handler)->ops->get_input_stream (data_handler, env))
+
+#define AXIS2_DATA_HANDLER_WRITE_TO(data_handler, env, output_stream) ((data_handler)->ops->write_to (data_handler, env, output_stream));
+
+/*************************** End of function macros ***************************/
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+#endif  /* AXIS2_DATA_HANDLER_H */

Added: webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_body_part.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_body_part.h?rev=388891&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_body_part.h (added)
+++ webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_body_part.h Sun Mar 26 02:00:06 2006
@@ -0,0 +1,112 @@
+/*
+ * 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 AXIS2_MIME_BODY_PART_H
+#define AXIS2_MIME_BODY_PART_H
+
+/**
+ * @file axis2_mime_body_part.h
+ * @brief axis2 mime_body_part interface
+ */
+
+#include <axis2.h>
+#include <axis2_error.h>
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axis2_allocator.h>
+#include <axis2_string.h>
+#include <axis2_array_list.h>
+#include <axis2_handler_desc.h>
+#include <axis2_data_handler.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/* This should be moved to header file later axis2_defines.h*/    
+#define axis2_byte_t char
+	
+typedef struct axis2_mime_body_part_ops axis2_mime_body_part_ops_t;
+typedef struct axis2_mime_body_part axis2_mime_body_part_t;	
+
+/*
+      private final DataSource ds;
+      private final DataFlavor flavor;
+      private CommandMap commandMap;
+      private DataContentHandler dch;
+*/
+
+/** @defgroup axis2_mime_body_part Flow
+  * @ingroup axis2_mime_body_part
+  * @{
+  */
+
+/** 
+ * @brief Flow ops struct
+ * Encapsulator struct for ops of axis2_mime_body_part
+ */
+struct axis2_mime_body_part_ops
+{
+	axis2_status_t (AXIS2_CALL *add_header)(axis2_mime_body_part_t *mime_body_part, axis2_env_t **env, axis2_char_t *name, axis2_char_t *value); 
+	
+    axis2_status_t (AXIS2_CALL *set_data_handler)(axis2_mime_body_part_t *mime_body_part, axis2_env_t **env, axis2_data_handler_t *data_handler); 
+
+    axis2_status_t (AXIS2_CALL *write_to)(axis2_mime_body_part_t *mime_body_part, axis2_env_t **env,axis2_byte_t **output_stream, int *output_stream_size, axis2_char_t *ignore_list); 
+
+	/** Deallocate memory
+     * @return status code
+     */
+    axis2_status_t (AXIS2_CALL *free) (axis2_mime_body_part_t *mime_body_part, axis2_env_t **env);
+};
+
+/** 
+ * @brief Flow struct
+ *	Flow  
+ */ 
+struct axis2_mime_body_part
+{
+	axis2_mime_body_part_ops_t *ops;
+	
+};
+
+/**
+ * Creates mime_body_part struct
+ * @return pointer to newly created mime_body_part
+ */
+AXIS2_DECLARE(axis2_mime_body_part_t *) 
+axis2_mime_body_part_create (axis2_env_t **env);
+
+/*************************** Function macros **********************************/
+
+#define AXIS2_MIME_BODY_PART_FREE(mime_body_part, env) ((mime_body_part)->ops->free (mime_body_part, env))
+
+#define AXIS2_MIME_BODY_PART_ADD_HEADER(mime_body_part, env, name, value) ((mime_body_part)->ops->add_header (mime_body_part, env, name, value))
+
+#define AXIS2_MIME_BODY_PART_SET_DATA_HANDLER(mime_body_part, env, data_handler) ((mime_body_part)->ops->set_data_handler (mime_body_part, env, data_handler))
+
+#define AXIS2_MIME_BODY_WRITE_TO(mime_body_part, env, output_stream, output_stream_size, ignore_list)
+
+
+/*************************** End of function macros ***************************/
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+#endif  /* AXIS2_MIME_BODY_PART_H */

Added: webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_output.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_output.h?rev=388891&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_output.h (added)
+++ webservices/axis2/trunk/c/modules/xml/attachments/axis2_mime_output.h Sun Mar 26 02:00:06 2006
@@ -0,0 +1,110 @@
+/*
+ * 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 AXIS2_MIME_OUTPUT_H
+#define AXIS2_MIME_OUTPUT_H
+
+/**
+ * @file axis2_mime_output.h
+ * @brief axis2 mime_output interface
+ */
+
+#include <axis2.h>
+#include <axis2_error.h>
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axis2_allocator.h>
+#include <axis2_string.h>
+#include <axis2_array_list.h>
+#include <axis2_handler_desc.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* This should be moved to header file later axis2_defines.h*/    
+#define axis2_byte_t char
+	
+typedef struct axis2_mime_output_ops axis2_mime_output_ops_t;
+typedef struct axis2_mime_output axis2_mime_output_t;	
+	
+
+/** @defgroup axis2_mime_output Flow
+  * @ingroup axis2_mime_output
+  * @{
+  */
+
+/** 
+ * @brief Flow ops struct
+ * Encapsulator struct for ops of axis2_mime_output
+ */
+struct axis2_mime_output_ops
+{
+
+    axis2_byte_t* (AXIS2_CALL *complete)(axis2_mime_output_t *mime_output,
+                            axis2_env_t **env, axis2_byte_t **output_stream, 
+                            axis2_char_t *string_to_write, 
+                            axis2_array_list_t *binary_node_list,
+                            axis2_char_t *boundary, axis2_char_t *content_id,
+                            axis2_char_t *char_set_encoding,axis2_char_t *soap_content_type);
+
+    axis2_char_t* (AXIS2_CALL *get_content_type_for_mime)(axis2_mime_output_t *mime_output, axis2_env_t **env, 
+                        axis2_char_t *boundary, axis2_char_t *content_id, axis2_char_t *char_set_encoding, axis2_char_t *soap_content_type);
+    
+	/** Deallocate memory
+     * @return status code
+     */
+    axis2_status_t (AXIS2_CALL *free) (axis2_mime_output_t *mime_output,
+                            axis2_env_t **env);
+
+};
+
+/** 
+ * @brief Flow struct
+ *	Flow  
+ */ 
+struct axis2_mime_output
+{
+	axis2_mime_output_ops_t *ops;
+};
+
+/**
+ * Creates mime_output struct
+ * @return pointer to newly created mime_output
+ */
+AXIS2_DECLARE(axis2_mime_output_t *) 
+axis2_mime_output_create (axis2_env_t **env);
+
+/*************************** Function macros **********************************/
+
+#define AXIS2_MIME_OUTPUT_FREE(mime_output, env) ((mime_output)->ops->free (mime_output, env))
+
+#define AXIS2_MIME_OUTPUT_COMPLETE(mime_output, env, output_stream, output_stream_size, string_to_write, binary_node_list, boundary, content_id, char_set_encoding, soap_content_type) \
+((mime_output)->ops->complete(mime_output, env, output_stream, output_stream_size, string_to_write, boundary, binary_node_list, content_id, char_set_encoding, soap_content_type))
+
+#define AXIS2_MIME_OUTPUT_GET_CONTENT_TYPE_FOR_MIME(mime_output, env, boundary, content_id, char_set_encoding, soap_content_type) \
+((mime_output)->ops->get_content_type_for_mime(mime_output, env, boundary, content_id, char_set_encoding, soap_content_type))
+
+/*************************** End of function macros ***************************/
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+#endif  /* AXIS2_MIME_OUTPUT_H */

Added: webservices/axis2/trunk/c/modules/xml/attachments/data_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/attachments/data_handler.c?rev=388891&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/attachments/data_handler.c (added)
+++ webservices/axis2/trunk/c/modules/xml/attachments/data_handler.c Sun Mar 26 02:00:06 2006
@@ -0,0 +1,407 @@
+/*
+ * 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
+ *data_handler
+ * 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 <axis2_data_handler.h>
+
+/** 
+ * @brief Flow struct impl
+ *	Axis2 Flow impl  
+ */
+typedef struct axis2_data_handler_impl
+{
+	axis2_data_handler_t data_handler;
+    /**
+     * Field list
+     */
+    /*   
+	axis2_char_t type;
+    *void handler;
+	*/
+} axis2_data_handler_impl_t;
+
+
+
+#define AXIS2_INTF_TO_IMPL(data_handler) ((axis2_data_handler_impl_t *)(data_handler))
+
+/***************************** Function headers *******************************/
+
+axis2_status_t AXIS2_CALL
+axis2_data_handler_free (axis2_data_handler_t *data_handler, axis2_env_t **env);
+
+axis2_char_t * AXIS2_CALL
+axis2_data_handler_get_content_type (axis2_data_handler_t *data_handler, axis2_env_t **env);
+
+axis2_byte_t * AXIS2_CALL
+axis2_data_handler_get_input_stream (axis2_data_handler_t *data_handler, axis2_env_t **env); 
+
+axis2_status_t AXIS2_CALL
+axis2_data_handler_write_to(axis2_data_handler_t *data_handler, axis2_env_t **env, \
+							axis2_byte_t output_stream);
+
+/************************** End of Function headers ************************/
+
+AXIS2_DECLARE(axis2_data_handler_t *)
+axis2_data_handler_create (axis2_env_t **env, void *data, axis2_char_t *data_type)
+{
+    axis2_data_handler_impl_t *data_handler_impl = NULL;
+    
+	AXIS2_ENV_CHECK(env, NULL);
+	data_handler_impl = (axis2_data_handler_impl_t *) AXIS2_MALLOC((*env)->allocator, 
+        sizeof(axis2_data_handler_impl_t));
+		
+	if(NULL == data_handler_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+	
+    data_handler_impl->data_handler.ops = NULL;
+    
+	data_handler_impl->data_handler.ops = AXIS2_MALLOC ((*env)->allocator, 
+        sizeof(axis2_data_handler_ops_t));
+	if(NULL == data_handler_impl->data_handler.ops)
+    {
+        axis2_data_handler_free(&(data_handler_impl->data_handler), env);
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+	data_handler_impl->data_handler.ops->free =  axis2_data_handler_free;
+    data_handler_impl->data_handler.ops->get_content_type = axis2_data_handler_get_content_type;
+    data_handler_impl->data_handler.ops->get_input_stream = axis2_data_handler_get_input_stream;
+    data_handler_impl->data_handler.ops->write_to = axis2_data_handler_write_to;
+	return &(data_handler_impl->data_handler);
+}
+
+/*************************** Start of op impls *************************/
+
+axis2_status_t AXIS2_CALL
+axis2_data_handler_free (axis2_data_handler_t *data_handler, axis2_env_t **env)
+{
+    axis2_data_handler_impl_t *data_handler_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    data_handler_impl = AXIS2_INTF_TO_IMPL(data_handler);
+    
+    if(NULL != data_handler->ops)
+    {
+        AXIS2_FREE((*env)->allocator, data_handler->ops);
+        data_handler->ops = NULL;
+    }
+    
+    if(data_handler_impl)
+    {
+        AXIS2_FREE((*env)->allocator, data_handler_impl);
+        data_handler_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+axis2_char_t * AXIS2_CALL
+axis2_data_handler_get_content_type (axis2_data_handler_t *data_handler, axis2_env_t **env) 
+{
+    AXIS2_ENV_CHECK(env, NULL);       
+	
+	/*@TODO implement the following*/
+	return "";
+}
+
+axis2_byte_t * AXIS2_CALL
+axis2_data_handler_get_input_stream (axis2_data_handler_t *data_handler, axis2_env_t **env) 
+{
+    AXIS2_ENV_CHECK(env, NULL);       
+	
+	/*@TODO implement the following*/
+	/**
+	InputStream getInputStream()
+	final DataContentHandler dch = getDataContentHandler();
+             if (dch == null) {
+                 throw new UnsupportedDataTypeException();
+           }
+             final PipedInputStream is = new PipedInputStream();
+             Thread thread = new Thread() {
+                 public void run() {
+                     try {
+                         PipedOutputStream os = new PipedOutputStream(is);
+                        is.connect(os);
+                         try {
+                             dch.writeTo(data, mimeType, os);
+                         } finally {
+                            os.close();
+                         }
+                     } catch (IOException e) {
+                         // ignore, per spec - doh!
+                     }
+                 }
+             };
+             thread.start();
+             return is;
+	*/		
+	return "";
+}
+
+axis2_status_t AXIS2_CALL
+axis2_data_handler_write_to(axis2_data_handler_t *data_handler, axis2_env_t **env, \
+							axis2_byte_t output_stream)
+{
+	/**
+          if (ds instanceof ObjectDataSource) {
+              ObjectDataSource ods = (ObjectDataSource) ds;
+              DataContentHandler dch = getDataContentHandler();
+              if (dch == null) {
+                  throw new UnsupportedDataTypeException();
+              }
+              dch.writeTo(ods.data, ods.mimeType, os);
+          } else {
+              byte[] buffer = new byte[1024];
+              InputStream is = getInputStream();
+              try {
+                  int count;
+                  while ((count = is.read(buffer)) != -1) {
+                      os.write(buffer, 0, count);
+                  }
+              } finally {
+                  is.close();
+              }
+          }
+	*/  
+}
+
+/* Private Functions */
+
+
+/* ========================================================================= */
+/*
+55      public DataSource getDataSource() {
+56          return ds;
+57      }
+58  
+59      public String getName() {
+60          return ds.getName();
+61      }
+62  
+
+	
+66  
+70  
+
+92  
+93      public OutputStream getOutputStream() throws IOException {
+94          return ds.getOutputStream();
+95      }
+96  
+97      public synchronized DataFlavor[] getTransferDataFlavors() {
+98          return getDataContentHandler().getTransferDataFlavors();
+99      }
+100 
+101     public boolean isDataFlavorSupported(DataFlavor flavor) {
+102         DataFlavor[] flavors = getTransferDataFlavors();
+103         for (int i = 0; i < flavors.length; i++) {
+104             DataFlavor dataFlavor = flavors[i];
+105             if (dataFlavor.equals(flavor)) {
+106                 return true;
+107             }
+108         }
+109         return false;
+110     }
+111 
+112     public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
+113         DataContentHandler dch = getDataContentHandler();
+114         if (dch != null) {
+115             return dch.getTransferData(flavor, ds);
+116         } else if (this.flavor.match(flavor)) {
+117             if (ds instanceof ObjectDataSource) {
+118                 return ((ObjectDataSource) ds).data;
+119             } else {
+120                 return ds.getInputStream();
+121             }
+122         } else {
+123             throw new UnsupportedFlavorException(flavor);
+124         }
+125     }
+126 
+127     public CommandInfo[] getPreferredCommands() {
+128         return getCommandMap().getPreferredCommands(ds.getContentType());
+129     }
+130 
+131     public CommandInfo[] getAllCommands() {
+132         return getCommandMap().getAllCommands(ds.getContentType());
+133     }
+134 
+135     public CommandInfo getCommand(String cmdName) {
+136         return getCommandMap().getCommand(ds.getContentType(), cmdName);
+137     }
+138 
+139     public Object getContent() throws IOException {
+140         if (ds instanceof ObjectDataSource) {
+141             return ((ObjectDataSource) ds).data;
+142         } else {
+143             DataContentHandler dch = getDataContentHandler();
+144             if (dch != null) {
+145                 return dch.getContent(ds);
+146             } else {
+147                 return ds.getInputStream();
+148             }
+149         }
+150     }
+151 
+152     public Object getBean(CommandInfo cmdinfo) {
+153         try {
+154             return cmdinfo.getCommandObject(this, this.getClass().getClassLoader());
+155         } catch (IOException e) {
+156             return null;
+157         } catch (ClassNotFoundException e) {
+158             return null;
+159         }
+160     }
+161
+*/
+     /**
+163      * A local implementation of DataSouce used to wrap an Object and mime-type.
+164      */
+/*
+165     private class ObjectDataSource implements DataSource {
+166         private final Object data;
+167         private final String mimeType;
+168 
+169         public ObjectDataSource(Object data, String mimeType) {
+170             this.data = data;
+171             this.mimeType = mimeType;
+172         }
+173 
+174         public String getName() {
+175             return null;
+176         }
+177 
+178         public String getContentType() {
+179             return mimeType;
+180         }
+181 
+182         public InputStream getInputStream() throws IOException {
+183             final DataContentHandler dch = getDataContentHandler();
+184             if (dch == null) {
+185                 throw new UnsupportedDataTypeException();
+186             }
+187             final PipedInputStream is = new PipedInputStream();
+188             Thread thread = new Thread() {
+189                 public void run() {
+190                     try {
+191                         PipedOutputStream os = new PipedOutputStream(is);
+192                         is.connect(os);
+193                         try {
+194                             dch.writeTo(data, mimeType, os);
+195                         } finally {
+196                             os.close();
+197                         }
+198                     } catch (IOException e) {
+199                         // ignore, per spec - doh!
+200                     }
+201                 }
+202             };
+203             thread.start();
+204             return is;
+205         }
+206 
+207         public OutputStream getOutputStream() throws IOException {
+208             return null;
+209         }
+210     }
+211 
+212     public synchronized void setCommandMap(CommandMap commandMap) {
+213         this.commandMap = commandMap;
+214         this.dch = null;
+215     }
+216 
+217     private synchronized CommandMap getCommandMap() {
+218         return commandMap != null ? commandMap : CommandMap.getDefaultCommandMap();
+219     }
+220
+*/
+     /**
+222      * Search for a DataContentHandler for our mime type.
+223      * The search is performed by first checking if a global factory has been set using
+224      * {@link #setDataContentHandlerFactory(DataContentHandlerFactory)};
+225      * if found then it is called to attempt to create a handler.
+226      * If this attempt fails, we then call the command map set using {@link #setCommandMap(CommandMap)}
+227      * (or if that has not been set, the default map returned by {@link CommandMap#getDefaultCommandMap()})
+228      * to create the handler.
+229      *
+230      * The resulting handler is cached until the global factory is changed.
+231      *
+232      * @return
+233      */
+/*
+234     private synchronized DataContentHandler getDataContentHandler() {
+235         DataContentHandlerFactory localFactory;
+236         synchronized (DataHandler.class) {
+237             if (factory != originalFactory) {
+238                 // setDCHF was called - clear our cached copy of the DCH and DCHF
+239                 dch = null;
+240                 originalFactory = factory;
+241             }
+242             localFactory = originalFactory;
+243         }
+244         if (dch == null) {
+245             String contentType = ds.getContentType();
+246             if (localFactory != null) {
+247                 dch = localFactory.createDataContentHandler(contentType);
+248             }
+249             if (dch == null) {
+250                 if (commandMap != null) {
+251                     dch = commandMap.createDataContentHandler(contentType);
+252                 } else {
+253                     dch = CommandMap.getDefaultCommandMap().createDataContentHandler(contentType);
+254                 }
+255             }
+256         }
+257         return dch;
+258     }
+259 
+260     /**
+261      * This is used to check if the DataContentHandlerFactory has been changed.
+262      * This is not specified behaviour but this check is required to make this work like the RI.
+263      */
+/*
+264     private DataContentHandlerFactory originalFactory;
+265 
+266     {
+267         synchronized (DataHandler.class) {
+268             originalFactory = factory;
+269         }
+270     }
+271 
+272     private static DataContentHandlerFactory factory;
+273 
+274     /**
+275      * Set the DataContentHandlerFactory to use.
+276      * If this method has already been called then an Error is raised.
+277      *
+278      * @param newFactory the new factory
+279      * @throws SecurityException if the caller does not have "SetFactory" RuntimePermission
+280      */
+/*
+281     public static synchronized void setDataContentHandlerFactory(DataContentHandlerFactory newFactory) {
+282         if (factory != null) {
+283             throw new Error("javax.activation.DataHandler.setDataContentHandlerFactory has already been defined");
+284         }
+285         SecurityManager sm = System.getSecurityManager();
+286         if (sm != null) {
+287             sm.checkSetFactory();
+288         }
+289         factory = newFactory;
+290     }	
+*/

Added: webservices/axis2/trunk/c/modules/xml/attachments/mime_body_part.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/attachments/mime_body_part.c?rev=388891&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/attachments/mime_body_part.c (added)
+++ webservices/axis2/trunk/c/modules/xml/attachments/mime_body_part.c Sun Mar 26 02:00:06 2006
@@ -0,0 +1,179 @@
+/*
+ * 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
+ *mime_body_part
+ * 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 <axis2_mime_body_part.h>
+
+/** 
+ * @brief Flow struct impl
+ *	Axis2 Flow impl  
+ */
+typedef struct axis2_mime_body_part_impl
+{
+	axis2_mime_body_part_t mime_body_part;
+    /**
+     * Field list
+     */
+	/** Hash map to hold header name, value pairs */
+	axis2_hash_t *header_map;
+} axis2_mime_body_part_impl_t;
+
+
+
+#define AXIS2_INTF_TO_IMPL(mime_body_part) ((axis2_mime_body_part_impl_t *)(mime_body_part))
+
+/***************************** Function headers *******************************/
+
+axis2_status_t AXIS2_CALL
+axis2_mime_body_part_free (axis2_mime_body_part_t *mime_body_part, axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL
+axis2_mime_body_part_add_header (axis2_mime_body_part_t *mime_body_part, axis2_env_t **env,
+    axis2_char_t *name, axis2_char_t *value);
+
+axis2_status_t AXIS2_CALL
+axis2_mime_body_part_set_data_handler (axis2_mime_body_part_t *mime_body_part, axis2_env_t **env, axis2_data_handler_t *data_handler); 
+
+axis2_status_t AXIS2_CALL
+axis2_mime_body_part_write_to (axis2_mime_body_part_t *mime_body_part, axis2_env_t **env, 
+                                axis2_byte_t **output_stream, int *output_stream_size, 
+                                axis2_char_t *ignore_list);
+/************************** End of Function headers ************************/
+
+AXIS2_DECLARE(axis2_mime_body_part_t *)
+axis2_mime_body_part_create (axis2_env_t **env)
+{
+    axis2_mime_body_part_impl_t *mime_body_part_impl = NULL;
+    
+	AXIS2_ENV_CHECK(env, NULL);
+	mime_body_part_impl = (axis2_mime_body_part_impl_t *) AXIS2_MALLOC((*env)->allocator, 
+        sizeof(axis2_mime_body_part_impl_t));
+		
+	if(NULL == mime_body_part_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+	
+    mime_body_part_impl->mime_body_part.ops = NULL;
+    
+	mime_body_part_impl->mime_body_part.ops = AXIS2_MALLOC ((*env)->allocator, 
+        sizeof(axis2_mime_body_part_ops_t));
+	if(NULL == mime_body_part_impl->mime_body_part.ops)
+    {
+        axis2_mime_body_part_free(&(mime_body_part_impl->mime_body_part), env);
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+	mime_body_part_impl->mime_body_part.ops->free =  axis2_mime_body_part_free;
+    mime_body_part_impl->mime_body_part.ops->add_header = axis2_mime_body_part_add_header;
+    mime_body_part_impl->mime_body_part.ops->set_data_handler = axis2_mime_body_part_set_data_handler; 
+    mime_body_part_impl->mime_body_part.ops->write_to = axis2_mime_body_part_write_to;
+    
+    return &(mime_body_part_impl->mime_body_part);
+}
+
+/*************************** Start of op impls *************************/
+
+axis2_status_t AXIS2_CALL
+axis2_mime_body_part_free (axis2_mime_body_part_t *mime_body_part, axis2_env_t **env)
+{
+    axis2_mime_body_part_impl_t *mime_body_part_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    mime_body_part_impl = AXIS2_INTF_TO_IMPL(mime_body_part);
+    
+    if(NULL != mime_body_part->ops)
+    {
+        AXIS2_FREE((*env)->allocator, mime_body_part->ops);
+        mime_body_part->ops = NULL;
+    }
+    
+    if(mime_body_part_impl)
+    {
+        AXIS2_FREE((*env)->allocator, mime_body_part_impl);
+        mime_body_part_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_mime_body_part_add_header (axis2_mime_body_part_t *mime_body_part, axis2_env_t **env,
+    axis2_char_t *name, axis2_char_t *value) 
+{
+	AXIS2_ENV_CHECK(env, NULL);
+	/* headers.addHeader(name, value);     */
+}
+
+/**
+ * This method provides the mechanism to set this body part's content.
+ * The given DataHandler object should wrap the actual content.
+ * 
+ * @param   dh      The DataHandler for the content
+ */                 
+
+axis2_status_t AXIS2_CALL
+axis2_mime_body_part_set_data_handler (axis2_mime_body_part_t *mime_body_part, axis2_env_t **env, axis2_data_handler_t *data_handler) 
+{
+	AXIS2_ENV_CHECK(env, NULL);
+    return AXIS2_SUCCESS;
+
+	/*** 
+	setDataHandler(DataHandler dh) 
+	this.dh = dh;
+	MimeBodyPart.invalidateContentHeaders(this);
+	*/
+}
+
+axis2_status_t AXIS2_CALL
+axis2_mime_body_part_write_to (axis2_mime_body_part_t *mime_body_part, axis2_env_t **env, 
+                                axis2_byte_t **output_stream, int *output_stream_size, 
+                                axis2_char_t *ignore_list) 
+{
+	AXIS2_ENV_CHECK(env, NULL);
+    return AXIS2_SUCCESS;
+}
+
+
+/**
+    static void writeTo(MimePart part, OutputStream os, String[] ignoreList)
+			throws IOException, MessagingException {
+
+	// see if we already have a LOS
+	LineOutputStream los = null;
+	if (os instanceof LineOutputStream) {
+	    los = (LineOutputStream) os;
+	} else {
+	    los = new LineOutputStream(os);
+	}
+
+	// First, write out the header
+	Enumeration hdrLines = part.getNonMatchingHeaderLines(ignoreList);
+	while (hdrLines.hasMoreElements())
+	    los.writeln((String)hdrLines.nextElement());
+
+	// The CRLF separator between header and content
+	los.writeln();
+
+	// Finally, the content. Encode if required.
+	// XXX: May need to account for ESMTP ?
+	os = MimeUtility.encode(os, part.getEncoding());
+	part.getDataHandler().writeTo(os);
+	os.flush(); // Needed to complete encoding
+    }
+*/

Added: webservices/axis2/trunk/c/modules/xml/attachments/mime_output.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/attachments/mime_output.c?rev=388891&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/attachments/mime_output.c (added)
+++ webservices/axis2/trunk/c/modules/xml/attachments/mime_output.c Sun Mar 26 02:00:06 2006
@@ -0,0 +1,441 @@
+/*
+ * 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
+ *mime_output
+ * 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 <axis2_mime_output.h>
+#include <axis2_data_handler.h>
+#include <axis2_mime_body_part.h>
+#include <axis2_string.h>
+/** 
+ * @brief Flow struct impl
+ *	Axis2 Flow impl  
+ */
+
+
+axis2_char_t AXIS2_CRLF[] =  { 13, 10 };
+int AXIS2_CRLF_LENGTH = 2;
+
+typedef struct axis2_mime_output_impl
+{
+	axis2_mime_output_t mime_output;
+    /**
+     * Field list
+     *private XMLStreamWriter xmlWriter;
+     *private OutputStream outStream;
+     *private LinkedList binaryNodeList = new LinkedList();
+     *private StringWriter bufferedSOAPBody;
+     *private OMOutputFormat format = new OMOutputFormat();
+     */
+    
+    
+} axis2_mime_output_impl_t;
+
+#define AXIS2_INTF_TO_IMPL(mime_output) ((axis2_mime_output_impl_t *)(mime_output))
+#define AXIS2_MIME_BOUNDARY_BYTE 45
+#define AXIS2_MIME_CRLF_BYTE 13
+/* private static byte[] CRLF =  { 13, 10 }; */
+
+axis2_status_t axis2_char_2_byte(axis2_env_t **env, axis2_char_t *char_buffer, axis2_byte_t **byte_buffer, int *byte_buffer_size);
+
+axis2_status_t axis2_char_2_byte(axis2_env_t **env, axis2_char_t *char_buffer, axis2_byte_t **byte_buffer, int *byte_buffer_size)
+{
+    int length;
+    int i = 0;
+    axis2_byte_t *bytes;
+    /*env check*/
+    length = AXIS2_STRLEN(char_buffer);
+    bytes = AXIS2_MALLOC((*env)->allocator, length * sizeof(axis2_byte_t));
+    /*@TODO do the char to byte conversion*/
+    
+    for(i = 0; i < length; i++)
+    {
+        bytes[i] = (axis2_byte_t) char_buffer[i];
+    }
+    byte_buffer = &bytes;
+    *byte_buffer_size = length;
+}
+
+/***************************** Function headers *******************************/
+
+axis2_status_t AXIS2_CALL
+axis2_mime_output_free (axis2_mime_output_t *mime_output, axis2_env_t **env);
+
+axis2_byte_t * AXIS2_CALL
+axis2_mime_output_complete(axis2_mime_output_t *mime_output,
+                            axis2_env_t **env, axis2_byte_t **output_stream, 
+                            int *output_stream_size, 
+                            axis2_char_t *string_to_write, 
+                            axis2_array_list_t *binary_node_list,
+                            axis2_char_t *boundary, axis2_char_t *content_id,
+                            axis2_char_t *char_set_encoding,axis2_char_t *soap_content_type);
+axis2_status_t * AXIS2_CALL
+axis2_start_writing_mime (axis2_mime_output_t *mime_output, 
+                            axis2_env_t **env, axis2_byte_t **output_stream, 
+                            int *output_stream_size, axis2_char_t *boundary);
+
+axis2_mime_body_part_t * AXIS2_CALL
+axis2_create_mime_body_part (axis2_mime_output_t *mime_output, axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL
+axis2_write_body_part (axis2_mime_output_t *mime_output, axis2_env_t **env, 
+                        axis2_byte_t **output_stream, int *output_stream_size, 
+                        axis2_mime_body_part_t *part, axis2_char_t *boundary);
+
+axis2_status_t AXIS2_CALL
+axis2_write_mime_boundary (axis2_mime_output_t *mime_output, axis2_env_t **env, 
+                            axis2_byte_t **output_stream, int *output_stream_size, 
+                            axis2_char_t *boundary);
+
+axis2_status_t AXIS2_CALL
+axis2_write_finish_writing_mime (axis2_mime_output_t *mime_output, axis2_env_t **env, 
+                        axis2_byte_t **output_stream, int *output_stream_size, axis2_char_t *boundary);
+
+axis2_char_t * AXIS2_CALL
+axis2_mime_output_get_content_type_for_mime (axis2_mime_output_t *mime_output, axis2_env_t **env, 
+                        axis2_char_t *boundary, axis2_char_t *content_id, axis2_char_t *char_set_encoding, axis2_char_t *soap_content_type);
+
+/************************** End of Function headers ************************/
+
+AXIS2_DECLARE(axis2_mime_output_t *)
+axis2_mime_output_create (axis2_env_t **env)
+{
+    axis2_mime_output_impl_t *mime_output_impl = NULL;
+    
+	AXIS2_ENV_CHECK(env, NULL);
+	mime_output_impl = (axis2_mime_output_impl_t *) AXIS2_MALLOC((*env)->allocator, 
+        sizeof(axis2_mime_output_impl_t));
+		
+	if(NULL == mime_output_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); 
+        return NULL;
+    }
+	
+    mime_output_impl->mime_output.ops = NULL;
+    
+	mime_output_impl->mime_output.ops = AXIS2_MALLOC ((*env)->allocator, 
+        sizeof(axis2_mime_output_ops_t));
+	if(NULL == mime_output_impl->mime_output.ops)
+    {
+        axis2_mime_output_free(&(mime_output_impl->mime_output), env);
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    
+	mime_output_impl->mime_output.ops->free =  axis2_mime_output_free;
+    mime_output_impl->mime_output.ops->complete = axis2_mime_output_complete;
+    mime_output_impl->mime_output.ops->get_content_type_for_mime = axis2_mime_output_get_content_type_for_mime; 
+	return &(mime_output_impl->mime_output);
+}
+
+/*************************** Start of op impls *************************/
+
+axis2_status_t AXIS2_CALL    
+
+axis2_mime_output_free (axis2_mime_output_t *mime_output, axis2_env_t **env)
+{
+    axis2_mime_output_impl_t *mime_output_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    mime_output_impl = AXIS2_INTF_TO_IMPL(mime_output);
+    
+    if(NULL != mime_output->ops)
+    {
+        AXIS2_FREE((*env)->allocator, mime_output->ops);
+        mime_output->ops = NULL;
+    }
+    
+    if(mime_output_impl)
+    {
+        AXIS2_FREE((*env)->allocator, mime_output_impl);
+        mime_output_impl = NULL;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_byte_t * AXIS2_CALL
+axis2_mime_output_complete(axis2_mime_output_t *mime_output,
+                            axis2_env_t **env, axis2_byte_t **output_stream, 
+                            int *output_stream_size, 
+                            axis2_char_t *string_to_write, 
+                            axis2_array_list_t *binary_node_list,
+                            axis2_char_t *boundary, axis2_char_t *content_id,
+                            axis2_char_t *char_set_encoding,axis2_char_t *soap_content_type)
+{
+            /*axis2_byte_t *mime_stream = NULL;
+            AXIS2_CRLF_LENGTH
+            axis2_byte_t *root_mime_body_part = NULL;
+            Define this
+            int root_mime_body_part_length = 0;
+            int mime_stream_length = (AXIS2_CRLF_LENGTH * 2) + (root_mime_body_part_length);
+            mime_stream = AXIS2_MALLOC((*env)->allocator, (mime_stream_length * sizeof(mime_stream_length)));
+            */
+    axis2_char_t *encoding_string = NULL;
+    axis2_char_t *header_value = NULL;
+    axis2_char_t *content_id_string = NULL;    
+
+    AXIS2_ENV_CHECK(env, NULL); 
+         
+    axis2_start_writing_mime (mime_output, env, output_stream, output_stream_size, boundary);
+
+    encoding_string = AXIS2_STRDUP("text/xml; charset=", env);
+    AXIS2_STRACAT(encoding_string, char_set_encoding, env);    
+       
+    axis2_data_handler_t *data_handler = axis2_data_handler_create(env, (void*)string_to_write, encoding_string);
+    
+    axis2_mime_body_part_t *root_mime_body_part = axis2_mime_body_part_create(env);
+    /*@TODO please check the correctness of the parameters passed*/
+    axis2_mime_body_part_set_data_handler(root_mime_body_part, env ,data_handler);
+
+    header_value = AXIS2_STRDUP("application/xop+xml; charset=", env);
+    AXIS2_STRACAT(header_value, char_set_encoding, env);
+    AXIS2_STRACAT(header_value, "; typeAXIS2_CRLF=\"", env);
+    AXIS2_STRACAT(header_value, soap_content_type, env);
+    AXIS2_STRACAT(header_value, "\";", env);
+    /*@TODO please check the correctness of the parameters passed*/
+    axis2_mime_body_part_add_header(root_mime_body_part, env, "content-transfer-encoding","binary");
+
+    AXIS2_STRACAT(content_id_string, "<", env);
+    AXIS2_STRACAT(content_id_string, content_id, env);
+    AXIS2_STRACAT(content_id_string, ">", env);
+    /*@TODO please check the correctness of the parameters passed*/
+    axis2_mime_body_part_add_header(root_mime_body_part, env, "content-id",content_id_string);
+    /***/
+    /*@TODO please check the correctness of the parameters passed*/
+    axis2_write_body_part (mime_output, env, output_stream, output_stream_size, root_mime_body_part, boundary);
+            
+            /*javax.activation.DataHandler dh = new javax.activation.DataHandler(writer.toString(),
+                    "text/xml; charset=" + char_set_encoding);
+            MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
+            rootMimeBodyPart.setDataHandler(dh);
+            
+            rootMimeBodyPart.addHeader("content-type",
+                    "application/xop+xml; charset=" + char_set_encoding + 
+					"; typeAXIS2_CRLF=\""+soap_content_type+"\";");
+            rootMimeBodyPart.addHeader("content-transfer-encoding", "binary");
+            rootMimeBodyPart.addHeader("content-id","<"+content_id+">");
+            */
+    
+            /*writeBodyPart(outStream, rootMimeBodyPart, boundary);*/
+    
+    
+            
+            /*
+            Iterator binaryNodeIterator = binary_node_list.iterator();
+            while (binaryNodeIterator.hasNext()) {
+                OMText binaryNode = (OMText) binaryNodeIterator.next();
+                writeBodyPart(outStream, createMimeBodyPart(binaryNode),
+                        boundary);
+
+            finishWritingMime(outStream);
+            */
+    }
+
+
+/**
+  * This will write the boundary with CRLF data_handler 
+  * The method is a private method and is called from axis2_output_complete method
+  */
+
+axis2_status_t * AXIS2_CALL
+axis2_start_writing_mime (axis2_mime_output_t *mime_output,
+                            axis2_env_t **env, axis2_byte_t **output_stream,
+                            int *output_stream_size, axis2_char_t *boundary)
+{
+    AXIS2_ENV_CHECK(env, NULL);     
+    axis2_write_mime_boundary (mime_output, env, output_stream, output_stream_size, boundary);
+}
+
+
+ 
+/*
+    public static void writeMimeBoundary(OutputStream outStream,
+                                         axis2_char_t *boundary) throws IOException {
+        outStream.write(new byte[]{45, 45});
+        outStream.write(boundary.getBytes());
+    }
+*/
+/*@TODO please check the coretness of the following method*/
+axis2_status_t AXIS2_CALL
+axis2_write_mime_boundary (axis2_mime_output_t *mime_output, axis2_env_t **env,
+                            axis2_byte_t **output_stream, int *output_stream_size, 
+                            axis2_char_t *boundary)
+{
+    axis2_byte_t *byte_buffer;
+    axis2_byte_t *byte_stream;
+    int size;
+        
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    axis2_char_2_byte(env, boundary, &byte_buffer, &size);
+    byte_stream = AXIS2_MALLOC((*env)->allocator, (size + 1) * sizeof(axis2_byte_t));
+    byte_stream[size + 1] = AXIS2_MIME_BOUNDARY_BYTE;
+    
+    
+    AXIS2_FREE((*env)->allocator, byte_buffer);
+    
+    output_stream = &byte_stream;
+    output_stream_size = size + 1;
+        
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_mime_body_part_t * AXIS2_CALL
+axis2_create_mime_body_part (axis2_mime_output_t *mime_output, axis2_env_t **env)
+/*public static MimeBodyPart createMimeBodyPart(OMText node)*/
+{
+    /**    
+      *MimeBodyPart mimeBodyPart = new MimeBodyPart();
+      *mimeBodyPart.setDataHandler((javax.activation.DataHandler)node.getDataHandler());
+      *mimeBodyPart.addHeader("content-id", "<"+node.getContentID()+">");
+      *mimeBodyPart.addHeader("content-type", "application/octet-stream");
+      *mimeBodyPart.addHeader("content-transfer-encoding", "binary");
+      *return mimeBodyPart;
+     */
+    AXIS2_ENV_CHECK(env, NULL);     
+}
+
+
+
+/**
+     * Writes a CRLF for the earlier boundary then the BodyPart data
+     * with headers followed by boundary. Writes only the boundary. No more, int *output_stream_size, 
+     * CRLF's are written after that.
+     *
+     */
+/*  
+  public static void writeBodyPart(OutputStream outStream,
+                                     MimeBodyPart part, 
+                                     axis2_char_t *boundary) throws IOException,
+            MessagingException {
+        outStream.write(CRLF);
+        part.writeTo(outStream);
+        outStream.write(CRLF);
+        writeMimeBoundary(outStream, boundary);
+    }
+*/
+
+
+axis2_status_t AXIS2_CALL
+axis2_write_body_part (axis2_mime_output_t *mime_output, axis2_env_t **env, 
+                        axis2_byte_t **output_stream, int *output_stream_size, 
+                        axis2_mime_body_part_t *part, axis2_char_t *boundary)
+{
+    axis2_byte_t *byte_buffer;
+    axis2_byte_t *byte_stream;
+    int size;
+        
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    axis2_char_2_byte(env, boundary, &byte_buffer, &size);
+    byte_stream = AXIS2_MALLOC((*env)->allocator, (size + 2) * sizeof(axis2_byte_t));
+    /*@TODO pls implement this part*/
+    /*
+    byte_stream[0] = AXIS2_MIME_CRLF_BYTE;
+    memcpy(&byte_stream[2], byte_buffer, size);
+    byte_stream[3] = AXIS2_MIME_CRLF_BYTE;
+    */
+    AXIS2_FREE((*env)->allocator, byte_buffer);
+    
+    output_stream = &byte_stream;
+    output_stream_size = size + 2;
+        
+    return AXIS2_SUCCESS;    
+    
+}
+
+
+   /* ========================== ================================*/
+
+
+/**
+     * This will write "--" to the end of last boundary
+     */
+
+axis2_status_t AXIS2_CALL
+axis2_write_finish_writing_mime (axis2_mime_output_t *mime_output, axis2_env_t **env, 
+                        axis2_byte_t **output_stream, int *output_stream_size, axis2_char_t *boundary)
+{
+    axis2_byte_t *byte_buffer;
+    axis2_byte_t *byte_stream;
+    int size;
+        
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    axis2_char_2_byte(env, boundary, &byte_buffer, &size);
+    byte_stream = AXIS2_MALLOC((*env)->allocator, (size + 2) * sizeof(axis2_byte_t));
+    
+    AXIS2_FREE((*env)->allocator, byte_buffer);
+    
+    output_stream = &byte_stream;
+    output_stream_size = size + 2;
+        
+    return AXIS2_SUCCESS;    
+
+}
+/*  public static void finishWritingMime(OutputStream outStream)
+            throws IOException {
+        outStream.write(new byte[]{45, 45});
+    }
+*/
+
+
+axis2_char_t * AXIS2_CALL
+axis2_mime_output_get_content_type_for_mime (axis2_mime_output_t *mime_output, axis2_env_t **env, 
+                        axis2_char_t *boundary, axis2_char_t *content_id, axis2_char_t *char_set_encoding, axis2_char_t *soap_content_type)
+{
+    axis2_char_t *content_type_string = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    content_type_string = AXIS2_STRDUP("multipart/related", env);
+    AXIS2_STRACAT(content_type_string, "; ", env);       
+    AXIS2_STRACAT(content_type_string, "boundary=", env);
+    AXIS2_STRACAT(content_type_string, boundary, env);
+    AXIS2_STRACAT(content_type_string, "; ", env);
+    AXIS2_STRACAT(content_type_string, "type=\"application/xop+xml\"", env);
+    AXIS2_STRACAT(content_type_string, "; ", env);
+    AXIS2_STRACAT(content_type_string, "start=\"<", env);
+    AXIS2_STRACAT(content_type_string, content_id , env);
+    AXIS2_STRACAT(content_type_string, ">\"", env);
+    AXIS2_STRACAT(content_type_string, "; ", env);
+    AXIS2_STRACAT(content_type_string, "start-info=\"", env);
+    AXIS2_STRACAT(content_type_string, soap_content_type, env);
+    AXIS2_STRACAT(content_type_string, "\"", env);    
+    
+    /*@TODO check this line*/
+    return content_type_string;
+}
+
+/*
+    public static axis2_char_t *getContentTypeForMime(axis2_char_t *boundary, axis2_char_t *content_id, axis2_char_t *char_set_encoding, axis2_char_t *soap_content_type) {
+        StringBuffer sb = new StringBuffer();
+        sb.append("multipart/related");
+        sb.append("; ");
+        sb.append("boundary=");
+        sb.append(boundary);
+        sb.append("; ");
+        sb.append("type=\"application/xop+xml\"");
+        sb.append("; ");
+        sb.append("start=\"<" + content_id + ">\"");
+        sb.append("; ");
+        sb.append("start-info=\""+soap_content_type+"\"");
+        return sb.toString();
+    }
+}
+*/

Modified: webservices/axis2/trunk/c/modules/xml/om/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/Makefile.am?rev=388891&r1=388890&r2=388891&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/xml/om/Makefile.am Sun Mar 26 02:00:06 2006
@@ -14,9 +14,10 @@
                         om_children_iterator.c \
                         om_children_qname_iterator.c \
                         om_child_element_iterator.c \
-                        om_children_with_specific_attribute_iterator.c
+                        om_children_with_specific_attribute_iterator.c \
+                        om_output_format.c
 
-libaxis2_om_la_LIBADD =  ../../util/libaxis2_util.la 
+libaxis2_om_la_LIBADD =  ../../util/libaxis2_util.la ../attachments/libaxis2_attachments.la
 INCLUDES = -I$(top_builddir)/include \
             -I$(top_builddir)/modules/util \
             -I$(top_builddir)/modules/xml/parser \

Added: webservices/axis2/trunk/c/modules/xml/om/axis2_om_output_format.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/axis2_om_output_format.h?rev=388891&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/axis2_om_output_format.h (added)
+++ webservices/axis2/trunk/c/modules/xml/om/axis2_om_output_format.h Sun Mar 26 02:00:06 2006
@@ -0,0 +1,158 @@
+/*
+ * 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 AXIS2_OM_OUTPUT_FORMAT_H
+#define AXIS2_OM_OUTPUT_FORMAT_H
+
+/**
+ * @file axis2_om_output_format.h
+ * @brief axis2 mime_output interface
+ */
+
+#include <axis2.h>
+#include <axis2_error.h>
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axis2_allocator.h>
+#include <axis2_string.h>
+#include <axis2_array_list.h>
+#include <axis2_handler_desc.h>
+#include <axis2_mime_output.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* This should be moved to header file later axis2_defines.h*/    
+#define axis2_byte_t char
+
+    /**
+     * Field DEFAULT_CHAR_SET_ENCODING. Specifies the default
+     * character encoding scheme to be used.
+     */
+#define AXIS2_DEFAULT_CHAR_SET_ENCODING  "utf-8"
+	
+typedef struct axis2_om_output_format_ops axis2_om_output_format_ops_t;
+typedef struct axis2_om_output_format axis2_om_output_format_t;	
+	
+
+/** @defgroup axis2_om_output_format Flow
+  * @ingroup axis2_om_output_format
+  * @{
+  */
+
+/** 
+ * @brief Flow ops struct
+ * Encapsulator struct for ops of axis2_om_output_format
+ */
+struct axis2_om_output_format_ops
+{
+    axis2_status_t (AXIS2_CALL *is_optimized) (axis2_om_output_format_t *om_output_format, axis2_env_t **env);
+    
+    axis2_status_t (AXIS2_CALL *set_do_optimized) (axis2_om_output_format_t *om_output_format, axis2_env_t **env, const axis2_bool_t is_optimized);
+
+    axis2_char_t* (AXIS2_CALL *get_content_type) (axis2_om_output_format_t *om_output_format, axis2_env_t **env);
+    
+    axis2_char_t* (AXIS2_CALL *get_mime_boundary) (axis2_om_output_format_t *om_output_format, axis2_env_t **env);
+    
+    axis2_char_t* (AXIS2_CALL *get_root_content_id) (axis2_om_output_format_t *om_output_format, axis2_env_t **env);
+    
+    axis2_status_t (AXIS2_CALL *set_char_set_encoding) (axis2_om_output_format_t *om_output_format, axis2_env_t **env, axis2_char_t *char_set_encoding);
+    
+    axis2_char_t* (AXIS2_CALL *get_char_set_encoding) (axis2_om_output_format_t *om_output_format, axis2_env_t **env);
+    
+    axis2_char_t*  (AXIS2_CALL *get_next_content_id) (axis2_om_output_format_t *om_output_format, axis2_env_t **env);
+    
+    axis2_char_t* (AXIS2_CALL *get_xml_version)( axis2_om_output_format_t *om_output_format, axis2_env_t **env);
+    
+    axis2_status_t  (AXIS2_CALL *set_xml_version) (axis2_om_output_format_t *om_output_format, axis2_env_t **env, axis2_char_t *xml_version);
+    
+    axis2_bool_t  (AXIS2_CALL *is_soap11) (axis2_om_output_format_t *om_output_format, axis2_env_t **env); 
+    
+    axis2_status_t  (AXIS2_CALL *set_is_soap11) (axis2_om_output_format_t *om_output_format, axis2_env_t **env, const axis2_bool_t is_soap11);
+    
+    axis2_bool_t  (AXIS2_CALL *is_ignore_xml_declaration) (axis2_om_output_format_t *om_output_format, axis2_env_t **env); 
+    
+    axis2_status_t  (AXIS2_CALL *set_ignore_xml_declaration) (axis2_om_output_format_t *om_output_format, axis2_env_t **env, const axis2_bool_t ignore_xml_declaration);
+    
+	/** Deallocate memory
+     * @return status code
+     */
+    axis2_status_t (AXIS2_CALL *free) (axis2_om_output_format_t *mime_output,
+                            axis2_env_t **env);
+
+};
+
+/** 
+ * @brief Flow struct
+ *	Flow  
+ */ 
+struct axis2_om_output_format
+{
+	axis2_om_output_format_ops_t *ops;
+};
+
+/**
+ * Creates mime_output struct
+ * @return pointer to newly created mime_output
+ */
+AXIS2_DECLARE(axis2_om_output_format_t *) 
+axis2_om_output_format_create (axis2_env_t **env);
+
+/*************************** Function macros **********************************/
+
+#define AXIS2_OM_OUTPUT_FORMAT_FREE(om_output_format, env) ((om_output_format)->ops->free (om_output_format, env))
+
+#define AXIS2_OM_OUTPUT_FORMAT_IS_OPTIMIZED(om_output_format, env) ((om_output_format)->ops->is_optimized(om_output_format, env))
+
+#define AXIS2_OM_OUTPUT_FORMAT_SET_DO_OPTIMIZED(om_output_format, env, is_optimized) ((om_output_format)->ops->set_do_optimized(om_output_format, env, is_optimized))
+
+
+
+ #define AXIS2_OM_OUTPUT_FORMAT_GET_CONTENT_TYPE(om_output_format, env) ((om_output_format)->ops->get_content_type(om_output_format, env))
+
+ #define AXIS2_OM_OUTPUT_FORMAT_GET_MIME_BOUNDARY(om_output_format, env) ((om_output_format)->ops->get_mime_boundary(om_output_format, env))
+
+ #define AXIS2_OM_OUTPUT_FORMAT_GET_ROOT_CONTENT_ID(om_output_format, env) ((om_output_format)->ops->get_root_content_id(om_output_format, env))
+
+ #define AXIS2_OM_OUTPUT_FORMAT_SET_CHAR_SET_ENCODING(om_output_format, env, char_set_encoding) ((om_output_format)->ops->set_char_set_encoding(om_output_format, env, char_set_encoding))
+
+ #define AXIS2_OM_OUTPUT_FORMAT_GET_CHAR_SET_ENCODING(om_output_format, env) ((om_output_format)->ops->get_char_set_encoding(om_output_format, env))
+
+ #define AXIS2_OM_OUTPUT_FORMAT_GET_NEXT_CONTENT_ID(om_output_format, env) ((om_output_format)->ops->get_next_content_id(om_output_format, env))
+
+ #define AXIS2_OM_OUTPUT_FORMAT_GET_XML_VERSION(om_output_format, env) ((om_output_format)->ops->get_xml_version(om_output_format, env))
+
+ #define AXIS2_OM_OUTPUT_FORMAT_SET_XML_VERSION(om_output_format, env, xml_version) ((om_output_format)->ops->get_xml_version(om_output_format, env, xml_version))
+
+ #define AXIS2_OM_OUTPUT_FORMAT_IS_SOAP11(om_output_format, env) ((om_output_format)->ops->is_soap11(om_output_format, env)) 
+
+ #define AXIS2_OM_OUTPUT_FORMAT_SET_IS_SOAP11(om_output_format, env, is_soap11) ((om_output_format)->ops->set_is_soap11(om_output_format, env, is_soap11))
+
+ #define AXIS2_OM_OUTPUT_FORMAT_IS_IGNORE_XML_DECLARATION(om_output_format, env) ((om_output_format)->ops->is_ignore_xml_declaration(om_output_format, env)) 
+
+ #define AXIS2_OM_OUTPUT_FORMAT_SET_IGNORE_XML_DECLARATION(om_output_format, env, ignore_xml_declaration) ((om_output_format)->ops->set_ignore_xml_declaration(om_output_format, env, ignore_xml_declaration))
+
+/*************************** End of function macros ***************************/
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+#endif  /* AXIS2_OM_OUTPUT_FORMAT_H */

Modified: webservices/axis2/trunk/c/modules/xml/om/om_output.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_output.c?rev=388891&r1=388890&r2=388891&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_output.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_output.c Sun Mar 26 02:00:06 2006
@@ -18,8 +18,11 @@
 #include <stdarg.h>
 #include <axis2_string.h>
 #include <axis2_xml_writer.h>
-
-#define AXIS2_DEFAULT_CHAR_SET_ENCODING  "UTF-8"
+#include <axis2_mime_output.h>
+#include <axis2_om_output_format.h>
+#include <axis2_om_text.h>
+#include <axis2_array_list.h>
+/*#define AXIS2_DEFAULT_CHAR_SET_ENCODING  "UTF-8"*/
 /*#define AXIS2_DEFAULT_CHAR_SET_ENCODING  "ISO-8859-1"*/
 #define MAX_ARGS  4
 /****************************** impl struct ***********************************/
@@ -41,7 +44,8 @@
     /* xml version */
     axis2_char_t *xml_version;
     axis2_bool_t ignore_xml_declaration;
-    
+  
+    axis2_array_list_t *binary_node_list;    
 }axis2_om_output_impl_t;
 
 /************************ Macro ***********************************************/
@@ -99,6 +103,9 @@
                             (axis2_om_output_t *om_output,
                             axis2_env_t **env,
                             axis2_bool_t optimize); 
+
+axis2_bool_t AXIS2_CALL
+axis2_om_output_is_optimized(axis2_om_output_t *om_output,axis2_env_t **env);
                             
 axis2_xml_writer_t* AXIS2_CALL
 axis2_om_output_get_xml_writer
@@ -109,7 +116,17 @@
 axis2_om_output_write_xml_version_encoding(axis2_om_output_t *om_output,
                                            axis2_env_t **env);
 
+axis2_status_t AXIS2_CALL 
+axis2_om_output_flush(axis2_om_output_t *om_output,
+                                           axis2_env_t **env);
+axis2_char_t* AXIS2_CALL
+axis2_om_output_get_next_content_id(axis2_om_output_t *om_output,
+                        axis2_env_t **env);
                       
+
+axis2_status_t AXIS2_CALL
+axis2_om_output_write_optimized(axis2_om_output_t *om_output,
+                        axis2_env_t **env, axis2_om_text_t *om_text);
 /*********************** end function prototypes ******************************/                      
 
 AXIS2_DECLARE(axis2_om_output_t *)
@@ -139,6 +156,7 @@
     om_output_impl->char_set_encoding = NULL;
     om_output_impl->xml_version = NULL;
     om_output_impl->ignore_xml_declaration = AXIS2_TRUE;
+    om_output_impl->binary_node_list = NULL;
     
     om_output_impl->om_output.ops = NULL;
     
@@ -183,7 +201,8 @@
 
     om_output_impl->om_output.ops->write_xml_version_encoding =
         axis2_om_output_write_xml_version_encoding;
-        
+    
+    om_output_impl->om_output.ops->get_next_content_id = axis2_om_output_get_next_content_id;
         
     om_output_impl->char_set_encoding = AXIS2_STRDUP(
         AXIS2_DEFAULT_CHAR_SET_ENCODING, env);        
@@ -511,4 +530,70 @@
                                 output_impl->xml_version, 
                                 output_impl->char_set_encoding);
     
+}
+
+/*=================================================*/
+axis2_bool_t AXIS2_CALL
+axis2_om_output_is_optimized(axis2_om_output_t *om_output,axis2_env_t **env)
+{
+    axis2_bool_t is_optimized = AXIS2_FALSE;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    axis2_om_output_format_t *om_output_format = axis2_om_output_format_create(env);
+    is_optimized = AXIS2_OM_OUTPUT_FORMAT_IS_OPTIMIZED(om_output_format, env);    
+    return is_optimized;
+}
+
+/*@TODO Following method method must be implemented*/
+axis2_status_t AXIS2_CALL 
+axis2_om_output_flush(axis2_om_output_t *om_output,
+                                           axis2_env_t **env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    return AXIS2_SUCCESS;
+}
+/*
+    public void flush() throws XMLStreamException {
+        xmlWriter.flush();
+        String SOAPContentType;
+        if (format.isOptimized()) {
+            if (format.isSOAP11()) {
+                SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
+            } else {
+                SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+            }
+            MIMEOutputUtils.complete(
+                    outStream,
+                    bufferedSOAPBody,
+                    binaryNodeList,
+                    format.getMimeBoundary(),
+                    format.getRootContentId(),
+                    format.getCharSetEncoding(), SOAPContentType);
+        }
+    }
+*/
+axis2_char_t* AXIS2_CALL
+axis2_om_output_get_next_content_id(axis2_om_output_t *om_output,
+                        axis2_env_t **env)
+{
+    axis2_om_output_format_t *om_output_format = NULL;
+    axis2_char_t *next_content_id = NULL;
+    AXIS2_ENV_CHECK(env,NULL);
+    om_output_format = axis2_om_output_format_create(env);
+    next_content_id = AXIS2_OM_OUTPUT_FORMAT_GET_NEXT_CONTENT_ID(om_output_format, env);
+    return next_content_id;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_om_output_write_optimized(axis2_om_output_t *om_output, axis2_env_t **env, axis2_om_text_t *om_text)
+{
+    axis2_om_output_impl_t *om_output_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    om_output_impl = AXIS2_INTF_TO_IMPL(om_output);
+    om_output_impl->binary_node_list  = axis2_array_list_create(env, 5);
+    AXIS2_ARRAY_LIST_ADD(om_output_impl->binary_node_list, env, (void *)om_text);
+    return AXIS2_SUCCESS;
 }



Mime
View raw message