Axis2/C: operation context

- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

# operation context
[Context Hierarchy]

## Files
file | axis2_op_ctx.h
## Typedefs
typedef struct axis2_op_ctx | axis2_op_ctx_t
## Functions
AXIS2_EXTERN axis2_op_ctx_t * | axis2_op_ctx_create (const axutil_env_t *env, struct axis2_op *op, struct axis2_svc_ctx *svc_ctx)
AXIS2_EXTERN axis2_ctx_t * | axis2_op_ctx_get_base (const axis2_op_ctx_t *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN void | axis2_op_ctx_free (struct axis2_op_ctx *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axis2_op_ctx_init (struct axis2_op_ctx *op_ctx, const axutil_env_t *env, struct axis2_conf *conf)
AXIS2_EXTERN struct axis2_op * | axis2_op_ctx_get_op (const axis2_op_ctx_t *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN struct axis2_svc_ctx * | axis2_op_ctx_get_parent (const axis2_op_ctx_t *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axis2_op_ctx_add_msg_ctx (struct axis2_op_ctx *op_ctx, const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx)
AXIS2_EXTERN axis2_msg_ctx_t * | axis2_op_ctx_get_msg_ctx (const axis2_op_ctx_t *op_ctx, const axutil_env_t *env, const axis2_wsdl_msg_labels_t message_id)
AXIS2_EXTERN axis2_bool_t | axis2_op_ctx_get_is_complete (const axis2_op_ctx_t *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axis2_op_ctx_set_complete (struct axis2_op_ctx *op_ctx, const axutil_env_t *env, axis2_bool_t is_complete)
AXIS2_EXTERN axis2_status_t | axis2_op_ctx_cleanup (struct axis2_op_ctx *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axis2_op_ctx_set_parent (struct axis2_op_ctx *op_ctx, const axutil_env_t *env, struct axis2_svc_ctx *svc_ctx)
AXIS2_EXTERN axis2_msg_ctx_t ** | axis2_op_ctx_get_msg_ctx_map (const axis2_op_ctx_t *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axis2_op_ctx_set_response_written (axis2_op_ctx_t *op_ctx, const axutil_env_t *env, const axis2_bool_t response_written)
AXIS2_EXTERN axis2_bool_t | axis2_op_ctx_get_response_written (const axis2_op_ctx_t *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN void | axis2_op_ctx_destroy_mutex (struct axis2_op_ctx *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN axis2_bool_t | axis2_op_ctx_is_in_use (const axis2_op_ctx_t *op_ctx, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axis2_op_ctx_set_in_use (struct axis2_op_ctx *op_ctx, const axutil_env_t *env, axis2_bool_t is_in_use)
AXIS2_EXTERN axis2_status_t | axis2_op_ctx_increment_ref (axis2_op_ctx_t *op_ctx, const axutil_env_t *env)

## Detailed Description

operation context represents a running "instance" of an operation. operation context allows messages to be grouped into operations as in WSDL 2.0 specification. operations are essentially arbitrary message exchange patterns (MEP). So as messages are being exchanged, operation context remembers the state of message exchange pattern specifics. The implementation of operation context supports MEPs which have one input message and/or one output message. In order to support other MEPs one must extend this struct.

## Typedef Documentation

typedef struct axis2_op_ctx axis2_op_ctx_t

Type name for struct axis2_op_ctx

## Function Documentation

AXIS2_EXTERN axis2_status_t axis2_op_ctx_add_msg_ctx | ( | struct axis2_op_ctx * | op_ctx,
|  | const axutil_env_t * | env,
|  | axis2_msg_ctx_t * | msg_ctx |
| ) |  |  |

Adds a message context.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct
  | msg_ctx | pointer to message context does not assume the ownership of the struct

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t axis2_op_ctx_cleanup | ( | struct axis2_op_ctx * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  |

Cleans up the operation context. Clean up includes removing all message context references recorded in operation context.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_op_ctx_t* axis2_op_ctx_create | ( | const axutil_env_t * | env,
|  | struct axis2_op * | op,
|  | struct axis2_svc_ctx * | svc_ctx |
| ) |  |  |

Creates an operation context struct instance.

Parameters:

  | env | pointer to environment struct
  | op | pointer to operation that is related to operation context. operation context does not assume the ownership of the struct
  | svc_ctx | pointer to parent service context

Returns:
  pointer to newly created operation context

AXIS2_EXTERN void axis2_op_ctx_destroy_mutex | ( | struct axis2_op_ctx * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  |

Destroys mutex used to synchronize the read/write operations

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  returns void

AXIS2_EXTERN void axis2_op_ctx_free | ( | struct axis2_op_ctx * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  |

Frees operation context.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  void

AXIS2_EXTERN axis2_ctx_t* axis2_op_ctx_get_base | ( | const axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets base which is of context type.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  pointer to base context

AXIS2_EXTERN axis2_bool_t axis2_op_ctx_get_is_complete | ( | const axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the bool value indicating if the MEP is complete. MEP is considered complete when all the messages that are associated with the MEP has arrived.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  AXIS2_TRUE if MEP invocation is complete, else AXIS2_FALSE

AXIS2_EXTERN axis2_msg_ctx_t* axis2_op_ctx_get_msg_ctx | ( | const axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env,
|  | const axis2_wsdl_msg_labels_t | message_id |
| ) |  |  |

Gets message context with the given message ID.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct
  | message_id | message label of type axis2_wsdl_msg_labels_t. This can be one of AXIS2_WSDL_MESSAGE_LABEL_IN or AXIS2_WSDL_MESSAGE_LABEL_OUT from the axis2_wsdl_msg_labels enum.

Returns:
  pointer to message context with given ID

AXIS2_EXTERN axis2_msg_ctx_t** axis2_op_ctx_get_msg_ctx_map | ( | const axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the message context map.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  pointer to hash table containing message contexts

AXIS2_EXTERN struct axis2_op* axis2_op_ctx_get_op | ( | const axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  | `[read]`

Gets operation the operation context is related to.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  pointer to operation

AXIS2_EXTERN struct axis2_svc_ctx* axis2_op_ctx_get_parent | ( | const axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  | `[read]`

Gets parent which is of service context type.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  pointer to service context within which this operation context lives

AXIS2_EXTERN axis2_bool_t axis2_op_ctx_get_response_written | ( | const axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  |

Checks the response status, whether it is written or not.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  AXIS2_TRUE if response is already written, else AXIS2_FALSE

AXIS2_EXTERN axis2_status_t axis2_op_ctx_increment_ref | ( | axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  |

Incrementing the op_ctx ref count. This is necessary when prevent freeing op_ctx through op_client when it is in use as in sandesha where the msg_cts is stored.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  AXIS2_TRUE if still in use, else AXIS2_FALSE

AXIS2_EXTERN axis2_status_t axis2_op_ctx_init | ( | struct axis2_op_ctx * | op_ctx,
|  | const axutil_env_t * | env,
|  | struct axis2_conf * | conf |
| ) |  |  |

Initializes operation context. This method traverses through all the message contexts stored within it and initialize them all.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct
  | conf | pointer to conf configuration

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_bool_t axis2_op_ctx_is_in_use | ( | const axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env |
| ) |  |  |

Checks whether op_ctx is in use. This is necessary when destroying the thread mutex at the http_worker to check whether the operation context is still in use

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct

Returns:
  AXIS2_TRUE if still in use, else AXIS2_FALSE

AXIS2_EXTERN axis2_status_t axis2_op_ctx_set_complete | ( | struct axis2_op_ctx * | op_ctx,
|  | const axutil_env_t * | env,
|  | axis2_bool_t | is_complete |
| ) |  |  |

Sets the bool value indicating if the MEP is complete. MEP is considered complete when all the messages that are associated with the MEP has arrived.

Parameters:

  | op_ctx | pointer to operating context
  | env | pointer to environment struct
  | is_complete | AXIS2_TRUE if MEP invocation is complete, else AXIS2_FALSE

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t axis2_op_ctx_set_in_use | ( | struct axis2_op_ctx * | op_ctx,
|  | const axutil_env_t * | env,
|  | axis2_bool_t | is_in_use |
| ) |  |  |

Set operation context's is_in_use attribute. This is necessary when destroying the thread mutex at the http_worker to check whether the operation context is still in use

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct
  | is_in_use | AXIS2_TRUE if still in use, else AXIS2_FALSE

Returns:
  AXIS2_TRUE if still in use, else AXIS2_FALSE

AXIS2_EXTERN axis2_status_t axis2_op_ctx_set_parent | ( | struct axis2_op_ctx * | op_ctx,
|  | const axutil_env_t * | env,
|  | struct axis2_svc_ctx * | svc_ctx |
| ) |  |  |

Sets parent service context.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct
  | svc_ctx | pointer to service context, message context does not assume the ownership of the struct

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t axis2_op_ctx_set_response_written | ( | axis2_op_ctx_t * | op_ctx,
|  | const axutil_env_t * | env,
|  | const axis2_bool_t | response_written |
| ) |  |  |

Sets the bool value indicating the status of response.

Parameters:

  | op_ctx | pointer to operation context
  | env | pointer to environment struct
  | response_written | AXIS2_TRUE if response is written, else AXIS2_FALSE

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE