| 1 | /* | |
| 2 | * Copyright 1999-2006 University of Chicago | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | ||
| 17 | #include "globus_i_xsd.h" | |
| 18 | #include "globus_i_xsd_type_info.h" | |
| 19 | #include "globus_soap_message.h" | |
| 20 | #include "xsd_language.h" | |
| 21 | ||
| 22 | GLOBUS_I_XSD_DEFINE_QNAME(xsd, language); | |
| 23 | GLOBUS_I_XSD_DEFINE_TYPE_INFO(xsd_language); | |
| 24 | 0 | GLOBUS_I_XSD_DEFINE_TYPE_FUNCTIONS(xsd_language); |
| 25 | 0 | GLOBUS_I_XSD_DEFINE_INIT_CONTENTS_GENERIC(xsd_language); |
| 26 | ||
| 27 | globus_result_t | |
| 28 | xsd_language_copy_contents( | |
| 29 | xsd_language * dest, | |
| 30 | const xsd_language * src) | |
| 31 | { | |
| 32 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 33 | 0 | GlobusFuncName(xsd_language_copy_contents); |
| 34 | 0 | GlobusSoapMessageDebugEnter(); |
| 35 | ||
| 36 | 0 | if(dest) |
| 37 | { | |
| 38 | 0 | if(!src || !*src) |
| 39 | { | |
| 40 | 0 | *dest = NULL; |
| 41 | } | |
| 42 | else | |
| 43 | { | |
| 44 | 0 | *dest = globus_libc_strdup(*src); |
| 45 | 0 | if(!*dest) |
| 46 | { | |
| 47 | 0 | result = GlobusSoapMessageErrorOutOfMemory; |
| 48 | } | |
| 49 | } | |
| 50 | } | |
| 51 | ||
| 52 | 0 | GlobusSoapMessageDebugExit(); |
| 53 | 0 | return result; |
| 54 | } | |
| 55 | void | |
| 56 | xsd_language_destroy_contents( | |
| 57 | xsd_language * instance) | |
| 58 | 0 | { |
| 59 | 0 | GlobusFuncName(xsd_language_destroy_contents); |
| 60 | 0 | GlobusSoapMessageDebugEnter(); |
| 61 | ||
| 62 | 0 | if(*instance) |
| 63 | { | |
| 64 | 0 | free(*instance); |
| 65 | 0 | *instance = NULL; |
| 66 | } | |
| 67 | ||
| 68 | 0 | GlobusSoapMessageDebugExit(); |
| 69 | } | |
| 70 | ||
| 71 | globus_result_t | |
| 72 | xsd_language_serialize_contents( | |
| 73 | const xsd_QName * element, | |
| 74 | const xsd_language * instance, | |
| 75 | globus_soap_message_handle_t soap_message_handle, | |
| 76 | globus_xsd_element_options_t options) | |
| 77 | 0 | { |
| 78 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 79 | 0 | GlobusFuncName(xsd_language_serialize_contents); |
| 80 | 0 | GlobusSoapMessageDebugEnter(); |
| 81 | ||
| 82 | /* serialize contents of type */ | |
| 83 | 0 | result = globus_soap_message_serialize_string( |
| 84 | soap_message_handle, instance); | |
| 85 | ||
| 86 | 0 | GlobusSoapMessageDebugExit(); |
| 87 | 0 | return result; |
| 88 | } | |
| 89 | ||
| 90 | globus_result_t | |
| 91 | xsd_language_deserialize_contents( | |
| 92 | const xsd_QName * eqn, | |
| 93 | xsd_language * instance, | |
| 94 | globus_soap_message_handle_t soap_message_handle, | |
| 95 | globus_xsd_element_options_t options) | |
| 96 | 0 | { |
| 97 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 98 | 0 | GlobusFuncName(xsd_language_deserialize_contents); |
| 99 | 0 | GlobusSoapMessageDebugEnter(); |
| 100 | ||
| 101 | 0 | result = globus_soap_message_deserialize_string( |
| 102 | soap_message_handle, instance); | |
| 103 | ||
| 104 | 0 | GlobusSoapMessageDebugExit(); |
| 105 | 0 | return result; |
| 106 | } | |
| 107 | ||
| 108 | globus_result_t | |
| 109 | xsd_language_serialize_attribute( | |
| 110 | const xsd_QName * element_qname, | |
| 111 | const xsd_language * instance, | |
| 112 | globus_soap_message_handle_t message_handle, | |
| 113 | globus_xsd_element_options_t options) | |
| 114 | 0 | { |
| 115 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 116 | 0 | GlobusFuncName(xsd_language_serialize_attribute); |
| 117 | 0 | GlobusSoapMessageDebugEnter(); |
| 118 | ||
| 119 | 0 | result = globus_soap_message_serialize_string_attribute( |
| 120 | message_handle, element_qname, instance); | |
| 121 | 0 | if(result != GLOBUS_SUCCESS) |
| 122 | { | |
| 123 | 0 | result = GlobusSoapMessageErrorSerializeFailed( |
| 124 | result, NULL, element_qname); | |
| 125 | goto exit; | |
| 126 | } | |
| 127 | ||
| 128 | exit: | |
| 129 | ||
| 130 | 0 | GlobusSoapMessageDebugExit(); |
| 131 | 0 | return result; |
| 132 | } | |
| 133 | ||
| 134 | globus_result_t | |
| 135 | xsd_language_deserialize_attribute( | |
| 136 | const xsd_QName * element_qname, | |
| 137 | xsd_language * ip, | |
| 138 | globus_soap_message_handle_t message_handle, | |
| 139 | globus_xsd_element_options_t options) | |
| 140 | 0 | { |
| 141 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 142 | 0 | GlobusFuncName(xsd_language_deserialize_attribute); |
| 143 | 0 | GlobusSoapMessageDebugEnter(); |
| 144 | ||
| 145 | 0 | result = globus_soap_message_deserialize_string_attribute( |
| 146 | message_handle, element_qname, ip); | |
| 147 | 0 | if(GlobusSoapMessageStatusAttributeNotFoundCheck(result)) |
| 148 | { | |
| 149 | 0 | result = GLOBUS_SUCCESS; |
| 150 | 0 | goto exit; |
| 151 | } | |
| 152 | ||
| 153 | 0 | if(result != GLOBUS_SUCCESS) |
| 154 | { | |
| 155 | 0 | goto error_exit; |
| 156 | } | |
| 157 | ||
| 158 | 0 | goto exit; |
| 159 | ||
| 160 | error_exit: | |
| 161 | ||
| 162 | 0 | GlobusSoapMessageErrorDeserializeFailed(result, element_qname); |
| 163 | ||
| 164 | exit: | |
| 165 | ||
| 166 | 0 | GlobusSoapMessageDebugExit(); |
| 167 | 0 | return result; |
| 168 | } | |
| 169 | ||
| 170 | globus_result_t | |
| 171 | xsd_language_deserialize_attribute_pointer( | |
| 172 | const xsd_QName * element_qname, | |
| 173 | xsd_language ** ip, | |
| 174 | globus_soap_message_handle_t message_handle, | |
| 175 | globus_xsd_element_options_t options) | |
| 176 | 0 | { |
| 177 | 0 | xsd_language * instance = NULL; |
| 178 | 0 | globus_result_t result = GLOBUS_SUCCESS; |
| 179 | 0 | GlobusFuncName(xsd_language_deserialize_attribute_pointer); |
| 180 | 0 | GlobusSoapMessageDebugEnter(); |
| 181 | ||
| 182 | 0 | *ip = NULL; |
| 183 | ||
| 184 | 0 | result = xsd_language_init(&instance); |
| 185 | ||
| 186 | 0 | if(result != GLOBUS_SUCCESS) |
| 187 | { | |
| 188 | 0 | goto error_exit; |
| 189 | } | |
| 190 | ||
| 191 | 0 | result = globus_soap_message_deserialize_string_attribute( |
| 192 | message_handle, element_qname, instance); | |
| 193 | 0 | if(GlobusSoapMessageStatusAttributeNotFoundCheck(result)) |
| 194 | { | |
| 195 | 0 | result = GLOBUS_SUCCESS; |
| 196 | 0 | goto exit; |
| 197 | } | |
| 198 | ||
| 199 | 0 | if(result != GLOBUS_SUCCESS) |
| 200 | { | |
| 201 | 0 | goto error_exit; |
| 202 | } | |
| 203 | ||
| 204 | 0 | *ip = instance; |
| 205 | ||
| 206 | 0 | goto exit; |
| 207 | ||
| 208 | error_exit: | |
| 209 | ||
| 210 | 0 | GlobusSoapMessageErrorDeserializeFailed(result, element_qname); |
| 211 | ||
| 212 | exit: | |
| 213 | ||
| 214 | 0 | if(result != GLOBUS_SUCCESS && instance) |
| 215 | { | |
| 216 | 0 | xsd_language_destroy(instance); |
| 217 | 0 | *ip = NULL; |
| 218 | } | |
| 219 | ||
| 220 | 0 | GlobusSoapMessageDebugExit(); |
| 221 | 0 | return result; |