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);
}
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);
}
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);
}
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;
}
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);
}
Aggregations