Search in sources :

Example 71 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method getMibFileTimestamp.

/**
 * Get timestamp of server's MIB file.
 *
 * @return Timestamp of server's MIB file
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public Date getMibFileTimestamp() throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_MIB_TIMESTAMP);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    return response.getFieldAsDate(NXCPCodes.VID_TIMESTAMP);
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 72 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method createUserDBObject.

/**
 * Create user or group on server
 *
 * @param name Login name for new user
 * @return ID assigned to newly created user
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
private long createUserDBObject(final String name, final boolean isGroup) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_CREATE_USER);
    msg.setField(NXCPCodes.VID_USER_NAME, name);
    msg.setField(NXCPCodes.VID_IS_GROUP, isGroup);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    return response.getFieldAsInt64(NXCPCodes.VID_USER_ID);
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 73 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method deletePersistentStorageValue.

/**
 * Delete persistent storage value
 *
 * @param key unique key of persistent storage value
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public void deletePersistentStorageValue(String key) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_DELETE_PSTORAGE_VALUE);
    msg.setField(NXCPCodes.VID_PSTORAGE_KEY, key);
    sendMessage(msg);
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

Example 74 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method getActions.

/**
 * Get list of configured actions from server
 *
 * @return List of configured actions
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public List<ServerAction> getActions() throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_LOAD_ACTIONS);
    sendMessage(msg);
    waitForRCC(msg.getMessageId());
    List<ServerAction> actions = new ArrayList<ServerAction>();
    while (true) {
        final NXCPMessage response = waitForMessage(NXCPCodes.CMD_ACTION_DATA, msg.getMessageId());
        // End of list
        if (response.getFieldAsInt64(NXCPCodes.VID_ACTION_ID) == 0)
            break;
        actions.add(new ServerAction(response));
    }
    return actions;
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage) ArrayList(java.util.ArrayList)

Example 75 with NXCPMessage

use of org.netxms.base.NXCPMessage in project netxms by netxms.

the class NXCSession method getServerConfigClob.

/**
 * Get server config CLOB
 *
 * @param name The name of the config
 * @return The config CLOB
 * @throws IOException  if socket I/O error occurs
 * @throws NXCException if NetXMS server returns an error or operation was timed out
 */
public String getServerConfigClob(final String name) throws IOException, NXCException {
    final NXCPMessage msg = newMessage(NXCPCodes.CMD_CONFIG_GET_CLOB);
    msg.setField(NXCPCodes.VID_NAME, name);
    sendMessage(msg);
    final NXCPMessage response = waitForRCC(msg.getMessageId());
    return response.getFieldAsString(NXCPCodes.VID_VALUE);
}
Also used : NXCPMessage(org.netxms.base.NXCPMessage)

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