org.netxms.client
Class NXCSession

java.lang.Object
  extended by org.netxms.client.NXCSession

public class NXCSession
extends java.lang.Object

Author:
victor

Field Summary
static int AUTH_TYPE_CERTIFICATE
           
static int AUTH_TYPE_PASSWORD
           
static int CHANNEL_ALARMS
           
static int CHANNEL_AUDIT_LOG
           
static int CHANNEL_EVENTS
           
static int CHANNEL_OBJECTS
           
static int CHANNEL_SITUATIONS
           
static int CHANNEL_SNMP_TRAPS
           
static int CHANNEL_SYSLOG
           
static int CLIENT_PROTOCOL_VERSION
           
static int DEFAULT_CONN_PORT
           
static int USER_MODIFY_ACCESS_RIGHTS
           
static int USER_MODIFY_AUTH_METHOD
           
static int USER_MODIFY_CERT_MAPPING
           
static int USER_MODIFY_DESCRIPTION
           
static int USER_MODIFY_FLAGS
           
static int USER_MODIFY_FULL_NAME
           
static int USER_MODIFY_LOGIN_NAME
           
static int USER_MODIFY_MEMBERS
           
 
Constructor Summary
NXCSession(java.lang.String connAddress, int connPort, java.lang.String connLoginName, java.lang.String connPassword)
           
NXCSession(java.lang.String connAddress, int connPort, java.lang.String connLoginName, java.lang.String connPassword, boolean connUseEncryption)
           
NXCSession(java.lang.String connAddress, java.lang.String connLoginName, java.lang.String connPassword)
           
 
Method Summary
 void acknowledgeAlarm(long alarmId)
          Acknowledge alarm.
 void addListener(NXCListener lst)
          Add notification listener
 void bindObject(long parentId, long childId)
          Bind object.
 void cancelServerJob(long jobId)
          Cancel server job
 void changeNodeIpAddress(long nodeId, java.net.InetAddress addr)
          Change primary IP address of a node.
 void closeAlarm(long alarmId)
          Set alarm's helpdesk state to "Closed".
 void closeEventProcessingPolicy()
          Close event processing policy.
 void connect()
          Connect to server using previously set credentials.
 long createObject(NXCObjectCreationData data)
          Create object
 long createUser(java.lang.String name)
          Create user on server
 long createUserGroup(java.lang.String name)
          Create user group on server
 void deleteAlarm(long alarmId)
          Delete alarm.
 void deleteEventTemplate(long eventCode)
          Delete event template.
 void deleteObject(long objectId)
          Delete object
 void deleteServerVariable(java.lang.String name)
          Delete server configuration variable.
 void deleteUserDBObject(long id)
          Delete user or group on server
 void deployAgentPolicy(long policyId, long nodeId)
          Deploy policy on agent
 void disconnect()
          Disconnect from server.
 void executeAction(long nodeId, java.lang.String action)
          Execute action on remote agent
protected  void executeSimpleCommand(int command)
          Execute simple commands (without arguments and only returning RCC)
protected  void finalize()
           
 NXCObject[] findMultipleObjects(long[] idList)
          Find multiple NetXMS objects by identifiers
 NXCObject findObjectById(long id)
          Find NetXMS object by it's identifier.
 NXCUserDBObject findUserDBObjectById(long id)
          Find user by ID
 long generateEventCode()
          Generate code for new event template.
 java.util.HashMap<java.lang.Long,NXCAlarm> getAlarms(boolean getTerminated)
          Get alarm list.
 NXCObject[] getAllObjects()
          Get list of all objects
 java.lang.String getAttributeForCurrentUser(java.lang.String name)
          Get custom attribute for currently logged in user.
 DciData getCollectedData(long nodeId, long dciId, java.util.Date from, java.util.Date to, int maxRows)
          Get collected DCI data from server.
 java.lang.String getConnClientInfo()
           
 java.util.List<EventTemplate> getEventTemplates()
          Get event templates from server
 DciValue[] getLastValues(long nodeId)
          Get last DCI values for given node
 int getRecvBufferSize()
          Get receiver buffer size.
 byte[] getServerChallenge()
           
 byte[] getServerId()
          Get NetXMS server UID.
 NXCServerJob[] getServerJobList()
          Get list of server jobs
 java.lang.String getServerTimeZone()
           
 java.util.HashMap<java.lang.String,NXCServerVariable> getServerVariables()
          Get server configuration variables.
 java.lang.String getServerVersion()
          Get NetXMS server version.
 java.util.List<java.lang.String> getSnmpCommunities()
          Get list of well-known SNMP communities configured on server.
 java.util.List<SnmpUsmCredential> getSnmpUsmCredentials()
          Get list of well-known SNMP USM (user security model) credentials configured on server.
 NXCObject[] getTopLevelObjects()
          Get list of top-level objects.
 NXCUserDBObject[] getUserDatabaseObjects()
          Get list of all user database objects
 int getUserId()
          Get identifier of logged in user.
 int getUserSystemRights()
          Get system-wide rights of currently logged in user.
 boolean isPasswordExpired()
           
 void lockEventConfiguration()
          Lock event configuration.
 void lockUserDatabase()
          Lock user database
 void modifyEventTemplate(EventTemplate evt)
          Modify event template.
 void modifyObject(NXCObjectModificationData data)
          Modify object (generic interface, in most cases wrapper functions should be used instead)
 void modifyUserDBObject(NXCUserDBObject object)
          Modify user database object
 void modifyUserDBObject(NXCUserDBObject object, int fields)
          Modify user database object
 NXCPMessage newMessage(int code)
          Create new NXCP message with unique id
 void openAlarm(long alarmId, java.lang.String reference)
          Set alarm's helpdesk state to "Open".
 DataCollectionConfiguration openDataCollectionConfiguration(long nodeId)
          Open data collection configuration for given node.
 EventProcessingPolicy openEventProcessingPolicy()
          Open event processing policy for editing.
 Log openServerLog(java.lang.String logName)
          Open server log by name.
 NetworkMapPage queryLayer2Topology(long nodeId)
          Query layer 2 topology for node
 Table receiveTable(long requestId, int msgCode)
          Receive table from server.
 void removeListener(NXCListener lst)
          Remove notification listener
 void removeTemplate(long templateId, long nodeId, boolean removeDci)
          Remove data collection template from node.
 void sendMessage(NXCPMessage msg)
          Send message to server
protected  void sendNotification(NXCNotification n)
          Call notification handlers on all registered listeners
 void setAttributeForCurrentUser(java.lang.String name, java.lang.String value)
          Set custom attribute for currently logged in user.
 void setCommandTimeout(int commandTimeout)
          Set command execution timeout.
 void setConnClientInfo(java.lang.String connClientInfo)
           
 void setObjectACL(long objectId, NXCAccessListElement[] acl, boolean inheritAccessRights)
          Change object's ACL (wrapper for modifyObject())
 void setObjectCustomAttributes(long objectId, java.util.Map<java.lang.String,java.lang.String> attrList)
          Change object's custom attributes (wrapper for modifyObject())
 void setObjectManaged(long objectId, boolean isManaged)
          Set object's managed status.
 void setObjectName(long objectId, java.lang.String name)
          Change object's name (wrapper for modifyObject())
 void setRecvBufferSize(int recvBufferSize)
          Set receiver buffer size.
 void setServerVariable(java.lang.String name, java.lang.String value)
          Set server configuration variable.
 void setUserPassword(long id, java.lang.String password)
          Set password for user
 void subscribe(int channels)
          Subscribe to notification channel(s)
 void syncObjects()
          Synchronizes NetXMS objects between server and client.
 void syncUserDatabase()
          Synchronize user database
 void terminateAlarm(long alarmId)
          Terminate alarm.
 void unbindObject(long parentId, long childId)
          Unbind object.
 void uninstallAgentPolicy(long policyId, long nodeId)
          Uninstall policy from agent
 void unlockEventConfiguration()
          Unlock event configuration.
 void unlockUserDatabase()
          Unlock user database
 void unsubscribe(int channels)
          Unsubscribe from notification channel(s)
 void updateObjectComments(long objectId, java.lang.String comments)
          Change object's comments.
 void updateSnmpCommunities(java.util.List<java.lang.String> list)
          Update list of well-known SNMP community strings on server.
 void updateSnmpUsmCredentials(java.util.List<SnmpUsmCredential> list)
          Update list of well-known SNMP USM credentials on server.
 java.io.File waitForFile(long id, int timeout)
          Wait for specific file to arrive
 NXCPMessage waitForMessage(int code, long id)
          Wait for message with specific code and id.
 NXCPMessage waitForMessage(int code, long id, int timeout)
          Wait for message with specific code and id.
 NXCPMessage waitForRCC(long id)
          Wait for CMD_REQUEST_COMPLETED message with given id
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONN_PORT

public static final int DEFAULT_CONN_PORT
See Also:
Constant Field Values

CLIENT_PROTOCOL_VERSION

public static final int CLIENT_PROTOCOL_VERSION
See Also:
Constant Field Values

AUTH_TYPE_PASSWORD

public static final int AUTH_TYPE_PASSWORD
See Also:
Constant Field Values

AUTH_TYPE_CERTIFICATE

public static final int AUTH_TYPE_CERTIFICATE
See Also:
Constant Field Values

CHANNEL_EVENTS

public static final int CHANNEL_EVENTS
See Also:
Constant Field Values

CHANNEL_SYSLOG

public static final int CHANNEL_SYSLOG
See Also:
Constant Field Values

CHANNEL_ALARMS

public static final int CHANNEL_ALARMS
See Also:
Constant Field Values

CHANNEL_OBJECTS

public static final int CHANNEL_OBJECTS
See Also:
Constant Field Values

CHANNEL_SNMP_TRAPS

public static final int CHANNEL_SNMP_TRAPS
See Also:
Constant Field Values

CHANNEL_AUDIT_LOG

public static final int CHANNEL_AUDIT_LOG
See Also:
Constant Field Values

CHANNEL_SITUATIONS

public static final int CHANNEL_SITUATIONS
See Also:
Constant Field Values

USER_MODIFY_LOGIN_NAME

public static final int USER_MODIFY_LOGIN_NAME
See Also:
Constant Field Values

USER_MODIFY_DESCRIPTION

public static final int USER_MODIFY_DESCRIPTION
See Also:
Constant Field Values

USER_MODIFY_FULL_NAME

public static final int USER_MODIFY_FULL_NAME
See Also:
Constant Field Values

USER_MODIFY_FLAGS

public static final int USER_MODIFY_FLAGS
See Also:
Constant Field Values

USER_MODIFY_ACCESS_RIGHTS

public static final int USER_MODIFY_ACCESS_RIGHTS
See Also:
Constant Field Values

USER_MODIFY_MEMBERS

public static final int USER_MODIFY_MEMBERS
See Also:
Constant Field Values

USER_MODIFY_CERT_MAPPING

public static final int USER_MODIFY_CERT_MAPPING
See Also:
Constant Field Values

USER_MODIFY_AUTH_METHOD

public static final int USER_MODIFY_AUTH_METHOD
See Also:
Constant Field Values
Constructor Detail

NXCSession

public NXCSession(java.lang.String connAddress,
                  java.lang.String connLoginName,
                  java.lang.String connPassword)
Parameters:
connAddress -
connLoginName -
connPassword -

NXCSession

public NXCSession(java.lang.String connAddress,
                  int connPort,
                  java.lang.String connLoginName,
                  java.lang.String connPassword)
Parameters:
connAddress -
connPort -
connLoginName -
connPassword -

NXCSession

public NXCSession(java.lang.String connAddress,
                  int connPort,
                  java.lang.String connLoginName,
                  java.lang.String connPassword,
                  boolean connUseEncryption)
Parameters:
connAddress -
connPort -
connLoginName -
connPassword -
connUseEncryption -
Method Detail

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

addListener

public void addListener(NXCListener lst)
Add notification listener

Parameters:
lst - Listener to add

removeListener

public void removeListener(NXCListener lst)
Remove notification listener

Parameters:
lst - Listener to remove

sendNotification

protected void sendNotification(NXCNotification n)
Call notification handlers on all registered listeners

Parameters:
n - Notification object

sendMessage

public void sendMessage(NXCPMessage msg)
                 throws java.io.IOException
Send message to server

Parameters:
msg - Message to sent
Throws:
java.io.IOException - if case of socket communication failure

waitForMessage

public NXCPMessage waitForMessage(int code,
                                  long id,
                                  int timeout)
                           throws NXCException
Wait for message with specific code and id.

Parameters:
code - Message code
id - Message id
timeout - Wait timeout in milliseconds
Returns:
Message object
Throws:
NXCException - if message was not arrived within timeout interval

waitForMessage

public NXCPMessage waitForMessage(int code,
                                  long id)
                           throws NXCException
Wait for message with specific code and id.

Parameters:
code - Message code
id - Message id
Returns:
Message object
Throws:
NXCException - if message was not arrived within timeout interval

waitForRCC

public NXCPMessage waitForRCC(long id)
                       throws NXCException
Wait for CMD_REQUEST_COMPLETED message with given id

Parameters:
id - Message id
Returns:
received message
Throws:
NXCException - if message was not arrived within timeout interval or contains RCC other than RCC.SUCCESS

newMessage

public final NXCPMessage newMessage(int code)
Create new NXCP message with unique id

Parameters:
code - Message code
Returns:
New message object

waitForFile

public java.io.File waitForFile(long id,
                                int timeout)
Wait for specific file to arrive

Parameters:
id - Message ID
timeout - Wait timeout in milliseconds
Returns:
Received file or null in case of failure

executeSimpleCommand

protected void executeSimpleCommand(int command)
                             throws java.io.IOException,
                                    NXCException
Execute simple commands (without arguments and only returning RCC)

Parameters:
command - Command code
Throws:
java.io.IOException
NXCException

receiveTable

public Table receiveTable(long requestId,
                          int msgCode)
                   throws NXCException
Receive table from server.

Parameters:
requestId - request ID
msgCode - Message code
Returns:
Received table
Throws:
NXCException - if operation was timed out

connect

public void connect()
             throws java.io.IOException,
                    java.net.UnknownHostException,
                    NXCException
Connect to server using previously set credentials.

Throws:
java.io.IOException - to indicate socket I/O error
java.net.UnknownHostException - if given host name cannot be resolved
NXCException - if NetXMS server returns an error, protocol negotiation with the server was failed, or operation was timed out

disconnect

public void disconnect()
Disconnect from server.


getRecvBufferSize

public int getRecvBufferSize()
Get receiver buffer size.

Returns:
Current receiver buffer size in bytes.

setRecvBufferSize

public void setRecvBufferSize(int recvBufferSize)
Set receiver buffer size. This method should be called before connect(). It will not have any effect after connect().

Parameters:
recvBufferSize - Size of receiver buffer in bytes.

getServerVersion

public java.lang.String getServerVersion()
Get NetXMS server version.

Returns:
Server version

getServerId

public byte[] getServerId()
Get NetXMS server UID.

Returns:
Server UID

getServerTimeZone

public java.lang.String getServerTimeZone()
Returns:
the serverTimeZone

getServerChallenge

public byte[] getServerChallenge()
Returns:
the serverChallenge

getConnClientInfo

public java.lang.String getConnClientInfo()
Returns:
the connClientInfo

setConnClientInfo

public void setConnClientInfo(java.lang.String connClientInfo)
Parameters:
connClientInfo - the connClientInfo to set

setCommandTimeout

public void setCommandTimeout(int commandTimeout)
Set command execution timeout.

Parameters:
commandTimeout - New command timeout

getUserId

public int getUserId()
Get identifier of logged in user.

Returns:
Identifier of logged in user

getUserSystemRights

public int getUserSystemRights()
Get system-wide rights of currently logged in user.

Returns:
System-wide rights of currently logged in user

isPasswordExpired

public boolean isPasswordExpired()
Returns:
the passwordExpired

syncObjects

public void syncObjects()
                 throws java.io.IOException,
                        NXCException
Synchronizes NetXMS objects between server and client. After successful sync, subscribe client to object change notifications.

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

findObjectById

public NXCObject findObjectById(long id)
Find NetXMS object by it's identifier.

Parameters:
id - Object identifier
Returns:
Object with given ID or null if object cannot be found

findMultipleObjects

public NXCObject[] findMultipleObjects(long[] idList)
Find multiple NetXMS objects by identifiers

Parameters:
idList - array of object identifiers
Returns:
array of found objects

getTopLevelObjects

public NXCObject[] getTopLevelObjects()
Get list of top-level objects.

Returns:
List of all top level objects (either without parents or with inaccessible parents)

getAllObjects

public NXCObject[] getAllObjects()
Get list of all objects

Returns:
List of all objects

getAlarms

public java.util.HashMap<java.lang.Long,NXCAlarm> getAlarms(boolean getTerminated)
                                                     throws java.io.IOException,
                                                            NXCException
Get alarm list.

Parameters:
getTerminated - if set to true, all alarms will be retrieved from database, otherwise only active alarms
Returns:
Hash map containing alarms
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

acknowledgeAlarm

public void acknowledgeAlarm(long alarmId)
                      throws java.io.IOException,
                             NXCException
Acknowledge alarm.

Parameters:
alarmId - Identifier of alarm to be acknowledged.
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

terminateAlarm

public void terminateAlarm(long alarmId)
                    throws java.io.IOException,
                           NXCException
Terminate alarm.

Parameters:
alarmId - Identifier of alarm to be terminated.
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deleteAlarm

public void deleteAlarm(long alarmId)
                 throws java.io.IOException,
                        NXCException
Delete alarm.

Parameters:
alarmId - Identifier of alarm to be deleted.
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

openAlarm

public void openAlarm(long alarmId,
                      java.lang.String reference)
               throws java.io.IOException,
                      NXCException
Set alarm's helpdesk state to "Open".

Parameters:
alarmId - Identifier of alarm to be changed.
reference - Helpdesk reference string.
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

closeAlarm

public void closeAlarm(long alarmId)
                throws java.io.IOException,
                       NXCException
Set alarm's helpdesk state to "Closed".

Parameters:
alarmId - Identifier of alarm to be changed.
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getServerVariables

public java.util.HashMap<java.lang.String,NXCServerVariable> getServerVariables()
                                                                         throws java.io.IOException,
                                                                                NXCException
Get server configuration variables.

Returns:
Hash map containing server configuration variables
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

setServerVariable

public void setServerVariable(java.lang.String name,
                              java.lang.String value)
                       throws java.io.IOException,
                              NXCException
Set server configuration variable.

Parameters:
name - variable's name
value - new variable's value
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deleteServerVariable

public void deleteServerVariable(java.lang.String name)
                          throws java.io.IOException,
                                 NXCException
Delete server configuration variable.

Parameters:
name - variable's name
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

subscribe

public void subscribe(int channels)
               throws java.io.IOException,
                      NXCException
Subscribe to notification channel(s)

Parameters:
channels - Notification channels to subscribe to. Multiple channels can be specified by combining them with OR operation.
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

unsubscribe

public void unsubscribe(int channels)
                 throws java.io.IOException,
                        NXCException
Unsubscribe from notification channel(s)

Parameters:
channels - Notification channels to unsubscribe from. Multiple channels can be specified by combining them with OR operation.
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

syncUserDatabase

public void syncUserDatabase()
                      throws java.io.IOException,
                             NXCException
Synchronize user database

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

findUserDBObjectById

public NXCUserDBObject findUserDBObjectById(long id)
Find user by ID

Returns:
User object with given ID or null if such user does not exist

getUserDatabaseObjects

public NXCUserDBObject[] getUserDatabaseObjects()
Get list of all user database objects

Returns:
List of all user database objects

createUser

public long createUser(java.lang.String name)
                throws java.io.IOException,
                       NXCException
Create user on server

Parameters:
name - Login name for new user
Returns:
ID assigned to newly created user
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

createUserGroup

public long createUserGroup(java.lang.String name)
                     throws java.io.IOException,
                            NXCException
Create user group on server

Parameters:
name - Name for new user group
Returns:
ID assigned to newly created user group
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deleteUserDBObject

public void deleteUserDBObject(long id)
                        throws java.io.IOException,
                               NXCException
Delete user or group on server

Parameters:
id - User or group ID
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

setUserPassword

public void setUserPassword(long id,
                            java.lang.String password)
                     throws java.io.IOException,
                            NXCException
Set password for user

Parameters:
id - User ID
password - New password
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

modifyUserDBObject

public void modifyUserDBObject(NXCUserDBObject object,
                               int fields)
                        throws java.io.IOException,
                               NXCException
Modify user database object

Parameters:
user - User data
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

modifyUserDBObject

public void modifyUserDBObject(NXCUserDBObject object)
                        throws java.io.IOException,
                               NXCException
Modify user database object

Parameters:
user - User data
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

lockUserDatabase

public void lockUserDatabase()
                      throws java.io.IOException,
                             NXCException
Lock user database

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

unlockUserDatabase

public void unlockUserDatabase()
                        throws java.io.IOException,
                               NXCException
Unlock user database

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

setAttributeForCurrentUser

public void setAttributeForCurrentUser(java.lang.String name,
                                       java.lang.String value)
                                throws java.io.IOException,
                                       NXCException
Set custom attribute for currently logged in user. Server will allow to change only attributes whose name starts with dot.

Parameters:
name - Attribute's name
value - New attribute's value
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getAttributeForCurrentUser

public java.lang.String getAttributeForCurrentUser(java.lang.String name)
                                            throws java.io.IOException,
                                                   NXCException
Get custom attribute for currently logged in user. If attribute is not set, empty string will be returned.

Parameters:
name - Attribute's name
Returns:
Attribute's value
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getLastValues

public DciValue[] getLastValues(long nodeId)
                         throws java.io.IOException,
                                NXCException
Get last DCI values for given node

Parameters:
nodeId - ID of the node to get DCI values for
Returns:
List of DCI values
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getCollectedData

public DciData getCollectedData(long nodeId,
                                long dciId,
                                java.util.Date from,
                                java.util.Date to,
                                int maxRows)
                         throws java.io.IOException,
                                NXCException
Get collected DCI data from server. Please note that you should specify either row count limit or time from/to limit.

Parameters:
nodeId - Node ID
dciId - DCI ID
from - Start of time range or null for no limit
to - End of time range or null for no limit
maxRows - Maximum number of rows to retrieve or 0 for no limit
Returns:
DCI data set
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

createObject

public long createObject(NXCObjectCreationData data)
                  throws java.io.IOException,
                         NXCException
Create object

Parameters:
data - Object creation data
Returns:
ID of new object
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deleteObject

public void deleteObject(long objectId)
                  throws java.io.IOException,
                         NXCException
Delete object

Parameters:
objectId - ID of an object which should be deleted
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

modifyObject

public void modifyObject(NXCObjectModificationData data)
                  throws java.io.IOException,
                         NXCException
Modify object (generic interface, in most cases wrapper functions should be used instead)

Parameters:
data - Object modification data
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

setObjectName

public void setObjectName(long objectId,
                          java.lang.String name)
                   throws java.io.IOException,
                          NXCException
Change object's name (wrapper for modifyObject())

Parameters:
objectId - ID of object to be changed
name - New object's name
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

setObjectCustomAttributes

public void setObjectCustomAttributes(long objectId,
                                      java.util.Map<java.lang.String,java.lang.String> attrList)
                               throws java.io.IOException,
                                      NXCException
Change object's custom attributes (wrapper for modifyObject())

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

setObjectACL

public void setObjectACL(long objectId,
                         NXCAccessListElement[] acl,
                         boolean inheritAccessRights)
                  throws java.io.IOException,
                         NXCException
Change object's ACL (wrapper for modifyObject())

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

changeNodeIpAddress

public void changeNodeIpAddress(long nodeId,
                                java.net.InetAddress addr)
                         throws java.io.IOException,
                                NXCException
Change primary IP address of a node. This operation separated from modifyObject() API because it forces immediate configuration poll for given node on server side.

Parameters:
nodeId - ID of node object
addr - New IP address
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

updateObjectComments

public void updateObjectComments(long objectId,
                                 java.lang.String comments)
                          throws java.io.IOException,
                                 NXCException
Change object's comments.

Parameters:
objectId - Object's ID
comments - New comments
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

setObjectManaged

public void setObjectManaged(long objectId,
                             boolean isManaged)
                      throws java.io.IOException,
                             NXCException
Set object's managed status.

Parameters:
objectId - object's identifier
isManaged - object's managed status
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

bindObject

public void bindObject(long parentId,
                       long childId)
                throws java.io.IOException,
                       NXCException
Bind object.

Parameters:
parentId - parent object's identifier
childId - Child object's identifier
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

unbindObject

public void unbindObject(long parentId,
                         long childId)
                  throws java.io.IOException,
                         NXCException
Unbind object.

Parameters:
parentId - parent object's identifier
childId - Child object's identifier
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

removeTemplate

public void removeTemplate(long templateId,
                           long nodeId,
                           boolean removeDci)
                    throws java.io.IOException,
                           NXCException
Remove data collection template from node.

Parameters:
templateId - template object identifier
nodeId - node object identifier
removeDci - true if DCIs created from this template should be removed
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

queryLayer2Topology

public NetworkMapPage queryLayer2Topology(long nodeId)
                                   throws java.io.IOException,
                                          NXCException
Query layer 2 topology for node

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

executeAction

public void executeAction(long nodeId,
                          java.lang.String action)
                   throws java.io.IOException,
                          NXCException
Execute action on remote agent

Parameters:
nodeId - Node object ID
action - Action name
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getServerJobList

public NXCServerJob[] getServerJobList()
                                throws java.io.IOException,
                                       NXCException
Get list of server jobs

Returns:
list of server jobs
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

cancelServerJob

public void cancelServerJob(long jobId)
                     throws java.io.IOException,
                            NXCException
Cancel server job

Parameters:
jobId - Job ID
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deployAgentPolicy

public void deployAgentPolicy(long policyId,
                              long nodeId)
                       throws java.io.IOException,
                              NXCException
Deploy policy on agent

Parameters:
policyId - Policy object ID
nodeId - Node object ID
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

uninstallAgentPolicy

public void uninstallAgentPolicy(long policyId,
                                 long nodeId)
                          throws java.io.IOException,
                                 NXCException
Uninstall policy from agent

Parameters:
policyId - Policy object ID
nodeId - Node object ID
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

openEventProcessingPolicy

public EventProcessingPolicy openEventProcessingPolicy()
                                                throws java.io.IOException,
                                                       NXCException
Open event processing policy for editing. This call will lock event processing policy on server until closeEventProcessingPolicy called or session terminated.

Returns:
Event processing policy
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

closeEventProcessingPolicy

public void closeEventProcessingPolicy()
                                throws java.io.IOException,
                                       NXCException
Close event processing policy. This call will unlock event processing policy on server. If policy was not previously open by current session exception will be thrown.

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

openDataCollectionConfiguration

public DataCollectionConfiguration openDataCollectionConfiguration(long nodeId)
                                                            throws java.io.IOException,
                                                                   NXCException
Open data collection configuration for given node. You must call DataCollectionConfiguration.close() to close data collection configuration when it is no longer needed.

Parameters:
nodeId - Node object identifier
Returns:
Data collection configuration object
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

openServerLog

public Log openServerLog(java.lang.String logName)
                  throws java.io.IOException,
                         NXCException
Open server log by name.

Parameters:
logName - Log name
Returns:
Log object
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getEventTemplates

public java.util.List<EventTemplate> getEventTemplates()
                                                throws java.io.IOException,
                                                       NXCException
Get event templates from server

Returns:
List of configured event templates
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

lockEventConfiguration

public void lockEventConfiguration()
                            throws java.io.IOException,
                                   NXCException
Lock event configuration.

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

unlockEventConfiguration

public void unlockEventConfiguration()
                              throws java.io.IOException,
                                     NXCException
Unlock event configuration.

Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

generateEventCode

public long generateEventCode()
                       throws java.io.IOException,
                              NXCException
Generate code for new event template.

Returns:
Code for new event template
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deleteEventTemplate

public void deleteEventTemplate(long eventCode)
                         throws java.io.IOException,
                                NXCException
Delete event template.

Parameters:
eventCode - Event code
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

modifyEventTemplate

public void modifyEventTemplate(EventTemplate evt)
                         throws java.io.IOException,
                                NXCException
Modify event template.

Parameters:
evt - Event template
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getSnmpCommunities

public java.util.List<java.lang.String> getSnmpCommunities()
                                                    throws java.io.IOException,
                                                           NXCException
Get list of well-known SNMP communities configured on server.

Returns:
List of SNMP community strings
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

updateSnmpCommunities

public void updateSnmpCommunities(java.util.List<java.lang.String> list)
                           throws java.io.IOException,
                                  NXCException
Update list of well-known SNMP community strings on server. Existing list will be replaced by given one.

Parameters:
list - New list of SNMP community strings
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getSnmpUsmCredentials

public java.util.List<SnmpUsmCredential> getSnmpUsmCredentials()
                                                        throws java.io.IOException,
                                                               NXCException
Get list of well-known SNMP USM (user security model) credentials configured on server.

Returns:
List of SNMP USM credentials
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

updateSnmpUsmCredentials

public void updateSnmpUsmCredentials(java.util.List<SnmpUsmCredential> list)
                              throws java.io.IOException,
                                     NXCException
Update list of well-known SNMP USM credentials on server. Existing list will be replaced by given one.

Parameters:
list - New list of SNMP USM credentials
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out


Copyright © 2009. All Rights Reserved.