axiom_data_handler.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2004,2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef AXIOM_DATA_HANDLER_H
00018 #define AXIOM_DATA_HANDLER_H
00019 
00025 #include <axis2_utils.h>
00026 #include <axis2_error.h>
00027 #include <axis2_utils_defines.h>
00028 #include <axis2_env.h>
00029 #include <axis2_allocator.h>
00030 #include <axis2_string.h>
00031 #include <axis2_array_list.h>
00032 
00033 
00034 #ifdef __cplusplus
00035 extern "C"
00036 {
00037 #endif
00038 
00039 typedef enum axiom_data_handler_type
00040 {
00041     AXIOM_DATA_HANDLER_TYPE_FILE,
00042     AXIOM_DATA_HANDLER_TYPE_BUFFER
00043 }axiom_data_handler_type_t;
00044 
00045 
00046 /* This should be moved to header file later axis2_defines.h*/    
00047 #define axis2_byte_t char
00048    
00049 typedef struct axiom_data_handler_ops axiom_data_handler_ops_t;
00050 typedef struct axiom_data_handler axiom_data_handler_t;   
00051 
00052 /*
00053       private final DataSource ds;
00054       private final DataFlavor flavor;
00055       private CommandMap commandMap;
00056       private DataContentHandler dch;
00057 */
00058 
00068 struct axiom_data_handler_ops
00069 {
00070    axis2_char_t *(AXIS2_CALL *
00071     get_content_type)(axiom_data_handler_t *data_handler, 
00072         const axis2_env_t *env); 
00073    
00074    axis2_byte_t* (AXIS2_CALL *
00075     get_input_stream)(axiom_data_handler_t *data_handler, 
00076         const axis2_env_t *env); 
00077 
00078     axis2_status_t (AXIS2_CALL *
00079     read_from)(axiom_data_handler_t *data_handler, 
00080         const axis2_env_t *env, 
00081         axis2_byte_t** output_stream, 
00082         int *output_stream_size);
00083 
00084     axis2_status_t (AXIS2_CALL *
00085     set_binary_data)(axiom_data_handler_t *data_handler, 
00086         const axis2_env_t *env, 
00087         axis2_byte_t* input_stream, 
00088         int input_stream_len);
00089 
00090     axis2_status_t (AXIS2_CALL *
00091     write_to)(axiom_data_handler_t *data_handler, 
00092         const axis2_env_t *env);
00093 
00094     axis2_status_t ( AXIS2_CALL *
00095     set_file_name )(
00096         axiom_data_handler_t *data_handler, 
00097         const axis2_env_t *env, 
00098         axis2_char_t* file_name);
00099     
00100     axis2_status_t (AXIS2_CALL *
00101     free) (axiom_data_handler_t *data_handler, 
00102         const axis2_env_t *env);
00103 };
00104 
00109 struct axiom_data_handler
00110 {
00111    axiom_data_handler_ops_t *ops;
00112    
00113    /*
00114     axis2_char_t type;
00115     *void handler;   
00116    */
00117 };
00118 
00123 AXIS2_EXTERN axiom_data_handler_t * AXIS2_CALL 
00124 axiom_data_handler_create (const axis2_env_t *env, 
00125     const axis2_char_t *file_name, 
00126     const axis2_char_t *mime_type);
00127 
00128 
00129 /*************************** Function macros **********************************/
00130 
00131 #define AXIOM_DATA_HANDLER_FREE(data_handler, env) \
00132     ((data_handler)->ops->free (data_handler, env))
00133 
00134 #define AXIOM_DATA_HANDLER_GET_CONTENT_TYPE(data_handler, env) \
00135     ((data_handler)->ops->get_content_type (data_handler, env))
00136 
00137 #define AXIOM_DATA_HANDLER_GET_INPUT_STREAM(data_handler, env) \
00138     ((data_handler)->ops->get_input_stream (data_handler, env))
00139 
00140 #define AXIOM_DATA_HANDLER_READ_FROM(data_handler, env, output_stream, output_stream_size) \
00141     ((data_handler)->ops->read_from (data_handler, env, output_stream, output_stream_size))
00142 
00143 #define AXIOM_DATA_HANDLER_SET_BINARY_DATA(data_handler, env, input_stream, input_stream_size) \
00144     ((data_handler)->ops->set_binary_data (data_handler, env, input_stream, input_stream_size))
00145 
00146 #define AXIOM_DATA_HANDLER_WRITE_TO(data_handler, env) \
00147     ((data_handler)->ops->write_to (data_handler, env))
00148 
00149 #define AXIOM_DATA_HANDLER_SET_FILE_NAME(data_handler, env, file_name) \
00150     ((data_handler)->ops->set_file_name (data_handler, env, file_name))
00151 
00152 /*************************** End of function macros ***************************/
00153 
00156 #ifdef __cplusplus
00157 }
00158 #endif
00159 #endif  /* AXIOM_DATA_HANDLER_H */

Generated on Thu Oct 26 21:00:10 2006 for Axis2/C by  doxygen 1.4.7