use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method removePackage.
/**
* Remove agent package from server
*
* @param packageId The package ID
* @throws IOException if socket or file I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public void removePackage(long packageId) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_REMOVE_PACKAGE);
msg.setFieldInt32(NXCPCodes.VID_PACKAGE_ID, (int) packageId);
sendMessage(msg);
waitForRCC(msg.getMessageId());
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method unbindAgentTunnel.
/**
* Unbind agent tunnel to node
*
* @param nodeId node ID
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public void unbindAgentTunnel(long nodeId) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_UNBIND_AGENT_TUNNEL);
msg.setFieldInt32(NXCPCodes.VID_NODE_ID, (int) nodeId);
sendMessage(msg);
waitForRCC(msg.getMessageId());
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method processConsoleCommand.
/**
* Process console command on server. Output of the command delivered via
* console listener.
*
* @param command command to process
* @return true if console should be closed (usually after "exit" command)
* @throws IOException if socket or file I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public boolean processConsoleCommand(String command) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_ADM_REQUEST);
msg.setField(NXCPCodes.VID_COMMAND, command);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId(), 3600000);
return response.isEndOfSequence();
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method getNodePhysicalComponents.
/**
* Get node's physical components (obtained from ENTITY-MIB).
*
* @param nodeId node object identifier
* @return root component
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public PhysicalComponent getNodePhysicalComponents(long nodeId) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_NODE_COMPONENTS);
msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
return new PhysicalComponent(response, NXCPCodes.VID_COMPONENT_LIST_BASE, null);
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method syncUserDatabase.
/**
* Synchronize user database and subscribe to user change notifications
*
* @throws IOException
* if socket I/O error occurs
* @throws NXCException
* if NetXMS server returns an error or operation was timed out
*/
public void syncUserDatabase() throws IOException, NXCException {
syncUserDB.acquireUninterruptibly();
NXCPMessage msg = newMessage(NXCPCodes.CMD_LOAD_USER_DB);
sendMessage(msg);
waitForRCC(msg.getMessageId());
waitForSync(syncUserDB, commandTimeout * 10);
subscribe(CHANNEL_USERDB);
}
Aggregations