axiom_data_handler.h

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

Generated on Wed Dec 20 20:14:09 2006 for Axis2/C by  doxygen 1.5.1