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 "xsd_QName.h"
18 #include "globus_soap_message.h"
19 #include "globus_xsd_type_info.h"
20 #include "TopicInfo.h"
21 #include "wsa_EndpointReferenceType.h"
22 #include "globus_i_notification_producer.h"
23 #include "globus_wsrf_core_tools.h"
24 #include "globus_wsrf_resource.h"
25
26 void
27 TopicInfo_destroy_contents(
28     TopicInfo * instance)
29 1 {
30 1     wsa_EndpointReferenceType *         epr;
31 1     int                                 i;
32 1     globus_result_t                     result;
33 1     globus_resource_t                   subscription_resource;
34     globus_i_notification_subscription_entry_t *
35 1                                         subscription_entry;
36 1     GlobusFuncName(TopicInfo_destroy_contents);
37 1     GlobusSoapMessageDebugEnter();
38
39 1     if (instance)
40     {
41 1         wsnt_TopicExpressionType_destroy_contents(
42              &instance->topic);
43
44 1         if (instance->current_message)
45         {
46 0             xsd_anyType_destroy(
47                  instance->current_message);
48 0             instance->current_message = NULL;
49         }
50
51 1         for (i = 0; i < instance->subscriptions.length; i++)
52         {
53 0             epr = &instance->subscriptions.elements[i];
54
55 0             subscription_entry = globus_hashtable_remove(
56                     &globus_i_notification_subscriptions,
57                     (void *) epr);
58
59 0             if (subscription_entry)
60             {
61 0                 wsa_EndpointReferenceType_destroy(subscription_entry->epr);
62 0                 free(subscription_entry);
63             }
64
65 0             result = globus_wsrf_core_get_resource_from_epr(
66                 epr,
67                 &subscription_resource);
68
69 0             if (result == GLOBUS_SUCCESS)
70             {
71 0                 globus_resource_destroy(subscription_resource);
72             }
73         }
74 1         wsa_EndpointReferenceType_array_destroy_contents(&instance->subscriptions);
75     }
76
77 1     GlobusSoapMessageDebugExit();
78 }