ITK Function Reference

(12.1)
dispatcher_itk.h
Go to the documentation of this file.
1 /*
2  Copyright 2017 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
3  ==================================================
4  Copyright 2008.
5  Siemens Product Lifecycle Management Software Inc.
6  All Rights Reserved.
7  ==================================================
8  Copyright 2017 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.
9 */
10 
19 #ifndef DISPATCHER_ITK_H
20 #define DISPATCHER_ITK_H
21 
22 
23 #include <dispatcher/libdispatcher_exports.h>
25 
26 #include <time.h>
27 
28 /*
29  * A OOTB supported translation argument that supports override of the
30  * configured setting for update of existing data.
31  */
32 #define DISPATCHER_UPDATE_EXISTING "ETSUpdOvr"
33 
34 #define DISPATCHER_PREF_SUCCESSFUL_STATES "TS_successful_states"
35 #define DISPATCHER_PREF_UNSUCCESSFUL_STATES "TS_unsuccessful_states"
36 #define DISPATCHER_PREF_INPROCESS_STATES "TS_inprocess_states"
37 
46 #define ETS_translation_arg_size_c 255
47 #define ETS_TRANSLATION_ARG_NV_SEP "="
48 #define ETS_TRANSLATION_ARG_MIN_SIZE 3
49 
51 #define ETS_TRANSLATION_ARG_NAME_TRIGGER "ETSTrigger"
52 
57 #define ETS_TRANSLATION_ARG_NAME_UPDATE_OVR "ETSUpdOvr"
58 
62 #define ETS_TRANSLATION_ARG_VALUE_TRUE "true"
63 #define ETS_TRANSLATION_ARG_VALUE_FALSE "false"
64 
65 
66 #ifdef __cplusplus
67 extern "C"
68 {
69 #endif
70 
71 /*
72  * Dispatcher ITK Methods
73  */
74 
75 /*******************************************************************************
76  * NAME: DISPATCHER_create_request
77  * AUTHOR(S): David Hollins
78  *
79  * DESCRIPTION
80  *
81  * This method will create a request object using the specified parameters. The
82  * minimal inputs required to create a request are the provider name, the service
83  * name and a priority. The other remaining inputs can be passed as null values.
84  *
85  * INPUTS
86  *
87  * provider_name - the name of the provider that will process this request
88  * service_name - the name of the service that will process this request
89  * priority - the priority to assign to the request
90  * (0 LOW to 3 HIGH)
91  * start_time - the time at which to start this request
92  * end_time - the time at which no more repeating requests of this same type
93  * will be processed. If the interval option for repeating is NOT
94  * selected, then this paramater is unused
95  * interval - the number of times to repeat this request
96  * 0 - no repeating
97  * 1 2 3 ... - number of times to repeat this task
98  * num_objs - the length of the primary and secondary object arrays
99  * primary_objs - the array of primary objects
100  * secondary_objs - the array of related secondary objects
101  * num_args - the number of request arguments
102  * request_args - the array of request arguments in the format of
103  * <KEY>=<VALUE> (i.e. NAME=John)
104  * type - a string for use by the application creating the request for use in
105  * defining a type for the request (i.e. SYSTEM, THINCLIENT, etc.)
106  * num_datafiles - the number of datafiles you would like to upload
107  * datafiles - the array of key/path value pairs for the datafiles you would
108  * like to upload. The following format needs to be followed when
109  * passing the key/path value pairs:
110  * <KEY>=<PATH> i.e. LogFile=C:/temp/logfile.log
111  *
112  * NOTE: Use forward slashes(/) for the path seperators.
113  *
114  * OUTPUTS
115  *
116  * request - the request that was created
117  *
118  * RETURN
119  *
120  * ITK_ok if no errors, otherwise an error code
121  *
122  ******************************************************************************/
123 extern int DISPATCHER_API
125  const char* provider_name,
126  const char* service_name,
127  const int priority,
128  const time_t start_time,
129  const time_t end_time,
130  const int interval,
131  const int num_objs,
132  const tag_t* primary_objs,
133  const tag_t* secondary_objs,
134  const int num_args,
135  const char** request_args,
136  const char* type,
137  const int num_datafiles,
138  const char** data_file_keys,
139  const char** datafiles,
140  tag_t* request
141  );
142 
143 /*******************************************************************************
144  * NAME: DISPATCHER_query_requests
145  * AUTHOR(S): David Hollins
146  *
147  * DESCRIPTION
148  *
149  * This function allows the user to query for requests based on selected
150  * criteria. All defined inputs are OPTIONAL and if omitted will not become
151  * part of the query.
152  *
153  * INPUTS
154  *
155  * num_providers - number of providers
156  * providers - providers
157  * num_services - number of services
158  * services - services
159  * num_states - number of states
160  * states - states
161  * num_priorities - number of priorities
162  * priorities - priorities
163  * num_users - number of users
164  * owning_users - owning users
165  * num_taskids - number of taskids
166  * task_ids - task IDs
167  *
168  * OUTPUTS
169  *
170  * num_requests - number of requests
171  * queried_requests - requests
172  *
173  * num_requests - the number of requests returned from the query
174  * requests - the requests returned from the query
175  *
176  * RETURN
177  *
178  * ITK_ok if no errors, otherwise an error code
179  *
180  ******************************************************************************/
181 extern int DISPATCHER_API
183  const int num_providers,
184  const char** providers,
185  const int num_services,
186  const char** services,
187  const int num_states,
188  const char** states,
189  const int num_priorities,
190  const int* priorities,
191  const int num_users,
192  const char** owning_users,
193  const int num_taskids,
194  const char** task_ids,
195  int* num_requests,
196  tag_t** queried_requests
197  );
198 
199 /*******************************************************************************
200  * NAME: DISPATCHER_wait_for_request
201  * AUTHOR(S): David Hollins
202  *
203  * DESCRIPTION
204  *
205  * This function allows the user to query for requests based on selected
206  * criteria. All defined inputs are OPTIONAL and if omitted will not become
207  * part of the query.
208  *
209  * INPUTS
210  *
211  * request - tag of the request to wait
212  * interval - interval in seconds defining how often the request state should be checked
213  * time_to_wait - time in seconds to continue checking, 0 = no time limit
214  * is_final - whether or not the request is in a final state, successful or unsuccessful
215  *
216  * OUTPUTS
217  *
218  * complete - logical specifying if the request was complete or not
219  *
220  * RETURN
221  *
222  * ITK_ok if no errors, otherwise an error code
223  *
224  ******************************************************************************/
225 extern int DISPATCHER_API
227  tag_t request,
228  int interval,
229  int time_to_wait,
230  logical* is_final
231  );
232 
233 /*******************************************************************************
234  * NAME: DISPATCHER_delete_request
235  * AUTHOR(S): David Hollins
236  *
237  * DESCRIPTION
238  *
239  * This function allows the user to delete a request. If the user specifies to
240  * check the state, then only states in a final state will be allowed to be
241  * removed.
242  *
243  * INPUTS
244  *
245  * requestToDelete - the tag of the request object to delete
246  * ignoreState - should the state be ignored or validated
247  *
248  * OUTPUTS
249  *
250  *
251  * RETURN
252  *
253  * ITK_ok if no errors, otherwise an error code
254  *
255  ******************************************************************************/
256 extern int DISPATCHER_API
258  tag_t requestToDelete,
259  int ignoreState
260  );
261 
262 /*******************************************************************************
263  * NAME: DISPATCHER_add_files_to_request
264  * AUTHOR(S): David Hollins
265  *
266  * DESCRIPTION
267  *
268  * This function allows the user to attach files to a request with a given key.
269  *
270  * INPUTS
271  *
272  * request - tag of the request
273  * numFiles - number of files to upload
274  * fileKeys - file keys to associate to files
275  * files - absolute paths to files
276  *
277  * OUTPUTS
278  *
279  *
280  * RETURN
281  *
282  * ITK_ok if no errors, otherwise an error code
283  *
284  ******************************************************************************/
285 extern int DISPATCHER_API
287  const tag_t request,
288  const int numFiles,
289  const char** fileKeys,
290  const char** files
291  );
292 
293 /*******************************************************************************
294  * NAME: DISPATCHER_get_files_from_request
295  * AUTHOR(S): David Hollins
296  *
297  * DESCRIPTION
298  *
299  * This function allows the user to get files from a request with a given key.
300  *
301  * INPUTS
302  *
303  * request - tag of the request
304  * numKeys - number of keys to get files
305  * keys - file keys identifying which files to get
306  * path - absolute paths to directory to get files
307  *
308  * OUTPUTS
309  *
310  *
311  * RETURN
312  *
313  * ITK_ok if no errors, otherwise an error code
314  *
315  ******************************************************************************/
316 extern int DISPATCHER_API
318  const tag_t request,
319  const int numKeys,
320  const char** keys,
321  const char* path
322  );
323 
324 /*******************************************************************************
325  * NAME: DISPATCHER_find_request_by_tag
326  * AUTHOR(S): David Hollins
327  *
328  * DESCRIPTION
329  *
330  * This function will return the attributes of a request using its tag.
331  *
332  * INPUTS
333  *
334  * requestTag - tag of the request to load
335  *
336  * OUTPUTS
337  *
338  * task_id - task id
339  * providerName - provider name
340  * serviceName - service name
341  * priority - priority (1, 2 or 3)
342  * currentState - current state
343  * type - type of request
344  * numObjs - number of primary/secondary objects
345  * primaryObjs - primary objects
346  * secondaryObjs - secondary objects
347  * numArgs - number of arguments
348  * argKeys - argument keys
349  * argData - argument data
350  *
351  * RETURN
352  *
353  * ITK_ok if no errors, otherwise an error code
354  *
355  ******************************************************************************/
356 extern int DISPATCHER_API
358  const tag_t requestTag,
359  char** task_id,
360  char** providerName,
361  char** serviceName,
362  int* priority,
363  char** currentState,
364  char** type,
365  int* numObjs,
366  tag_t** primaryObjs,
367  tag_t** secondaryObjs,
368  int* numArgs,
369  char*** argKeys,
370  char*** argData
371  );
372 
373 /*******************************************************************************
374  * NAME: DISPATCHER_is_final_state
375  * AUTHOR(S): David Hollins
376  *
377  * DESCRIPTION
378  *
379  * This function allows the user to check as to whether or not a request is in
380  * a final state.
381  *
382  * INPUTS
383  *
384  * request - tag of the request
385  *
386  * OUTPUTS
387  *
388  * isFinalState - 0 - not final state, 1 - final state
389  *
390  * RETURN
391  *
392  * ITK_ok if no errors, otherwise an error code
393  *
394  ******************************************************************************/
395 extern int DISPATCHER_API
397  const tag_t request,
398  int* isFinalState
399  );
400 
401 /* ========================================================================= */
402 /* DEPRECATED ETS FUNCTIONS
403  *
404  * The following functions have been deprecated and will be removed in the next
405  * release of Teamcenter. Please make the necessary changes to migrate to the
406  * new Dispatcher Management functions defined above.
407  */
408 
409  /*******************************************************************************
410  * NAME: ETS_create_request (DEPRECATED)
411  *
412  * DESCRIPTION
413  *
414  * This function validates a request to create a translation request object.
415  *
416  * NOTE: Please use the replacement method within Dispatcher Management.
417  *
418  ******************************************************************************/
419  extern int DISPATCHER_API
421  const int num_objs, /* <I> */
422  const tag_t *primary_objs, /* <I> */
423  const tag_t *secondary_objs, /* <I> */
424  const int sched_priority, /* <I> */
425  const char *provider_name, /* <I> */
426  const char *translator_name, /* <I> */
427  const char *trigger, /* <I> */
428  tag_t *request /* <O> */
429  );
430 
431  /*******************************************************************************
432  * NAME: ETS_create_request2 (DEPRECATED)
433  *
434  * DESCRIPTION
435  *
436  * This function validates a request to create a translation request object
437  * that contains additional translation arguments.
438  *
439  * NOTE: Please use the replacement method within Dispatcher Management.
440  *
441  ******************************************************************************/
442 
443  extern int DISPATCHER_API ETS_create_request2 (
444  const int num_objs, /* <I> */
445  const tag_t *primary_objs, /* <I> */
446  const tag_t *secondary_objs, /* <I> */
447  const int priority, /* <I> */
448  const char *provider_name, /* <I> */
449  const char *translator_name, /* <I> */
450  const char *trigger, /* <I> */
451  const int num_translation_args, /* <I> */
452  const char **translation_args, /* <I> */
453  tag_t *request /* <O> */
454  );
455 
456  /*******************************************************************************
457  * NAME: ETS_query_requests (DEPRECATED)
458  *
459  * DESCRIPTION
460  *
461  * This function allows the user to query for requests bases in a state.
462  *
463  * NOTE: Please use the replacement method within Dispatcher Management.
464  *
465  ******************************************************************************/
466  extern int DISPATCHER_API ETS_query_requests(
467  const char *translationRequestState, /* <I> */
468  int *numTranslationRequests, /* <O> */
469  tag_t **translationRequests ); /* <OF> */
470 
471 
472  /*******************************************************************************
473  * NAME: ETS_find_request_by_tag (DEPRECATED)
474  *
475  * DESCRIPTION
476  *
477  * This function returns the properties of a request given the tag of the request
478  * object.
479  *
480  * NOTE: Please use the replacement method within Dispatcher Management.
481  *
482  ******************************************************************************/
483  extern int DISPATCHER_API ETS_find_request_by_tag(
484  const tag_t requestTag,
485  char** task_id,
486  char** state,
487  int* num_objs,
488  tag_t** primary_objs,
489  tag_t** secondary_objs,
490  int* priority,
491  char** provider_name,
492  char** translator_name,
493  int* num_trans_args,
494  char*** translation_args
495  );
496 
497  /*******************************************************************************
498  * NAME: ETS_is_final_state (DEPRECATED)
499  *
500  * DESCRIPTION
501  *
502  * This function returns returns an integer representing if the request that
503  * was specified is currently in a final state.
504  *
505  * NOTE: Please use the replacement method within Dispatcher Management.
506  *
507  ******************************************************************************/
508  extern int DISPATCHER_API
510  const tag_t request,
511  int* isFinalState
512  );
513 
514 #ifdef __cplusplus
515 }
516 #endif
517 
518 #include <dispatcher/libdispatcher_undef.h>
519 
520 #endif