use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method getScriptLibrary.
/**
* Get list of all scripts in script library.
*
* @return ID/name pairs for scripts in script library
* @throws IOException if socket or file I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public List<Script> getScriptLibrary() throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_SCRIPT_LIST);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_SCRIPTS);
List<Script> scripts = new ArrayList<Script>(count);
long varId = NXCPCodes.VID_SCRIPT_LIST_BASE;
for (int i = 0; i < count; i++, varId += 2) {
scripts.add(new Script(response, varId));
}
return scripts;
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method deleteAlarmComment.
/**
* Delete alarm comment.
*
* @param alarmId alarm ID
* @param commentId comment ID
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public void deleteAlarmComment(long alarmId, long commentId) throws IOException, NXCException {
NXCPMessage msg = newMessage(NXCPCodes.CMD_DELETE_ALARM_COMMENT);
msg.setFieldInt32(NXCPCodes.VID_ALARM_ID, (int) alarmId);
msg.setFieldInt32(NXCPCodes.VID_COMMENT_ID, (int) commentId);
sendMessage(msg);
waitForRCC(msg.getMessageId());
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method listReports.
/**
* List reports
*
* @return List of report UUIDs
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public List<UUID> listReports() throws NXCException, IOException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_RS_LIST_REPORTS);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_ITEMS);
List<UUID> ret = new ArrayList<UUID>(count);
long base = NXCPCodes.VID_UUID_LIST_BASE;
for (int i = 0; i < count; i++) {
ret.add(response.getFieldAsUUID(base + i));
}
return ret;
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method getPerfTabItems.
/**
* Get list of DCIs configured to be shown on performance tab in console for
* given node.
*
* @param nodeId Node object ID
* @return List of performance tab DCIs
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public PerfTabDci[] getPerfTabItems(final long nodeId) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_PERFTAB_DCI_LIST);
msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_ITEMS);
PerfTabDci[] list = new PerfTabDci[count];
long base = NXCPCodes.VID_SYSDCI_LIST_BASE;
for (int i = 0; i < count; i++, base += 10) {
list[i] = new PerfTabDci(response, base);
}
return list;
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method getCertificateList.
/**
* Get list of certificates
*
* @return List of certificates
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public List<AuthCertificate> getCertificateList() throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_CERT_LIST);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_CERTIFICATES);
final List<AuthCertificate> list = new ArrayList<AuthCertificate>(count);
long varId = NXCPCodes.VID_CERT_LIST_BASE;
for (int i = 0; i < count; i++) {
list.add(new AuthCertificate(response, varId));
varId += 10;
}
return list;
}
Aggregations