Search in sources :

Example 21 with NXCPMessage

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;
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) ArrayList(java.util.ArrayList) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint)

Example 22 with NXCPMessage

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());
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 23 with NXCPMessage

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;
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) ArrayList(java.util.ArrayList) UUID(java.util.UUID) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint)

Example 24 with NXCPMessage

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;
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint) PerfTabDci(org.netxms.client.datacollection.PerfTabDci)

Example 25 with NXCPMessage

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;
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) ArrayList(java.util.ArrayList) AuthCertificate(org.netxms.client.users.AuthCertificate) ConnectionPoint(org.netxms.client.topology.ConnectionPoint) AccessPoint(org.netxms.client.objects.AccessPoint)

Aggregations

NXCPMessage (org.netxms.base.NXCPMessage)274 ConnectionPoint (org.netxms.client.topology.ConnectionPoint)69 AccessPoint (org.netxms.client.objects.AccessPoint)66 ArrayList (java.util.ArrayList)44 IOException (java.io.IOException)8 HashMap (java.util.HashMap)7 DciSummaryTable (org.netxms.client.datacollection.DciSummaryTable)7 MappingTable (org.netxms.client.mt.MappingTable)7 NXCPException (org.netxms.base.NXCPException)5 UnknownHostException (java.net.UnknownHostException)3 GeneralSecurityException (java.security.GeneralSecurityException)3 CertificateEncodingException (java.security.cert.CertificateEncodingException)3 UUID (java.util.UUID)3 AtomicLong (java.util.concurrent.atomic.AtomicLong)3 MessageProcessingResult (com.radensolutions.reporting.service.MessageProcessingResult)2 FileInputStream (java.io.FileInputStream)2 Socket (java.net.Socket)2 SignatureException (java.security.SignatureException)2 Date (java.util.Date)2 List (java.util.List)2