/** * <summary> * Retrieves the permission profile for the specified queue. Resultant permissions * are placed in the <c>List<QueuePermissions> perms</c> as <c>QueuePermissions</c> * objects. * </summary> * * <param name="queuename"> The name of the queue.</param> * <param name="perms"> The vector which will be emptied and populated with <c>MQConnection.QueuePermissions</c> objects.</param> * * <returns><c>ErrorCode.EC_NOERROR</c> upon success, otherwise errors returned * could be but are not limited to:<br/> * <table border="0" cellpadding="3" cellspacing="0"> * <tr><td><c>ErrorCode.EC_NETWORKERROR</c></td> * <td>A networking error has occurred and the conneciton * is nolonger valid. * </td></tr> * </table> * </returns> * * <seealso cref="QueuePermissions"/> */ public ErrorCode QueueEnumeratePermissions(string queuename, List<QueuePermissions> perms) { ErrorCode ret = ErrorCode.EC_NETWORKERROR; QUEUE_OPEN_QUEUE_DELETE_QUEUE_CREATE_QUEUE_ENUM_PERMS_PARAMS parms = new QUEUE_OPEN_QUEUE_DELETE_QUEUE_CREATE_QUEUE_ENUM_PERMS_PARAMS(); parms.queuename = queuename; perms.Clear(); try { output.Write(Safmq.CMD_QUEUE_ENUM_PERMS); parms.Write(output); output.Flush(); ret = getResponseCode(); if (ret == ErrorCode.EC_NOERROR) { int nPerms = input.ReadInt32(); int x; QUEUE_PERM_DATA data = new QUEUE_PERM_DATA(); perms.Clear(); for(x=0;x<nPerms; x++) { data.Read(input); perms.Add( new QueuePermissions( data.entityname, data.isgroup!=0, data.read!=0, data.write!=0, data.destroy!=0, data.change_security!=0)); } } } catch (Exception) { ret = ErrorCode.EC_NETWORKERROR; } return ret; }
/** * <summary> * Attempts to remove a queue fromt he SAFMQ server. Queues may only be removed * if the user has the rights to do so and the queue is not currently in use. * </summary> * * <param name="queuename"> The name of the queue to be removed.</param> * * <returns><c>ErrorCode.EC_NOERROR</c> upon success, otherwise errors returned * could be but are not limited to:<br/> * <table border="0" cellpadding="3" cellspacing="0"> * <tr><td><c>ErrorCode.EC_NETWORKERROR</c></td> * <td>A networking error has occurred and the conneciton * is nolonger valid. * </td></tr> * <tr><td><c>ErrorCode.EC_QUEUEOPEN</c></td> * <td>The queue is currently in use by some connection. * </td></tr> * <tr><td><c>ErrorCode.EC_NOTAUTHORIZED</c></td> * <td>The current logged in user is not authorized to delete this queue. * </td></tr> * </table> * </returns> */ public ErrorCode DeleteQueue(string queuename) { ErrorCode ret = ErrorCode.EC_NETWORKERROR; QUEUE_OPEN_QUEUE_DELETE_QUEUE_CREATE_QUEUE_ENUM_PERMS_PARAMS parms = new QUEUE_OPEN_QUEUE_DELETE_QUEUE_CREATE_QUEUE_ENUM_PERMS_PARAMS(); parms.queuename = queuename; try { output.Write(Safmq.CMD_QUEUE_DELETE); parms.Write(output); output.Flush(); ret = getResponseCode(); } catch (Exception) { ret = ErrorCode.EC_NETWORKERROR; } return ret; }
/** * <summary> * Opens a queue for reading and writing. The queue is then after * referenced by the parameter <c>handle</c> for calls such as * <c>Enqueue(QueueHandle,QueueMessage)</c> and * <c>Retrieve(QueueHandle,bool,int,QueueMessage)</c>. * </summary> * * <remarks> * <para><b>Note</b>: Queues which have been opened by a call to <c>OpenQueue()</c> * must be closed by a cll to <c>CloseQueue(QueueHandle)</c> if the queue * is not closed, resources allocated by a call to <c>OpenQueue()</c> * will not be released.</para> * </remarks> * * <param name="queuename">The name of the queue</param> * <param name="handle">Receives a reference to the queue</param> * * <returns><c>ErrorCode.EC_NOERROR</c> on success otherwise errors such as these, but * not limited to could be produced: * * <table border="0" cellpadding="3" cellspacing="0"> * <tr><td><c>ErrorCode.EC_NETWORKERROR</c></td> * <td>A networking error has occurred and the conneciton * is nolonger valid. * </td></tr> * <tr><td><c>ErrorCode.EC_DOESNOTEXIST</c></td> * <td>The queue does not exist on the server specified. * </td></tr> * </table> * </returns> * * <see cref="CloseQueue(QueueHandle)">CloseQueue(QueueHandle handle)</see> */ public ErrorCode OpenQueue(string queuename, QueueHandle handle) { ErrorCode ret; QUEUE_OPEN_QUEUE_DELETE_QUEUE_CREATE_QUEUE_ENUM_PERMS_PARAMS qOpenParam = new QUEUE_OPEN_QUEUE_DELETE_QUEUE_CREATE_QUEUE_ENUM_PERMS_PARAMS(); qOpenParam.queuename = queuename; try { output.Write(Safmq.CMD_QUEUE_OPEN); qOpenParam.Write(output); output.Flush(); ret = getResponseCode(); if (ret == ErrorCode.EC_NOERROR) { handle.handle = input.ReadInt32(); } } catch (Exception) { ret = ErrorCode.EC_NETWORKERROR; } return ret; }