summaryrefslogtreecommitdiffstats
path: root/include/axis2_svc_grp.h
blob: c922e2dbcd81d7a9d6d13554ec9c2a01570512bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef AXIS2_SVC_GRP_H
#define AXIS2_SVC_GRP_H

/**
 * @defgroup axis2_svc_grp service group
 * @ingroup axis2_desc
 * service group represents the static structure of a service group in
 * the Axis2 configuration.
 * In Axis2 description hierarchy, a service group lives inside the
 * configuration. service groups are configured in services.xml files located
 * in the respective service group folders of the services folder in the repository.
 * In services.xml file, services groups are declared at top level.
 * A service group can have one or more services associated with it.
 * Sometimes services.xml would not have a service group defined, but only a
 * service. In such cases a service group with the same name as that of the
 * service mentioned in services.xml would be created by the deployment
 * engine and the service would be associated with that newly created service
 * group. The deployment engine would create service group instances to represent
 * those configured service groups in services.xml files and would store
 * them in the configuration.
 * service group encapsulates data on engaged module information and the
 * service associated with service group.
 * @{
 */

/**
 * @file axis2_svc_grp.h
 */

#include <axutil_param_container.h>
#include <axis2_desc.h>
#include <axis2_svc.h>
#include <axis2_svc_grp_ctx.h>
#include <axis2_module_desc.h>

#ifdef __cplusplus
extern "C"
{
#endif

    /** Type name for struct axis2_svc_grp */
    typedef struct axis2_svc_grp axis2_svc_grp_t;

    struct axis2_svc;
    struct axis2_svc_grp_ctx;
	struct axis2_module_desc;

    /**
      * Frees service group.
      * @param svc_grp pointer to service group struct
      * @param env pointer to environment struct
      * @return void
      */
    AXIS2_EXTERN void AXIS2_CALL
    axis2_svc_grp_free(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env);

    /**
     * Sets service group name.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param svc_grp_name service group name string 
     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE 
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axis2_svc_grp_set_name(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        const axis2_char_t * svc_grp_name);

    /**
     * Gets service group name.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @return service group name string 
     */
    AXIS2_EXTERN const axis2_char_t *AXIS2_CALL
    axis2_svc_grp_get_name(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env);

    /**
     * Adds given service to service group.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param service service to be added, service group assumes ownership
     * of service
     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE 
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axis2_svc_grp_add_svc(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        struct axis2_svc *svc);

    /**
     * Gets named service from service group.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param svc_qname pointer to QName of the service
     * @return pointer to service corresponding to given QName, returns a 
     * reference, not a cloned copy
     */
    AXIS2_EXTERN struct axis2_svc *AXIS2_CALL
    axis2_svc_grp_get_svc(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        const axutil_qname_t * svc_qname);

    /**
     * Gets all services associated with service group. 
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @return pointer to hash table containing all services, returns a 
     * reference, not a cloned copy
     */
    AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
    axis2_svc_grp_get_all_svcs(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env);

    /**
     * Removes named service from service group.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param svc_name pointer to service QName
     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE 
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axis2_svc_grp_remove_svc(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        const axutil_qname_t * svc_qname);

    /**
     * Adds parameter.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param param pointer to parameter, service group assumes ownership 
     * of parameter
     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE 
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axis2_svc_grp_add_param(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        axutil_param_t * param);

    /**
     * Gets named parameter.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param name parameter name
     * @return pointer to named parameter if exists, else NULL. Returns a 
     * reference, not a cloned copy
     */
    AXIS2_EXTERN axutil_param_t *AXIS2_CALL
    axis2_svc_grp_get_param(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        const axis2_char_t * name);

	/**
	 * Remove a parameter.
	 * @param svc_grp pointer to service grp struct
	 * @param env pointer to the environment
	 * @Param param_name parameter name to be removed
	 */
	AXIS2_EXTERN axis2_status_t AXIS2_CALL
	axis2_svc_grp_remove_param(
		const axis2_svc_grp_t *svc_grp,
		const axutil_env_t *env,
		const axis2_char_t *param_name);

    /**
     * Gets all parameters set on service group.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @return pointer to array list containing parameter, returns a 
     * reference, not a cloned copy
     */
    AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL

    axis2_svc_grp_get_all_params(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env);

    /**
     * Checks if the named parameter is locked.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param param_name pointer to param name
     * @return AXIS2_TRUE if the named parameter is locked, else AXIS2_FALSE
     */
    AXIS2_EXTERN axis2_bool_t AXIS2_CALL
    axis2_svc_grp_is_param_locked(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        const axis2_char_t * param_name);

    /**
     * Adds given module QName to list of module QNames.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param module_name pointer to module QName
     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE 
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axis2_svc_grp_add_module_qname(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        const axutil_qname_t * module_qname);

    /**
     * Gets parent which is of type configuration.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @return pointer to parent configuration, returns a 
     * reference, not a cloned copy
     */
    AXIS2_EXTERN struct axis2_conf *AXIS2_CALL
    axis2_svc_grp_get_parent(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env);

    /**
     * Sets parent which is of type configuration.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param parent parent configuration, service group does not assume
     * the ownership of configuration
     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE 
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axis2_svc_grp_set_parent(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        struct axis2_conf *parent);

    /**
     * Engages named module to service group. Engaging a module to service 
     * group would ensure that the same module would be engaged to all 
     * services within the group.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param module_name pointer to module QName
     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE 
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axis2_svc_grp_engage_module(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        const axutil_qname_t * module_qname);

    /**
     * Gets all module QNames associated with service group.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @return pointer to array list containing all QNames, returns a 
     * reference, not a cloned copy
     */
    AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
	axis2_svc_grp_get_all_module_qnames(
		const axis2_svc_grp_t * svc_grp,
		const axutil_env_t * env);

    /**
     * Adds module reference.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param moduleref pointer to module QName
     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE 
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axis2_svc_grp_add_module_ref(
        axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        const axutil_qname_t * moduleref);

    /**
     * Gets all module references.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @return pointer to array list containing module reference, returns 
     * a reference, not a cloned copy
     */
    AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
    axis2_svc_grp_get_all_module_refs(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env);

    /**
     * Gets service group context related to this service group.
     * @param svc_grp pointer to service group struct
     * @param env pointer to environment struct
     * @param parent pointer to configuration context which is the parent of 
     * the context hierarchy
     * @return pointer to service group context related to this service 
     * group, returns a reference, not a cloned copy
     */
    AXIS2_EXTERN struct axis2_svc_grp_ctx *AXIS2_CALL
    axis2_svc_grp_get_svc_grp_ctx(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env,
        struct axis2_conf_ctx *parent);

    AXIS2_EXTERN axutil_param_container_t *AXIS2_CALL
    axis2_svc_grp_get_param_container(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env);

    /**
     * Creates a service group struct instance.
     * @param env pointer to environment struct
     * @return pointer to newly created service group
     */
    AXIS2_EXTERN axis2_svc_grp_t *AXIS2_CALL
    axis2_svc_grp_create(
        const axutil_env_t * env);

    /**
     * Creates service group with given configuration as the parent.
     * @param env pointer to environment struct
     * @param conf pointer to configuration, service group created does not 
     * assume ownership of configuration
     * @return pointer to newly created service group
     */
    AXIS2_EXTERN axis2_svc_grp_t *AXIS2_CALL
    axis2_svc_grp_create_with_conf(
        const axutil_env_t * env,
        struct axis2_conf *conf);

    /**
     * Gets base description.
     * @param svc_grp pointer to message
     * @param env pointer to environment struct
     * @return pointer to base description struct
     */
    AXIS2_EXTERN axis2_desc_t *AXIS2_CALL
    axis2_svc_grp_get_base(
        const axis2_svc_grp_t * svc_grp,
        const axutil_env_t * env);

	/**
	 * Checks whether a given module is engaged to the service group
	 * @param svc_grp pointer to service group
	 * @param env pointer to the environment struct
	 * @return pointer to base description struct
	 */

	AXIS2_EXTERN axis2_bool_t AXIS2_CALL
	axis2_svc_grp_is_module_engaged(
		const axis2_svc_grp_t *svc_grp,
		const axutil_env_t *env,
		const axutil_qname_t *qname);

	/**
	 * Disengage a module from a service group. This method will disengage the
	 * all the services belonging to the service group from the specified module.
	 * @param svc_grp pointer to the service group instance
	 * @param env environment struct
	 * @param mod_desc pointer to the module description instance
	 * @Param conf pointer to the configuration
	 */

	AXIS2_EXTERN axis2_status_t AXIS2_CALL
	axis2_svc_grp_disengage_module(
		const axis2_svc_grp_t *svc_grp,
		const axutil_env_t *env,
		struct axis2_module_desc *module_desc,
		struct axis2_conf *conf);


#ifdef __cplusplus
}
#endif
#endif                          /* AXIS2_SVC_GRP_H  */