| 1 | /* | |
| 2 | * Portions of this file Copyright 1999-2005 University of Chicago | |
| 3 | * Portions of this file Copyright 1999-2005 The University of Southern California. | |
| 4 | * | |
| 5 | * This file or a portion of this file is licensed under the | |
| 6 | * terms of the Globus Toolkit Public License, found at | |
| 7 | * http://www.globus.org/toolkit/download/license.html. | |
| 8 | * If you redistribute this file, with or without | |
| 9 | * modifications, you must include this notice in the file. | |
| 10 | */ | |
| 11 | ||
| 12 | #include "globus_soap_message.h" | |
| 13 | #include "globus_wsrf_resource.h" | |
| 14 | #include "globus_service_engine.h" | |
| 15 | #include "globus_operation_provider.h" | |
| 16 | #include "globus_service_registry.h" | |
| 17 | #include "globus_wsrf_core_tools.h" | |
| 18 | #include "version.h" | |
| 19 | ||
| 20 | #include "wsrp_QueryResourcePropertiesType.h" | |
| 21 | #include "wsrp_QueryResourcePropertiesResponseType.h" | |
| 22 | ||
| 23 | #define WSRP_QUERY_RESOURCE_PROPERTIES 1 | |
| 24 | #define NEED_INVALID_QUERY_EXPRESSION_FAULT 0 | |
| 25 | #define NEED_QUERY_EVALUATION_ERROR_FAULT 0 | |
| 26 | ||
| 27 | #include "wsrp_i_faults.h" | |
| 28 | ||
| 29 | /** | |
| 30 | * @page wsrp_QueryResourceProperties_provider QueryResourceProperties Provider | |
| 31 | * | |
| 32 | * <h2>Provider Usage Overview</h2> | |
| 33 | * This operation provider implements the QueryResourceProperties portType | |
| 34 | * defined in | |
| 35 | * http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl . | |
| 36 | * | |
| 37 | * This portType consists of the @a QueryResourceProperties operation and | |
| 38 | * related faults. | |
| 39 | * | |
| 40 | * <b>NOTE:</b> This provider is stub which merely returns either a | |
| 41 | * ResourceUnknownFaultType or UnknownQueryExpressionDialectFaultType fault. | |
| 42 | * | |
| 43 | * The WSRF service engine will automatically register this provider to handle | |
| 44 | * the QueryResourceProperties operation for services which use the port type. | |
| 45 | * | |
| 46 | * <h2>Limitations</h2> | |
| 47 | * This provider is stub which merely returns either a | |
| 48 | * ResourceUnknownFaultType or UnknownQueryExpressionDialectFaultType fault. | |
| 49 | */ | |
| 50 | GlobusExtensionDeclareModule(globus_ws_resource_properties); | |
| 51 | ||
| 52 | /* Prototypes */ | |
| 53 | static | |
| 54 | globus_result_t | |
| 55 | wsrp_QueryResourceProperties_init_provider( | |
| 56 | globus_service_engine_t engine, | |
| 57 | globus_soap_message_handle_t message, | |
| 58 | wsrp_QueryResourcePropertiesType * QueryResourceProperties); | |
| 59 | ||
| 60 | static | |
| 61 | globus_result_t | |
| 62 | wsrp_QueryResourceProperties_provider( | |
| 63 | globus_service_engine_t engine, | |
| 64 | globus_soap_message_handle_t message, | |
| 65 | globus_service_descriptor_t * service, | |
| 66 | wsrp_QueryResourcePropertiesType * QueryResourceProperties, | |
| 67 | wsrp_QueryResourcePropertiesResponseType * | |
| 68 | QueryResourcePropertiesResponse, | |
| 69 | char ** fault_name, | |
| 70 | void ** fault); | |
| 71 | ||
| 72 | static | |
| 73 | int | |
| 74 | wsrp_QueryResourceProperties_activate(void); | |
| 75 | ||
| 76 | static | |
| 77 | int | |
| 78 | wsrp_QueryResourceProperties_deactivate(void); | |
| 79 | ||
| 80 | /* Local Variables */ | |
| 81 | static xsd_QName wsrp_QueryResourceProperties_qname = | |
| 82 | { | |
| 83 | "http://www.globus.org/docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl", | |
| 84 | "QueryResourceProperties" | |
| 85 | }; | |
| 86 | ||
| 87 | static | |
| 88 | globus_operation_provider_descriptor_t | |
| 89 | wsrp_QueryResourceProperties_descriptor = | |
| 90 | { | |
| 91 | &wsrp_QueryResourceProperties_qname, | |
| 92 | "QueryResourceProperties", | |
| 93 | (void *)wsrp_QueryResourceProperties_init_provider, | |
| 94 | (void *)wsrp_QueryResourceProperties_provider | |
| 95 | }; | |
| 96 | ||
| 97 | GlobusExtensionDefineModule(wsrp_QueryResourceProperties) = | |
| 98 | { | |
| 99 | "wsrp_QueryResourceProperties", | |
| 100 | wsrp_QueryResourceProperties_activate, | |
| 101 | wsrp_QueryResourceProperties_deactivate, | |
| 102 | NULL, | |
| 103 | NULL, | |
| 104 | &local_version | |
| 105 | }; | |
| 106 | ||
| 107 | /* Implementation */ | |
| 108 | ||
| 109 | static | |
| 110 | globus_result_t | |
| 111 | wsrp_QueryResourceProperties_init_provider( | |
| 112 | globus_service_engine_t engine, | |
| 113 | globus_soap_message_handle_t message, | |
| 114 | wsrp_QueryResourcePropertiesType * QueryResourceProperties) | |
| 115 | 1 | { |
| 116 | 1 | return GLOBUS_SUCCESS; |
| 117 | } | |
| 118 | /* wsrp_QueryResourceProperties_init_provider() */ | |
| 119 | ||
| 120 | static | |
| 121 | globus_result_t | |
| 122 | wsrp_QueryResourceProperties_provider( | |
| 123 | globus_service_engine_t engine, | |
| 124 | globus_soap_message_handle_t message, | |
| 125 | globus_service_descriptor_t * service, | |
| 126 | wsrp_QueryResourcePropertiesType * QueryResourceProperties, | |
| 127 | wsrp_QueryResourcePropertiesResponseType * | |
| 128 | QueryResourcePropertiesResponse, | |
| 129 | char ** fault_name, | |
| 130 | void ** fault) | |
| 131 | 1 | { |
| 132 | globus_result_t result; | |
| 133 | globus_resource_t resource; | |
| 134 | ||
| 135 | 1 | result = globus_wsrf_core_get_resource( |
| 136 | message, | |
| 137 | service, | |
| 138 | &resource); | |
| 139 | ||
| 140 | 1 | if (result != GLOBUS_SUCCESS || resource == NULL) |
| 141 | { | |
| 142 | 0 | result = wsrp_l_ResourceUnknownFaultType_create( |
| 143 | fault_name, | |
| 144 | (wsrp_ResourceUnknownFaultType **) fault); | |
| 145 | ||
| 146 | 0 | goto out; |
| 147 | } | |
| 148 | /* We don't understand any XPATH query dialects yet */ | |
| 149 | 1 | result = wsrp_l_UnknownQueryExpressionDialectFaultType_create( |
| 150 | fault_name, | |
| 151 | (wsrp_UnknownQueryExpressionDialectFaultType **) fault); | |
| 152 | ||
| 153 | 1 | globus_resource_finish(resource); |
| 154 | ||
| 155 | 1 | out: |
| 156 | 1 | return result; |
| 157 | } | |
| 158 | /* wsrp_QueryResourceProperties_provider() */ | |
| 159 | ||
| 160 | static | |
| 161 | int | |
| 162 | wsrp_QueryResourceProperties_activate(void) | |
| 163 | 28 | { |
| 164 | 28 | int res = 0; |
| 165 | GlobusFuncName(wsrp_QueryResourceProperties_activate); | |
| 166 | ||
| 167 | ||
| 168 | 28 | res = globus_extension_registry_add( |
| 169 | GLOBUS_OPERATION_PROVIDER_REGISTRY, | |
| 170 | &wsrp_QueryResourceProperties_qname, | |
| 171 | GlobusExtensionMyModule(globus_ws_resource_properties), | |
| 172 | &wsrp_QueryResourceProperties_descriptor); | |
| 173 | ||
| 174 | 28 | return res; |
| 175 | } | |
| 176 | /* wsrp_QueryResourceProperties_activate(void) */ | |
| 177 | ||
| 178 | static | |
| 179 | int | |
| 180 | wsrp_QueryResourceProperties_deactivate(void) | |
| 181 | 0 | { |
| 182 | GlobusFuncName(wsrp_QueryResourceProperties_deactivate); | |
| 183 | ||
| 184 | 0 | globus_extension_registry_remove( |
| 185 | GLOBUS_OPERATION_PROVIDER_REGISTRY, | |
| 186 | &wsrp_QueryResourceProperties_qname); | |
| 187 | ||
| 188 | 0 | return 0; |
| 189 | } |