use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method getAgentConfig.
/**
* Get agent's master configuration file.
*
* @param nodeId Node ID
* @return Master configuration file of agent running on given node
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public String getAgentConfig(long nodeId) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_AGENT_CONFIG);
msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
return response.getFieldAsString(NXCPCodes.VID_CONFIG_FILE);
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method getEffectiveRights.
/**
* Get effective rights of currently logged in user to given object.
*
* @param objectId The object ID
* @return The effective rights
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public int getEffectiveRights(final long objectId) throws IOException, NXCException {
NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_EFFECTIVE_RIGHTS);
msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) objectId);
sendMessage(msg);
return waitForRCC(msg.getMessageId()).getFieldAsInt32(NXCPCodes.VID_EFFECTIVE_RIGHTS);
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method copyAgentFile.
/**
* Copy file from agent
*
* @param nodeId node id
* @param oldName old file path
* @param newFileName new file path
* @param overwrite should the file in destination be overwritten
* @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 copyAgentFile(long nodeId, String oldName, String newFileName, boolean overwrite) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_FILEMGR_COPY_FILE);
msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
msg.setField(NXCPCodes.VID_FILE_NAME, oldName);
msg.setField(NXCPCodes.VID_NEW_FILE_NAME, newFileName);
msg.setField(NXCPCodes.VID_OVERWRITE, overwrite);
sendMessage(msg);
waitForRCC(msg.getMessageId());
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method updateMappingTable.
/**
* Create or update mapping table. If table ID is 0, new table will be created on server.
*
* @param table mapping table
* @return ID of new table object
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public int updateMappingTable(MappingTable table) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_UPDATE_MAPPING_TABLE);
table.fillMessage(msg);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
return response.getFieldAsInt32(NXCPCodes.VID_MAPPING_TABLE_ID);
}
use of org.netxms.base.NXCPMessage in project netxms by netxms.
the class NXCSession method modifyImage.
/**
* Modify an image
*
* @param image The image to modify
* @param listener The ProgressListener
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public void modifyImage(LibraryImage image, ProgressListener listener) throws IOException, NXCException {
if (image.isProtected()) {
throw new NXCException(RCC.INVALID_REQUEST);
}
final NXCPMessage msg = newMessage(NXCPCodes.CMD_CREATE_IMAGE);
image.fillMessage(msg);
sendMessage(msg);
waitForRCC(msg.getMessageId());
sendFile(msg.getMessageId(), image.getBinaryData(), listener, allowCompression);
waitForRCC(msg.getMessageId());
}
Aggregations