tibasAdmin_Connect()

Connects to the a specified admin manager and executes a specified admin command.

Declaration

tibas_status tibasAdmin_Connect()
    tibasAdmin      admin,
    tibasMetaspace* metaspace,
    const char*     cmd)

Parameters

Parameter Description
admin Specifies the admin manager to connect to.
metaspace Specifies the metaspace to administer.
cmd Specifies the admin command to execute.

Remarks

Use the tibasAdmin_Connect() command to connect to a specified Admin manager for a specified metaspace and execute a specified command.

The command that you execute can be any command that is supported by the TIBCO ActiveSpaces Admin utility.

For a complete list of the Admin commands, see the TIBCO ActiveSpaces Administration guide.

See Also

tibasAdmin_Execute()

tibasAdmin_Execute()

Executes an TIBCO ActiveSpaces administration language command.

For commands such as define space <space-name>, the execute command may return a pointer to a string depending on the command being executed. The Metaspace on which the command should be executed must be passed in.

Declaration

tibas_status tibasAdmin_Execute
(tibasAdmin     admin,
char**          result,
tibasMetaspace  metaspace,
const char*     cmd)   

Parameters

Parameter Description
admin The TIBCO ActiveSpaces entity on which the function is invoked.
result A pointer to a NULL-terminated character buffer than contains the result of executing the command.
metaspace The metaspace on which the command is executed.
cmd The execute command.

Remarks

Use the tibasAdmin_Execute() function to execute an Admin command on a specified metaspace, using a specified Admin manager.

The result parameter contains a pointer to a NULL-terminated character buffer that contains the results of the command.

Before processing the result buffer:

Call strlen() to determine the size of the buffer. Based on the value returned by strlen(), you can allocate memory to store the result for processing.

Define a NULL pointer to point to the character buffer that will hold the result.

If you use a non-NULL pointer to point to the result parameter, ActiveSpaces returns an error. After you are done processing the result, free the memory used by the result by calling the tibas_FreeData() function.

The value for the admin parameter is returned when you call tibasAdmin_Create() to create an Admin manager.

Example

The following example illustrates the recommended way to use tibasAdminExecute():

char adminCommand[1024];
    char* userMessagePtr = NULL;
    sprintf(adminCommand, "help");
    if (tibasAdmin_Execute(admin, &userMessagePtr, *metaspace, adminCommand) != TIBAS_OK)
   { do some error handling… }
    /* when finished with the contents of userMessagePtr, free it */
    tibas_FreeData(&userMessagePtr);
    /* if you want to re-use userMessagePtr for another admin command, set it to NULL again */
    userMessagePtr = NULL;