org.netxms.client
Class NXCSession

java.lang.Object
  extended by org.netxms.client.NXCSession
All Implemented Interfaces:
ImageLibraryManager, ScriptLibraryManager, ServerManager, Session, UserManager

public class NXCSession
extends java.lang.Object
implements Session, ScriptLibraryManager, UserManager, ServerManager, ImageLibraryManager

Communication session with NetXMS server.


Field Summary
static int ADDRESS_LIST_DISCOVERY_FILTER
           
static int ADDRESS_LIST_DISCOVERY_TARGETS
           
static int APPLICATION_CLIENT
           
static int AUTH_TYPE_CERTIFICATE
           
static int AUTH_TYPE_PASSWORD
           
static int CFG_IMPORT_REPLACE_EVENT_BY_CODE
           
static int CFG_IMPORT_REPLACE_EVENT_BY_NAME
           
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 DESKTOP_CLIENT
           
static int MOBILE_CLIENT
           
static int OBJECT_SYNC_NOTIFY
           
static int OBJECT_SYNC_WAIT
           
static int SERVER_COMPONENT_DISCOVERY_MANAGER
           
static int TABLET_CLIENT
           
static int WEB_CLIENT
           
 
Fields inherited from interface org.netxms.api.client.users.UserManager
USER_MODIFY_ACCESS_RIGHTS, USER_MODIFY_AUTH_METHOD, USER_MODIFY_CERT_MAPPING, USER_MODIFY_CUSTOM_ATTRIBUTES, USER_MODIFY_DESCRIPTION, USER_MODIFY_FLAGS, USER_MODIFY_FULL_NAME, USER_MODIFY_LOGIN_NAME, USER_MODIFY_MEMBERS, USER_MODIFY_PASSWD_LENGTH, USER_MODIFY_TEMP_DISABLE
 
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 acknowledgeAlarm(long alarmId, boolean sticky)
          Acknowledge alarm.
 void addClusterNode(long clusterId, long nodeId)
          Add node to cluster.
 void addConsoleListener(ServerConsoleListener listener)
          Add server console listener
 void addListener(SessionListener listener)
           
 void applyTemplate(long templateId, long nodeId)
          Apply data collection template to node.
 void bindObject(long parentId, long childId)
          Bind object.
 void cancelServerJob(long jobId)
          Cancel server job
 void changeObjectZone(long objectId, long zoneId)
          Move object to different zone.
 void checkConnection()
           
 void clearCollectedData(long nodeId, long dciId)
          Clear collected data for given DCI
 void closeAlarm(long alarmId)
          Set alarm's helpdesk state to "Closed".
 void closeConsole()
          Close server console.
 void closeEventProcessingPolicy()
          Close event processing policy.
 void connect()
           
 long createAction(java.lang.String name)
          Create new server action.
 LibraryImage createImage(LibraryImage image, ProgressListener listener)
           
 long createObject(NXCObjectCreationData data)
          Create object
 long createSituation(java.lang.String name, java.lang.String comments)
          Create new situation object.
 long createSnmpTrapConfiguration()
          Create new trap configuration record.
 long createUser(java.lang.String name)
           
 long createUserGroup(java.lang.String name)
           
 void deleteAction(long actionId)
          Delete server action
 void deleteAlarm(long alarmId)
          Delete alarm.
 void deleteEventTemplate(long eventCode)
          Delete event template.
 void deleteImage(LibraryImage image)
           
 void deleteObject(long objectId)
          Delete object
 void deleteObjectTool(long toolId)
          Delete object tool.
 void deletePredefinedGraph(long graphId)
          Delete predefined graph.
 void deleteReportResults(long reportId, java.util.Collection<java.lang.Long> resultIdList)
          Delete report execution results.
 void deleteScript(long scriptId)
           
 void deleteServerFile(java.lang.String serverFileName)
          Delete file from server's file store
 void deleteServerVariable(java.lang.String name)
           
 void deleteSituation(long id)
          Delete situation object
 void deleteSituationInstance(long id, java.lang.String instance)
          Delete situation instance
 void deleteSnmpTrapConfiguration(long trapId)
          Delete SNMP trap configuration record from server.
 void deleteUserDBObject(long id)
           
 void deployAgentPolicy(long policyId, long nodeId)
          Deploy policy on agent
 void deployPackage(long packageId, java.lang.Long[] nodeList, PackageDeploymentListener listener)
          Deploy agent packages onto given nodes
 void disconnect()
           
 java.io.File downloadFileFromAgent(long nodeId, java.lang.String remoteFileName)
          Download file from remote host via agent.
 java.io.File downloadMibFile()
          Download MIB file from server.
 void executeAction(long nodeId, java.lang.String action)
          Execute action on remote agent
 long executeReport(long reportId, java.util.Map<java.lang.String,java.lang.String> parameters)
          Execute report.
 void executeServerCommand(long objectId, java.lang.String command)
          Execute server command related to given object (usually defined as object tool)
protected  void executeSimpleCommand(int command)
          Execute simple commands (without arguments and only returning RCC)
 Table executeTableTool(long toolId, long nodeId)
          Execute object tool of "table" type against given node.
 java.lang.String exportConfiguration(java.lang.String description, long[] events, long[] traps, long[] templates)
          Export server configuration.
protected  void finalize()
           
 ConnectionPoint findConnectionPoint(int zoneId, java.net.InetAddress ipAddr)
          Find connection point (either directly connected or most close known interface on a switch) for given IP address.
 ConnectionPoint findConnectionPoint(long objectId)
          Find connection point (either directly connected or most close known interface on a switch) for given node or interface object.
 ConnectionPoint findConnectionPoint(MacAddress macAddr)
          Find connection point (either directly connected or most close known interface on a switch) for given MAC address.
 EventTemplate findEventTemplateByCode(long code)
          Find event template by code in event template database internally maintained by session object.
 java.util.List<EventTemplate> findMultipleEventTemplates(long[] codes)
          Find multiple event templates by event codes in event template database internally maintained by session object.
 java.util.List<EventTemplate> findMultipleEventTemplates(java.lang.Long[] codes)
          Find multiple event templates by event codes in event template database internally maintained by session object.
 java.util.List<GenericObject> findMultipleObjects(long[] idList, boolean returnUnknown)
          Find multiple NetXMS objects by identifiers
 java.util.List<GenericObject> findMultipleObjects(java.lang.Long[] idList, boolean returnUnknown)
          Find multiple NetXMS objects by identifiers
 java.util.List<GenericObject> findMultipleObjects(long[] idList, java.lang.Class<? extends GenericObject> classFilter, boolean returnUnknown)
          Find multiple NetXMS objects by identifiers
 java.util.List<GenericObject> findMultipleObjects(java.lang.Long[] idList, java.lang.Class<? extends GenericObject> classFilter, boolean returnUnknown)
          Find multiple NetXMS objects by identifiers
 GenericObject findObjectById(long id)
          Find NetXMS object by it's identifier.
 GenericObject findObjectById(long id, java.lang.Class<? extends GenericObject> requiredClass)
          Find NetXMS object by it's identifier with additional class checking.
 GenericObject findObjectByName(java.lang.String name)
          Find object by name.
 GenericObject findObjectByNamePattern(java.lang.String pattern)
          Find object by name using regular expression.
 AbstractUserObject findUserDBObjectById(long id)
           
 long generateEventCode()
          Generate code for new event template.
 long generateObjectToolId()
          Generate unique ID for new object tool.
 java.util.List<ServerAction> getActions()
          Get list of configured actions from server
 java.util.List<IpAddressListElement> getAddressList(int listId)
          Get address list.
 java.lang.String getAgentConfig(long nodeId)
          Get agent's master configuration file.
 Alarm getAlarm(long alarmId)
          Get information about single active alarm.
 java.util.List<AlarmNote> getAlarmNotes(long alarmId)
          Get list of notes (comments) for given alarm.
 java.util.HashMap<java.lang.Long,Alarm> getAlarms()
          Get list of active alarms.
 GenericObject[] getAllObjects()
          Get list of all objects
 java.lang.String getAttributeForCurrentUser(java.lang.String name)
           
 EventTemplate[] getCachedEventTemplates()
          Get cached list event templates
 int getClientType()
           
 DciData getCollectedData(long nodeId, long dciId, java.util.Date from, java.util.Date to, int maxRows)
          Get collected DCI data from server.
 DciData getCollectedTableData(long nodeId, long dciId, java.lang.String instance, java.lang.String dataColumn, java.util.Date from, java.util.Date to, int maxRows)
          Get collected table DCI data from server.
 java.lang.String getConnClientInfo()
           
 long[] getDataCollectionEvents(long objectId)
          Get all events used in data collection by given node, cluster, or template obejct.
 java.lang.String getDateFormat()
           
 java.util.List<EventTemplate> getEventTemplates()
          Get event templates from server
 LibraryImage getImage(java.util.UUID guid)
           
 java.util.List<LibraryImage> getImageLibrary()
           
 java.util.List<LibraryImage> getImageLibrary(java.lang.String category)
           
 java.util.List<PackageInfo> getInstalledPackages()
          Get list of installed packages
 DciValue[] getLastValues(long nodeId)
          Get last DCI values for given node
 java.util.Date getMibFileTimestamp()
          Get timestamp of server's MIB file.
 NetworkPath getNetworkPath(long node1, long node2)
          Get IPv4 network path between two nodes.
 PhysicalComponent getNodePhysicalComponents(long nodeId)
          Get node's physical components (obtained from ENTITY-MIB).
 java.lang.String getObjectName(long objectId)
          Get object name by ID.
 ObjectToolDetails getObjectToolDetails(long toolId)
          Get object tool details
 java.util.List<ObjectTool> getObjectTools()
          Get list of configured object tools
 PerfTabDci[] getPerfTabItems(long nodeId)
          Get list of DCIs configured to be shown on performance tab in console for given node.
 java.util.List<GraphSettings> getPredefinedGraphs()
          Get list of predefined graphs.
 int getRecvBufferSize()
           
 java.util.List<ReportResult> getReportResults(long reportId)
          Get list of report execution results.
 Script getScript(long scriptId)
           
 java.util.List<Script> getScriptLibrary()
           
 java.lang.String getServerAddress()
           
 byte[] getServerChallenge()
           
 java.lang.String getServerConfigClob(java.lang.String name)
          Get server config CLOB
 byte[] getServerId()
           
 NXCServerJob[] getServerJobList()
          Get list of server jobs
 java.util.Map<java.lang.String,java.lang.Object> getServerStats()
          Get server stats.
 java.lang.String getServerTimeZone()
           
 java.util.Map<java.lang.String,ServerVariable> getServerVariables()
           
 java.lang.String getServerVersion()
           
 java.util.List<Situation> getSituations()
          Get list of all configured situations
 java.util.List<java.lang.String> getSnmpCommunities()
          Get list of well-known SNMP communities configured on server.
 java.util.List<SnmpTrap> getSnmpTrapsConfiguration()
          Get list of configured SNMP traps
 java.util.List<SnmpTrap> getSnmpTrapsConfigurationSummary()
          Get summary of SNMP trap mapping.
 java.util.List<SnmpUsmCredential> getSnmpUsmCredentials()
          Get list of well-known SNMP USM (user security model) credentials configured on server.
 java.util.List<AgentParameter> getSupportedParameters(long nodeId)
          Get list of parameters supported by agent running on given node.
 Table getTableLastValues(long nodeId, long dciId)
          Get last values for given table DCI on given node
 Threshold[] getThresholds(long nodeId, long dciId)
          Get list of thresholds configured for given DCI
 java.util.List<ThresholdViolationSummary> getThresholdSummary(long objectId)
          Get threshold violation summary for all nodes under given parent object.
 java.lang.String getTileServerURL()
           
 java.lang.String getTimeFormat()
           
 GenericObject[] getTopLevelObjects()
          Get list of top-level objects.
 GenericObject[] getTopLevelObjects(java.util.Set<java.lang.Integer> classFilter)
          Get list of top-level objects matching given class filter.
 AbstractUserObject[] getUserDatabaseObjects()
           
 int getUserId()
           
 java.lang.String getUserName()
           
 int getUserSystemRights()
           
 java.util.List<VlanInfo> getVlans(long nodeId)
          Get list of VLANs configured on given node
 void handover(NXCSession target)
          Handover object cache to new session.
 void holdServerJob(long jobId)
          Put server job on hold
 void importConfiguration(java.lang.String config, int flags)
          Import server configuration (events, traps, thresholds) from XML
 long installPackage(PackageInfo info, java.io.File pkgFile, ProgressListener listener)
          Install (upload) package on server
 boolean isConnected()
          
 boolean isObjectsSynchronized()
           
 boolean isPasswordExpired()
           
 boolean isServerConsoleConnected()
           
 boolean isZoningEnabled()
           
 ServerFile[] listServerFiles()
          List files in server's file store.
 void lockPackageDatabase()
          Lock package database
 void lockUserDatabase()
           
 void modifyAction(ServerAction action)
          Modify server action
 void modifyEventTemplate(EventTemplate evt)
          Modify event template.
 void modifyImage(LibraryImage image, ProgressListener listener)
           
 void modifyObject(NXCObjectModificationData data)
          Modify object (generic interface, in most cases wrapper functions should be used instead)
 void modifyObjectTool(ObjectToolDetails tool)
          Modify object tool.
 long modifyPredefinedGraph(GraphSettings graph)
          Create or modify predefined graph.
 long modifyScript(long scriptId, java.lang.String name, java.lang.String source)
           
 void modifySituation(long id, java.lang.String name, java.lang.String comments)
          Modify situation object.
 void modifySnmpTrapConfiguration(SnmpTrap trap)
          Modify SNMP trap configuration record.
 void modifyUserDBObject(AbstractUserObject object)
           
 void modifyUserDBObject(AbstractUserObject object, int fields)
           
 NXCPMessage newMessage(int code)
           
 void openAlarm(long alarmId, java.lang.String reference)
          Set alarm's helpdesk state to "Open".
 void openConsole()
          Open server console.
 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.
 void pollNode(long nodeId, int pollType, NodePollListener listener)
          Perform a forced node poll.
 boolean processConsoleCommand(java.lang.String command)
          Process console command on server.
 void pushDciData(DciPushData[] data)
          Push data to server.
 void pushDciData(long nodeId, long dciId, java.lang.String value)
          Push value for single DCI.
 void pushDciData(java.lang.String nodeName, java.lang.String dciName, java.lang.String value)
          Push value for single DCI.
 Table queryAgentTable(long nodeId, java.lang.String name)
          Query agent's table immediately.
 NetworkMapPage queryLayer2Topology(long nodeId)
          Query layer 2 topology for node
 java.lang.String queryParameter(long nodeId, int origin, java.lang.String name)
          Query parameter immediately.
 Table receiveTable(long requestId, int msgCode)
          Receive table from server.
 void removeClusterNode(long clusterId, long nodeId)
          Remove node from cluster.
 void removeConsoleListener(ServerConsoleListener listener)
          Remove server console listener
 void removeListener(SessionListener listener)
           
 void removePackage(long packageId)
          Remove agent package from server
 void removeTemplate(long templateId, long nodeId, boolean removeDci)
          Remove data collection template from node.
 void renameScript(long scriptId, java.lang.String name)
           
 java.io.File renderReport(long jobId, ReportRenderFormat format)
          Render report into desired format
 void resetServerComponent(int component)
          Reset server's internal component (defined by SERVER_COMPONENT_xxx)
 void resolveAlarm(long alarmId)
          Resolve alarm.
 java.lang.String[] resolveDciNames(java.util.Collection<ConditionDciInfo> dciList)
          Resolve names of given DCIs
 java.lang.String[] resolveDciNames(long[] nodeIds, long[] dciIds)
          Resolve names of given DCIs
 void saveEventProcessingPolicy(EventProcessingPolicy epp)
          Save event processing policy.
 void sendEvent(long eventCode, java.lang.String[] parameters)
          Convenience wrapper for sendEvent interface.
 void sendEvent(long eventCode, java.lang.String eventName, long objectId, java.lang.String[] parameters, java.lang.String userTag)
          Send event to server.
 void sendEvent(java.lang.String eventName, java.lang.String[] parameters)
          Convenience wrapper for sendEvent interface.
protected  void sendFile(long requestId, byte[] data, ProgressListener listener)
          Send block of data as binary message
protected  void sendFile(long requestId, java.io.File file, ProgressListener listener)
          Send file over CSCP
 void sendMessage(NXCPMessage msg)
          Send message to server
protected  void sendNotification(NXCNotification n)
          Call notification handlers on all registered listeners
 void sendSMS(java.lang.String phoneNumber, java.lang.String message)
          Send SMS via server.
 void setAddressList(int listId, java.util.List<IpAddressListElement> list)
          Set content of address list.
 void setAttributeForCurrentUser(java.lang.String name, java.lang.String value)
           
 void setClientType(int clientType)
          Set client type.
 void setCommandTimeout(int commandTimeout)
           
 void setConnClientInfo(java.lang.String connClientInfo)
           
 void setObjectACL(long objectId, AccessListElement[] 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)
           
 void setReportDefinition(long objectId, java.io.File file)
          Change report's definition (wrapper for modifyObject())
 void setReportDefinition(long objectId, java.lang.String definition)
          Change report's definition (wrapper for modifyObject())
 void setServerConfigClob(java.lang.String name, java.lang.String value)
          Set server config CLOB
 void setServerVariable(java.lang.String name, java.lang.String value)
           
 void setUserPassword(long id, java.lang.String newPassword, java.lang.String oldPassword)
           
 void snmpWalk(long nodeId, java.lang.String rootOid, SnmpWalkListener listener)
          Do SNMP walk.
 void subscribe(int channels)
          Subscribe to notification channel(s)
 void syncEventTemplates()
          Synchronize event templates configuration.
 void syncMissingObjects(long[] objects, boolean syncComments)
          Synchronize only those objects from given set which are not synchronized yet.
 void syncMissingObjects(long[] objects, boolean syncComments, int options)
          Synchronize only those objects from given set which are not synchronized yet.
 void syncObjects()
          Synchronizes NetXMS objects between server and client.
 void syncObjectSet(long[] objects, boolean syncComments)
          Synchronizes selected object set with the server.
 void syncObjectSet(long[] objects, boolean syncComments, int options)
          Synchronizes selected object set with the server.
 void syncUserDatabase()
           
 void terminateAlarm(long alarmId)
          Terminate alarm.
 void unbindObject(long parentId, long childId)
          Unbind object.
 void unholdServerJob(long jobId)
          Put server on hold job to pending state
 void uninstallAgentPolicy(long policyId, long nodeId)
          Uninstall policy from agent
 void unlockPackageDatabase()
          Unlock package database
 void unlockUserDatabase()
           
 void unsubscribe(int channels)
          Unsubscribe from notification channel(s)
 void updateAgentConfig(long nodeId, java.lang.String config, boolean apply)
          Update agent's master configuration file.
 void updateAlarmNote(long alarmId, long noteId, java.lang.String text)
          Create or update alarm's note (comment).
 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.
 long uploadFileToAgent(long nodeId, java.lang.String serverFileName, java.lang.String remoteFileName, boolean jobOnHold)
          Start file upload from server's file store to agent.
 void uploadFileToServer(java.io.File localFile, java.lang.String serverFileName, ProgressListener listener)
          Upload local file to server's file store
 java.io.File waitForFile(long id, int timeout)
          Wait for specific file to arrive
 NXCPMessage waitForMessage(int code, long id)
           
 NXCPMessage waitForMessage(int code, long id, int timeout)
           
 NXCPMessage waitForRCC(long id)
           
 NXCPMessage waitForRCC(long id, int timeout)
           
 void wakeupNode(long objectId)
          Wakeup node by sending wake-on-LAN magic packet.
 
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

OBJECT_SYNC_NOTIFY

public static final int OBJECT_SYNC_NOTIFY
See Also:
Constant Field Values

OBJECT_SYNC_WAIT

public static final int OBJECT_SYNC_WAIT
See Also:
Constant Field Values

CFG_IMPORT_REPLACE_EVENT_BY_CODE

public static final int CFG_IMPORT_REPLACE_EVENT_BY_CODE
See Also:
Constant Field Values

CFG_IMPORT_REPLACE_EVENT_BY_NAME

public static final int CFG_IMPORT_REPLACE_EVENT_BY_NAME
See Also:
Constant Field Values

ADDRESS_LIST_DISCOVERY_TARGETS

public static final int ADDRESS_LIST_DISCOVERY_TARGETS
See Also:
Constant Field Values

ADDRESS_LIST_DISCOVERY_FILTER

public static final int ADDRESS_LIST_DISCOVERY_FILTER
See Also:
Constant Field Values

SERVER_COMPONENT_DISCOVERY_MANAGER

public static final int SERVER_COMPONENT_DISCOVERY_MANAGER
See Also:
Constant Field Values

DESKTOP_CLIENT

public static final int DESKTOP_CLIENT
See Also:
Constant Field Values

WEB_CLIENT

public static final int WEB_CLIENT
See Also:
Constant Field Values

MOBILE_CLIENT

public static final int MOBILE_CLIENT
See Also:
Constant Field Values

TABLET_CLIENT

public static final int TABLET_CLIENT
See Also:
Constant Field Values

APPLICATION_CLIENT

public static final int APPLICATION_CLIENT
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(SessionListener listener)
Specified by:
addListener in interface Session

removeListener

public void removeListener(SessionListener listener)
Specified by:
removeListener in interface Session

addConsoleListener

public void addConsoleListener(ServerConsoleListener listener)
Add server console listener

Parameters:
listener -

removeConsoleListener

public void removeConsoleListener(ServerConsoleListener listener)
Remove server console listener

Parameters:
listener -

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,
                        NXCException
Send message to server

Parameters:
msg - Message to sent
Throws:
java.io.IOException - in case of socket communication failure
NXCException - in case of encryption error

sendFile

protected void sendFile(long requestId,
                        java.io.File file,
                        ProgressListener listener)
                 throws java.io.IOException,
                        NXCException
Send file over CSCP

Parameters:
requestId -
file - source file to be sent
Throws:
java.io.IOException
NXCException

sendFile

protected void sendFile(long requestId,
                        byte[] data,
                        ProgressListener listener)
                 throws java.io.IOException,
                        NXCException
Send block of data as binary message

Parameters:
requestId -
data -
Throws:
java.io.IOException
NXCException

waitForMessage

public NXCPMessage waitForMessage(int code,
                                  long id,
                                  int timeout)
                           throws NXCException
Specified by:
waitForMessage in interface Session
Throws:
NXCException

waitForMessage

public NXCPMessage waitForMessage(int code,
                                  long id)
                           throws NXCException
Specified by:
waitForMessage in interface Session
Throws:
NXCException

waitForRCC

public NXCPMessage waitForRCC(long id)
                       throws NXCException
Specified by:
waitForRCC in interface Session
Throws:
NXCException

waitForRCC

public NXCPMessage waitForRCC(long id,
                              int timeout)
                       throws NXCException
Specified by:
waitForRCC in interface Session
Throws:
NXCException

newMessage

public final NXCPMessage newMessage(int code)
Specified by:
newMessage in interface Session

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,
                    NetXMSClientException
Specified by:
connect in interface Session
Throws:
java.io.IOException
java.net.UnknownHostException
NetXMSClientException

disconnect

public void disconnect()
Specified by:
disconnect in interface Session

getRecvBufferSize

public int getRecvBufferSize()
Specified by:
getRecvBufferSize in interface Session

setRecvBufferSize

public void setRecvBufferSize(int recvBufferSize)
Specified by:
setRecvBufferSize in interface Session

getServerAddress

public java.lang.String getServerAddress()
Specified by:
getServerAddress in interface Session

getUserName

public java.lang.String getUserName()
Specified by:
getUserName in interface Session

getServerVersion

public java.lang.String getServerVersion()
Specified by:
getServerVersion in interface Session

getServerId

public byte[] getServerId()
Specified by:
getServerId in interface Session

getServerTimeZone

public java.lang.String getServerTimeZone()
Specified by:
getServerTimeZone in interface Session

getServerChallenge

public byte[] getServerChallenge()
Returns:
the serverChallenge

getTileServerURL

public java.lang.String getTileServerURL()
Returns:
the tileServerURL

isZoningEnabled

public boolean isZoningEnabled()
Returns:
the zoningEnabled

getConnClientInfo

public java.lang.String getConnClientInfo()
Specified by:
getConnClientInfo in interface Session

setConnClientInfo

public void setConnClientInfo(java.lang.String connClientInfo)
Specified by:
setConnClientInfo in interface Session

setCommandTimeout

public void setCommandTimeout(int commandTimeout)
Specified by:
setCommandTimeout in interface Session

getUserId

public int getUserId()
Specified by:
getUserId in interface Session

getUserSystemRights

public int getUserSystemRights()
Specified by:
getUserSystemRights in interface Session

isPasswordExpired

public boolean isPasswordExpired()
Specified by:
isPasswordExpired in interface Session

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

syncObjectSet

public void syncObjectSet(long[] objects,
                          boolean syncComments)
                   throws java.io.IOException,
                          NXCException
Synchronizes selected object set with the server.

Parameters:
objects - identifiers of objects need to be synchronized
syncComments - if true, comments for objects will be synchronized as well
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

syncObjectSet

public void syncObjectSet(long[] objects,
                          boolean syncComments,
                          int options)
                   throws java.io.IOException,
                          NXCException
Synchronizes selected object set with the server. The following options are accepted: OBJECT_SYNC_NOTIFY - send object update notification for each received object OBJECT_SYNC_WAIT - wait until all requested objects received

Parameters:
objects - identifiers of objects need to be synchronized
syncComments - if true, comments for objects will be synchronized as well
options - sync options (see above)
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

syncMissingObjects

public void syncMissingObjects(long[] objects,
                               boolean syncComments)
                        throws java.io.IOException,
                               NXCException
Synchronize only those objects from given set which are not synchronized yet.

Parameters:
objects - identifiers of objects need to be synchronized
syncComments - if true, comments for objects will be synchronized as well
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

syncMissingObjects

public void syncMissingObjects(long[] objects,
                               boolean syncComments,
                               int options)
                        throws java.io.IOException,
                               NXCException
Synchronize only those objects from given set which are not synchronized yet. Accepts all options which are valid for syncObjectSet.

Parameters:
objects - identifiers of objects need to be synchronized
syncComments - if true, comments for objects will be synchronized as well
options - sync options (see comments for syncObjectSet)
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

findObjectById

public GenericObject 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

findObjectById

public GenericObject findObjectById(long id,
                                    java.lang.Class<? extends GenericObject> requiredClass)
Find NetXMS object by it's identifier with additional class checking.

Parameters:
id - object identifier
requiredClass - required object class
Returns:
Object with given ID or null if object cannot be found or is not an instance of required class

findMultipleObjects

public java.util.List<GenericObject> findMultipleObjects(long[] idList,
                                                         boolean returnUnknown)
Find multiple NetXMS objects by identifiers

Parameters:
idList - array of object identifiers
returnUnknown - if true, this method will return UnknownObject placeholders for unknown object identifiers
Returns:
list of found objects

findMultipleObjects

public java.util.List<GenericObject> findMultipleObjects(long[] idList,
                                                         java.lang.Class<? extends GenericObject> classFilter,
                                                         boolean returnUnknown)
Find multiple NetXMS objects by identifiers

Parameters:
idList - array of object identifiers
classFilter - class filter for objects, or null to disable filtering
returnUnknown - if true, this method will return UnknownObject placeholders for unknown object identifiers
Returns:
list of found objects

findMultipleObjects

public java.util.List<GenericObject> findMultipleObjects(java.lang.Long[] idList,
                                                         boolean returnUnknown)
Find multiple NetXMS objects by identifiers

Parameters:
idList - array of object identifiers
returnUnknown - if true, this method will return UnknownObject placeholders for unknown object identifiers
Returns:
array of found objects

findMultipleObjects

public java.util.List<GenericObject> findMultipleObjects(java.lang.Long[] idList,
                                                         java.lang.Class<? extends GenericObject> classFilter,
                                                         boolean returnUnknown)
Find multiple NetXMS objects by identifiers

Parameters:
idList - array of object identifiers
classFilter - class filter for objects, or null to disable filtering
returnUnknown - if true, this method will return UnknownObject placeholders for unknown object identifiers
Returns:
array of found objects

findObjectByName

public GenericObject findObjectByName(java.lang.String name)
Find object by name. If multiple objects with same name exist, it is not determined what object will be returned. Name comparison is case-insensitive.

Parameters:
name - object name to find
Returns:
object with matching name or null

findObjectByNamePattern

public GenericObject findObjectByNamePattern(java.lang.String pattern)
Find object by name using regular expression. If multiple objects with same name exist, it is not determined what object will be returned. Name comparison is case-insensitive.

Parameters:
pattern - regular expression for matching object name
Returns:
object with matching name or null

getTopLevelObjects

public GenericObject[] getTopLevelObjects(java.util.Set<java.lang.Integer> classFilter)
Get list of top-level objects matching given class filter. Class filter may be null to ignore object class.

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

getTopLevelObjects

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

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

getAllObjects

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

Returns:
List of all objects

getObjectName

public java.lang.String getObjectName(long objectId)
Get object name by ID.

Parameters:
objectId - object ID
Returns:
object name if object is known, or string in form [] for unknown objects

getAlarms

public java.util.HashMap<java.lang.Long,Alarm> getAlarms()
                                                  throws java.io.IOException,
                                                         NXCException
Get list of active alarms. For accessing terminated alarms log view API should be used.

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

getAlarm

public Alarm getAlarm(long alarmId)
               throws java.io.IOException,
                      NXCException
Get information about single active alarm. Terminated alarms cannot be accessed with this call.

Parameters:
alarmId - alarm ID
Returns:
alarm object
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,
                             boolean sticky)
                      throws java.io.IOException,
                             NXCException
Acknowledge alarm.

Parameters:
alarmId - Identifier of alarm to be acknowledged.
sticky - if set to true, acknowledged state will be made "sticky" (duplicate alarms with same key will not revert it back to outstanding)
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

resolveAlarm

public void resolveAlarm(long alarmId)
                  throws java.io.IOException,
                         NXCException
Resolve alarm.

Parameters:
alarmId - Identifier of alarm to be resolved.
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

getAlarmNotes

public java.util.List<AlarmNote> getAlarmNotes(long alarmId)
                                        throws java.io.IOException,
                                               NXCException
Get list of notes (comments) for given alarm.

Parameters:
alarmId - alarm ID
Returns:
list of alarm's notes
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

updateAlarmNote

public void updateAlarmNote(long alarmId,
                            long noteId,
                            java.lang.String text)
                     throws java.io.IOException,
                            NXCException
Create or update alarm's note (comment). To create new note, set nodeId to 0.

Parameters:
alarmId - alarm ID
noteId - note ID or 0 for creating new note
text - message text
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.Map<java.lang.String,ServerVariable> getServerVariables()
                                                                  throws java.io.IOException,
                                                                         NXCException
Specified by:
getServerVariables in interface ServerManager
Throws:
java.io.IOException
NXCException

setServerVariable

public void setServerVariable(java.lang.String name,
                              java.lang.String value)
                       throws java.io.IOException,
                              NXCException
Specified by:
setServerVariable in interface ServerManager
Throws:
java.io.IOException
NXCException

deleteServerVariable

public void deleteServerVariable(java.lang.String name)
                          throws java.io.IOException,
                                 NXCException
Specified by:
deleteServerVariable in interface ServerManager
Throws:
java.io.IOException
NXCException

getServerConfigClob

public java.lang.String getServerConfigClob(java.lang.String name)
                                     throws java.io.IOException,
                                            NXCException
Get server config CLOB

Parameters:
name -
Returns:
Throws:
java.io.IOException
NXCException

setServerConfigClob

public void setServerConfigClob(java.lang.String name,
                                java.lang.String value)
                         throws java.io.IOException,
                                NXCException
Set server config CLOB

Parameters:
name -
value -
Throws:
java.io.IOException
NXCException

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
Specified by:
syncUserDatabase in interface UserManager
Throws:
java.io.IOException
NXCException

findUserDBObjectById

public AbstractUserObject findUserDBObjectById(long id)
Specified by:
findUserDBObjectById in interface UserManager

getUserDatabaseObjects

public AbstractUserObject[] getUserDatabaseObjects()
Specified by:
getUserDatabaseObjects in interface UserManager

createUser

public long createUser(java.lang.String name)
                throws java.io.IOException,
                       NXCException
Specified by:
createUser in interface UserManager
Throws:
java.io.IOException
NXCException

createUserGroup

public long createUserGroup(java.lang.String name)
                     throws java.io.IOException,
                            NXCException
Specified by:
createUserGroup in interface UserManager
Throws:
java.io.IOException
NXCException

deleteUserDBObject

public void deleteUserDBObject(long id)
                        throws java.io.IOException,
                               NXCException
Specified by:
deleteUserDBObject in interface UserManager
Throws:
java.io.IOException
NXCException

setUserPassword

public void setUserPassword(long id,
                            java.lang.String newPassword,
                            java.lang.String oldPassword)
                     throws java.io.IOException,
                            NXCException
Specified by:
setUserPassword in interface UserManager
Throws:
java.io.IOException
NXCException

modifyUserDBObject

public void modifyUserDBObject(AbstractUserObject object,
                               int fields)
                        throws java.io.IOException,
                               NXCException
Specified by:
modifyUserDBObject in interface UserManager
Throws:
java.io.IOException
NXCException

modifyUserDBObject

public void modifyUserDBObject(AbstractUserObject object)
                        throws java.io.IOException,
                               NXCException
Specified by:
modifyUserDBObject in interface UserManager
Throws:
java.io.IOException
NXCException

lockUserDatabase

public void lockUserDatabase()
                      throws java.io.IOException,
                             NXCException
Specified by:
lockUserDatabase in interface UserManager
Throws:
java.io.IOException
NXCException

unlockUserDatabase

public void unlockUserDatabase()
                        throws java.io.IOException,
                               NXCException
Specified by:
unlockUserDatabase in interface UserManager
Throws:
java.io.IOException
NXCException

setAttributeForCurrentUser

public void setAttributeForCurrentUser(java.lang.String name,
                                       java.lang.String value)
                                throws java.io.IOException,
                                       NXCException
Specified by:
setAttributeForCurrentUser in interface Session
Throws:
java.io.IOException
NXCException

getAttributeForCurrentUser

public java.lang.String getAttributeForCurrentUser(java.lang.String name)
                                            throws java.io.IOException,
                                                   NXCException
Specified by:
getAttributeForCurrentUser in interface Session
Throws:
java.io.IOException
NXCException

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

getTableLastValues

public Table getTableLastValues(long nodeId,
                                long dciId)
                         throws java.io.IOException,
                                NXCException
Get last values for given table DCI on given node

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

getPerfTabItems

public PerfTabDci[] getPerfTabItems(long nodeId)
                             throws java.io.IOException,
                                    NXCException
Get list of DCIs configured to be shown on performance tab in console for given node.

Parameters:
nodeId - Node object ID
Returns:
List of performance tab DCIs
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getThresholdSummary

public java.util.List<ThresholdViolationSummary> getThresholdSummary(long objectId)
                                                              throws java.io.IOException,
                                                                     NXCException
Get threshold violation summary for all nodes under given parent object. Parent object could be container, subnet, zone, entire network, or infrastructure service root.

Parameters:
objectId - parent object ID
Returns:
list of threshold violation summary objects for all nodes below given root
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

getCollectedTableData

public DciData getCollectedTableData(long nodeId,
                                     long dciId,
                                     java.lang.String instance,
                                     java.lang.String dataColumn,
                                     java.util.Date from,
                                     java.util.Date to,
                                     int maxRows)
                              throws java.io.IOException,
                                     NXCException
Get collected table 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
instance - instance value
dataColumn - name of column to retrieve data from
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

clearCollectedData

public void clearCollectedData(long nodeId,
                               long dciId)
                        throws java.io.IOException,
                               NXCException
Clear collected data for given DCI

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

getThresholds

public Threshold[] getThresholds(long nodeId,
                                 long dciId)
                          throws java.io.IOException,
                                 NXCException
Get list of thresholds configured for given DCI

Parameters:
nodeId - Node object ID
dciId - DCI ID
Returns:
List of configured thresholds
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

resolveDciNames

public java.lang.String[] resolveDciNames(long[] nodeIds,
                                          long[] dciIds)
                                   throws java.io.IOException,
                                          NXCException
Resolve names of given DCIs

Parameters:
nodeIds - node identifiers
dciIds - DCI identifiers (length must match length of node identifiers list)
Returns:
array of resolved DCI names
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

resolveDciNames

public java.lang.String[] resolveDciNames(java.util.Collection<ConditionDciInfo> dciList)
                                   throws java.io.IOException,
                                          NXCException
Resolve names of given DCIs

Parameters:
dciList - DCI list
Returns:
array of resolved DCI names
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

queryParameter

public java.lang.String queryParameter(long nodeId,
                                       int origin,
                                       java.lang.String name)
                                throws java.io.IOException,
                                       NXCException
Query parameter immediately. This call will cause server to do actual call to managed node and will return current value for given parameter. Result is not cached.

Parameters:
nodeId - node object ID
origin - parameter's origin (NetXMS agent, SNMP, etc.)
name - parameter's name
Returns:
current parameter's value
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

queryAgentTable

public Table queryAgentTable(long nodeId,
                             java.lang.String name)
                      throws java.io.IOException,
                             NXCException
Query agent's table immediately. This call will cause server to do actual call to managed node and will return current value for given table. Result is not cached.

Parameters:
nodeId - node object ID
name - table's name
Returns:
current table's value
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,
                         AccessListElement[] 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

setReportDefinition

public void setReportDefinition(long objectId,
                                java.lang.String definition)
                         throws java.io.IOException,
                                NXCException
Change report's definition (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

setReportDefinition

public void setReportDefinition(long objectId,
                                java.io.File file)
                         throws java.io.FileNotFoundException,
                                java.io.IOException,
                                NXCException
Change report's definition (wrapper for modifyObject())

Throws:
java.io.FileNotFoundException - if given file does not exist or is inaccessible
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

changeObjectZone

public void changeObjectZone(long objectId,
                             long zoneId)
                      throws java.io.IOException,
                             NXCException
Move object to different zone. Only nodes and clusters can be moved between zones.

Parameters:
objectId - Node or cluster object ID
zoneId -
Throws:
java.io.IOException
NXCException

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

applyTemplate

public void applyTemplate(long templateId,
                          long nodeId)
                   throws java.io.IOException,
                          NXCException
Apply data collection template to node.

Parameters:
templateId - template 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

addClusterNode

public void addClusterNode(long clusterId,
                           long nodeId)
                    throws java.io.IOException,
                           NXCException
Add node to cluster.

Parameters:
clusterId - cluster 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

removeClusterNode

public void removeClusterNode(long clusterId,
                              long nodeId)
                       throws java.io.IOException,
                              NXCException
Remove node from cluster.

Parameters:
clusterId - cluster 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

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

wakeupNode

public void wakeupNode(long objectId)
                throws java.io.IOException,
                       NXCException
Wakeup node by sending wake-on-LAN magic packet. Either node ID or interface ID may be given. If node ID is given, system will send wakeup packets to all active interfaces with IP address.

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

getNodePhysicalComponents

public PhysicalComponent getNodePhysicalComponents(long nodeId)
                                            throws java.io.IOException,
                                                   NXCException
Get node's physical components (obtained from ENTITY-MIB).

Parameters:
nodeId - node object identifier
Returns:
root component
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

holdServerJob

public void holdServerJob(long jobId)
                   throws java.io.IOException,
                          NXCException
Put server job on hold

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

unholdServerJob

public void unholdServerJob(long jobId)
                     throws java.io.IOException,
                            NXCException
Put server on hold job to pending state

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

saveEventProcessingPolicy

public void saveEventProcessingPolicy(EventProcessingPolicy epp)
                               throws java.io.IOException,
                                      NXCException
Save event processing policy. If policy was not previously open by current session exception will be thrown.

Parameters:
epp - Modified 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

syncEventTemplates

public void syncEventTemplates()
                        throws java.io.IOException,
                               NXCException
Synchronize event templates configuration. After call to this method session object will maintain internal 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

getCachedEventTemplates

public EventTemplate[] getCachedEventTemplates()
Get cached list event templates

Returns:
List of event templates cached by client library

findEventTemplateByCode

public EventTemplate findEventTemplateByCode(long code)
Find event template by code in event template database internally maintained by session object. You must call NXCSession.syncEventTemplates() first to make local copy of event template database.

Parameters:
code - Event code
Returns:
Event template object or null if not found

findMultipleEventTemplates

public java.util.List<EventTemplate> findMultipleEventTemplates(java.lang.Long[] codes)
Find multiple event templates by event codes in event template database internally maintained by session object. You must call NXCSession.syncEventTemplates() first to make local copy of event template database.

Parameters:
codes - List of event codes
Returns:
List of found event templates

findMultipleEventTemplates

public java.util.List<EventTemplate> findMultipleEventTemplates(long[] codes)
Find multiple event templates by event codes in event template database internally maintained by session object. You must call NXCSession.syncEventTemplates() first to make local copy of event template database.

Parameters:
codes - List of event codes
Returns:
List of found event templates

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

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

sendEvent

public void sendEvent(long eventCode,
                      java.lang.String eventName,
                      long objectId,
                      java.lang.String[] parameters,
                      java.lang.String userTag)
               throws java.io.IOException,
                      NXCException
Send event to server. Event can be identified either by event code or event name. If event name is given, event code will be ignored. Node: sending events by name supported by server version 1.1.8 and higher.

Parameters:
eventCode - event code. Ignored if event name is not null.
eventName - event name. Must be set to null if event identified by code.
objectId - Object ID to send event on behalf of. If set to 0, server will determine object ID by client IP address.
parameters - event's parameters
userTag - event's user tag
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

sendEvent

public void sendEvent(long eventCode,
                      java.lang.String[] parameters)
               throws java.io.IOException,
                      NXCException
Convenience wrapper for sendEvent interface.

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

sendEvent

public void sendEvent(java.lang.String eventName,
                      java.lang.String[] parameters)
               throws java.io.IOException,
                      NXCException
Convenience wrapper for sendEvent interface.

Parameters:
eventName - event name
parameters - event's parameters
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

getAgentConfig

public java.lang.String getAgentConfig(long nodeId)
                                throws java.io.IOException,
                                       NXCException
Get agent's master configuration file.

Parameters:
nodeId - Node ID
Returns:
Master configuration file of agent running on given node
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

updateAgentConfig

public void updateAgentConfig(long nodeId,
                              java.lang.String config,
                              boolean apply)
                       throws java.io.IOException,
                              NXCException
Update agent's master configuration file.

Parameters:
nodeId - Node ID
config - New configuration file content
apply - Apply flag - if set to true, agent will restart automatically to apply changes
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getSupportedParameters

public java.util.List<AgentParameter> getSupportedParameters(long nodeId)
                                                      throws java.io.IOException,
                                                             NXCException
Get list of parameters supported by agent running on given node.

Parameters:
nodeId - Node ID
Returns:
List of parameters supported by agent
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getDataCollectionEvents

public long[] getDataCollectionEvents(long objectId)
                               throws java.io.IOException,
                                      NXCException
Get all events used in data collection by given node, cluster, or template obejct.

Parameters:
objectId - node, cluster, or template object ID
Returns:
list of used event codes
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

exportConfiguration

public java.lang.String exportConfiguration(java.lang.String description,
                                            long[] events,
                                            long[] traps,
                                            long[] templates)
                                     throws java.io.IOException,
                                            NXCException
Export server configuration. Returns requested configuration elements exported into XML.

Parameters:
description - Description of exported configuration
events - List of event codes
traps - List of trap identifiers
templates - List of template object identifiers
Returns:
resulting XML document
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

importConfiguration

public void importConfiguration(java.lang.String config,
                                int flags)
                         throws java.io.IOException,
                                NXCException
Import server configuration (events, traps, thresholds) from XML

Parameters:
config - Configuration in XML format
flags - Import flags
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getServerStats

public java.util.Map<java.lang.String,java.lang.Object> getServerStats()
                                                                throws java.io.IOException,
                                                                       NXCException
Get server stats. Returns set of named properties. The following properties could be found in result set: String: VERSION Integer: UPTIME, SESSION_COUNT, DCI_COUNT, OBJECT_COUNT, NODE_COUNT, PHYSICAL_MEMORY_USED, VIRTUAL_MEMORY_USED, QSIZE_CONDITION_POLLER, QSIZE_CONF_POLLER, QSIZE_DCI_POLLER, QSIZE_DBWRITER, QSIZE_EVENT, QSIZE_DISCOVERY, QSIZE_NODE_POLLER, QSIZE_ROUTE_POLLER, QSIZE_STATUS_POLLER, ALARM_COUNT long[]: ALARMS_BY_SEVERITY

Returns:
Server stats as set of named properties.
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getActions

public java.util.List<ServerAction> getActions()
                                        throws java.io.IOException,
                                               NXCException
Get list of configured actions from server

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

createAction

public long createAction(java.lang.String name)
                  throws java.io.IOException,
                         NXCException
Create new server action.

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

modifyAction

public void modifyAction(ServerAction action)
                  throws java.io.IOException,
                         NXCException
Modify server action

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

deleteAction

public void deleteAction(long actionId)
                  throws java.io.IOException,
                         NXCException
Delete server action

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

getObjectTools

public java.util.List<ObjectTool> getObjectTools()
                                          throws java.io.IOException,
                                                 NXCException
Get list of configured object tools

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

getObjectToolDetails

public ObjectToolDetails getObjectToolDetails(long toolId)
                                       throws java.io.IOException,
                                              NXCException
Get object tool details

Parameters:
toolId - Tool ID
Returns:
Object tool details
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

generateObjectToolId

public long generateObjectToolId()
                          throws java.io.IOException,
                                 NXCException
Generate unique ID for new object tool.

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

modifyObjectTool

public void modifyObjectTool(ObjectToolDetails tool)
                      throws java.io.IOException,
                             NXCException
Modify object tool.

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

deleteObjectTool

public void deleteObjectTool(long toolId)
                      throws java.io.IOException,
                             NXCException
Delete object tool.

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

executeTableTool

public Table executeTableTool(long toolId,
                              long nodeId)
                       throws java.io.IOException,
                              NXCException
Execute object tool of "table" type against given node.

Parameters:
toolId - Tool ID
nodeId - Node object ID
Returns:
Table with tool execution results
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

executeServerCommand

public void executeServerCommand(long objectId,
                                 java.lang.String command)
                          throws java.io.IOException,
                                 NXCException
Execute server command related to given object (usually defined as object tool)

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

getSnmpTrapsConfigurationSummary

public java.util.List<SnmpTrap> getSnmpTrapsConfigurationSummary()
                                                          throws java.io.IOException,
                                                                 NXCException
Get summary of SNMP trap mapping. Trap configurations returned without parameter mapping.

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

getSnmpTrapsConfiguration

public java.util.List<SnmpTrap> getSnmpTrapsConfiguration()
                                                   throws java.io.IOException,
                                                          NXCException
Get list of configured SNMP traps

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

createSnmpTrapConfiguration

public long createSnmpTrapConfiguration()
                                 throws java.io.IOException,
                                        NXCException
Create new trap configuration record.

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

deleteSnmpTrapConfiguration

public void deleteSnmpTrapConfiguration(long trapId)
                                 throws java.io.IOException,
                                        NXCException
Delete SNMP trap configuration record from server.

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

modifySnmpTrapConfiguration

public void modifySnmpTrapConfiguration(SnmpTrap trap)
                                 throws java.io.IOException,
                                        NXCException
Modify SNMP trap configuration record.

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

getMibFileTimestamp

public java.util.Date getMibFileTimestamp()
                                   throws java.io.IOException,
                                          NXCException
Get timestamp of server's MIB file.

Returns:
Timestamp of server's MIB file
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

downloadMibFile

public java.io.File downloadMibFile()
                             throws java.io.IOException,
                                    NXCException
Download MIB file from server.

Returns:
file handle for temporary file on local file system
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getPredefinedGraphs

public java.util.List<GraphSettings> getPredefinedGraphs()
                                                  throws java.io.IOException,
                                                         NXCException
Get list of predefined graphs.

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

modifyPredefinedGraph

public long modifyPredefinedGraph(GraphSettings graph)
                           throws java.io.IOException,
                                  NXCException
Create or modify predefined graph. If graph ID in GraphSettings object set to 0, new predefined graph will be created on server, and ID assigned to it will be returned.

Parameters:
graph - predefined graph configuration
Returns:
ID of predefined graph object
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deletePredefinedGraph

public void deletePredefinedGraph(long graphId)
                           throws java.io.IOException,
                                  NXCException
Delete predefined graph.

Parameters:
graphId - predefined graph object ID
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getScriptLibrary

public java.util.List<Script> getScriptLibrary()
                                        throws java.io.IOException,
                                               NXCException
Specified by:
getScriptLibrary in interface ScriptLibraryManager
Throws:
java.io.IOException
NXCException

getScript

public Script getScript(long scriptId)
                 throws java.io.IOException,
                        NXCException
Specified by:
getScript in interface ScriptLibraryManager
Throws:
java.io.IOException
NXCException

modifyScript

public long modifyScript(long scriptId,
                         java.lang.String name,
                         java.lang.String source)
                  throws java.io.IOException,
                         NXCException
Specified by:
modifyScript in interface ScriptLibraryManager
Throws:
java.io.IOException
NXCException

renameScript

public void renameScript(long scriptId,
                         java.lang.String name)
                  throws java.io.IOException,
                         NXCException
Specified by:
renameScript in interface ScriptLibraryManager
Throws:
java.io.IOException
NXCException

deleteScript

public void deleteScript(long scriptId)
                  throws java.io.IOException,
                         NXCException
Specified by:
deleteScript in interface ScriptLibraryManager
Throws:
java.io.IOException
NXCException

isConnected

public boolean isConnected()

Specified by:
isConnected in interface Session

findConnectionPoint

public ConnectionPoint findConnectionPoint(long objectId)
                                    throws java.io.IOException,
                                           NXCException
Find connection point (either directly connected or most close known interface on a switch) for given node or interface object. Will return null if connection point information cannot be found.

Parameters:
objectId - Node or interface object ID
Returns:
connection point information or null
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

findConnectionPoint

public ConnectionPoint findConnectionPoint(MacAddress macAddr)
                                    throws java.io.IOException,
                                           NXCException
Find connection point (either directly connected or most close known interface on a switch) for given MAC address. Will return null if connection point information cannot be found.

Parameters:
macAddr - MAC address
Returns:
connection point information or null
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

findConnectionPoint

public ConnectionPoint findConnectionPoint(int zoneId,
                                           java.net.InetAddress ipAddr)
                                    throws java.io.IOException,
                                           NXCException
Find connection point (either directly connected or most close known interface on a switch) for given IP address. Will return null if connection point information cannot be found.

Parameters:
zoneId - zone ID
ipAddr - IP address to find
Returns:
connection point information or null
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

checkConnection

public void checkConnection()
                     throws java.io.IOException,
                            NXCException
Specified by:
checkConnection in interface Session
Throws:
java.io.IOException
NXCException

getImageLibrary

public java.util.List<LibraryImage> getImageLibrary()
                                             throws java.io.IOException,
                                                    NXCException
Specified by:
getImageLibrary in interface ImageLibraryManager
Throws:
java.io.IOException
NXCException

getImageLibrary

public java.util.List<LibraryImage> getImageLibrary(java.lang.String category)
                                             throws java.io.IOException,
                                                    NXCException
Specified by:
getImageLibrary in interface ImageLibraryManager
Throws:
java.io.IOException
NXCException

getImage

public LibraryImage getImage(java.util.UUID guid)
                      throws java.io.IOException,
                             NXCException
Specified by:
getImage in interface ImageLibraryManager
Throws:
java.io.IOException
NXCException

createImage

public LibraryImage createImage(LibraryImage image,
                                ProgressListener listener)
                         throws java.io.IOException,
                                NXCException
Specified by:
createImage in interface ImageLibraryManager
Throws:
java.io.IOException
NXCException

deleteImage

public void deleteImage(LibraryImage image)
                 throws java.io.IOException,
                        NXCException
Specified by:
deleteImage in interface ImageLibraryManager
Throws:
java.io.IOException
NXCException

modifyImage

public void modifyImage(LibraryImage image,
                        ProgressListener listener)
                 throws java.io.IOException,
                        NXCException
Specified by:
modifyImage in interface ImageLibraryManager
Throws:
java.io.IOException
NXCException

pollNode

public void pollNode(long nodeId,
                     int pollType,
                     NodePollListener listener)
              throws java.io.IOException,
                     NXCException
Perform a forced node poll. This method will not return until poll is complete, so it's advised to run it from separate thread. For each message received from poller listener's method onPollerMessage will be called.

Parameters:
nodeId - node object ID
pollType - poll type (defined in org.netxms.client.constants.NodePoller)
listener - listener
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getSituations

public java.util.List<Situation> getSituations()
                                        throws java.io.IOException,
                                               NXCException
Get list of all configured situations

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

createSituation

public long createSituation(java.lang.String name,
                            java.lang.String comments)
                     throws java.io.IOException,
                            NXCException
Create new situation object.

Parameters:
name - name for new situation object
comments - comments for new situation object
Returns:
id assigned to created situation object
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

modifySituation

public void modifySituation(long id,
                            java.lang.String name,
                            java.lang.String comments)
                     throws java.io.IOException,
                            NXCException
Modify situation object.

Parameters:
id - situation id
name - new name or null to leave unchanged
comments - new comments or null to leave unchanged
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deleteSituation

public void deleteSituation(long id)
                     throws java.io.IOException,
                            NXCException
Delete situation object

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

deleteSituationInstance

public void deleteSituationInstance(long id,
                                    java.lang.String instance)
                             throws java.io.IOException,
                                    NXCException
Delete situation instance

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

listServerFiles

public ServerFile[] listServerFiles()
                             throws java.io.IOException,
                                    NXCException
List files in server's file store.

Returns:
list of files in server's file store
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

uploadFileToAgent

public long uploadFileToAgent(long nodeId,
                              java.lang.String serverFileName,
                              java.lang.String remoteFileName,
                              boolean jobOnHold)
                       throws java.io.IOException,
                              NXCException
Start file upload from server's file store to agent. Returns ID of upload job.

Parameters:
nodeId - node object ID
serverFileName - file name in server's file store
remoteFileName - fully qualified file name on target system or null to upload file to agent's file store
jobOnHold - if true, upload job will be created in "hold" status
Returns:
ID of upload job
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

uploadFileToServer

public void uploadFileToServer(java.io.File localFile,
                               java.lang.String serverFileName,
                               ProgressListener listener)
                        throws java.io.IOException,
                               NXCException
Upload local file to server's file store

Parameters:
localFile - local file
serverFileName - name under which file will be stored on server
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

downloadFileFromAgent

public java.io.File downloadFileFromAgent(long nodeId,
                                          java.lang.String remoteFileName)
                                   throws java.io.IOException,
                                          NXCException
Download file from remote host via agent.

Parameters:
nodeId - node object ID
remoteFileName - fully qualified file name on remote system
Returns:
handle to local copy of remote file
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deleteServerFile

public void deleteServerFile(java.lang.String serverFileName)
                      throws java.io.IOException,
                             NXCException
Delete file from server's file store

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

openConsole

public void openConsole()
                 throws java.io.IOException,
                        NXCException
Open server console.

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

closeConsole

public void closeConsole()
                  throws java.io.IOException,
                         NXCException
Close server console.

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

processConsoleCommand

public boolean processConsoleCommand(java.lang.String command)
                              throws java.io.IOException,
                                     NXCException
Process console command on server. Output of the command delivered via console listener.

Parameters:
command - command to process
Returns:
true if console should be closed (usually after "exit" command)
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

isServerConsoleConnected

public boolean isServerConsoleConnected()
Returns:
the serverConsoleConnected

snmpWalk

public void snmpWalk(long nodeId,
                     java.lang.String rootOid,
                     SnmpWalkListener listener)
              throws java.io.IOException,
                     NXCException
Do SNMP walk. Operation will start at given root object, and callback will be called one or more times as data will come from server. This method will exit only when walk operation is complete.

Parameters:
nodeId - node object ID
rootOid - root SNMP object ID (as text)
listener - listener
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getVlans

public java.util.List<VlanInfo> getVlans(long nodeId)
                                  throws java.io.IOException,
                                         NXCException
Get list of VLANs configured on given node

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

isObjectsSynchronized

public boolean isObjectsSynchronized()
Returns:
the objectsSynchronized

executeReport

public long executeReport(long reportId,
                          java.util.Map<java.lang.String,java.lang.String> parameters)
                   throws java.io.IOException,
                          NXCException
Execute report.

Parameters:
reportId - report object ID
parameters - report parameters
Returns:
job ID
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getReportResults

public java.util.List<ReportResult> getReportResults(long reportId)
                                              throws java.io.IOException,
                                                     NXCException
Get list of report execution results. Results returned are ready for rendering.

Parameters:
reportId - report object ID
Returns:
list of report execution results
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

deleteReportResults

public void deleteReportResults(long reportId,
                                java.util.Collection<java.lang.Long> resultIdList)
                         throws java.io.IOException,
                                NXCException
Delete report execution results. Logged in user must have CONTROL access right on report object to perform this operation.

Parameters:
reportId - report object ID
resultIdList - result identifiers to be deleted
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

renderReport

public java.io.File renderReport(long jobId,
                                 ReportRenderFormat format)
                          throws java.io.IOException,
                                 NXCException
Render report into desired format

Parameters:
jobId -
Returns:
report's File object
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getAddressList

public java.util.List<IpAddressListElement> getAddressList(int listId)
                                                    throws java.io.IOException,
                                                           NXCException
Get address list.

Parameters:
list - list identifier (defined in NXCSession as ADDRESS_LIST_xxx)
Returns:
address list
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

setAddressList

public void setAddressList(int listId,
                           java.util.List<IpAddressListElement> list)
                    throws java.io.IOException,
                           NXCException
Set content of address list.

Parameters:
listId - list ID
list - new list content
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

resetServerComponent

public void resetServerComponent(int component)
                          throws java.io.IOException,
                                 NXCException
Reset server's internal component (defined by SERVER_COMPONENT_xxx)

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

getNetworkPath

public NetworkPath getNetworkPath(long node1,
                                  long node2)
                           throws java.io.IOException,
                                  NXCException
Get IPv4 network path between two nodes. Server will return path based on cached routing table information. Network path object may be incomplete if server does not have enough information to build full path. In this case, no exception thrown, and completness of path can be checked by calling NetworkPath.isComplete().

Parameters:
node1 - source node
node2 - destination node
Returns:
network path object
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

removePackage

public void removePackage(long packageId)
                   throws java.io.IOException,
                          NXCException
Remove agent package from server

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

installPackage

public long installPackage(PackageInfo info,
                           java.io.File pkgFile,
                           ProgressListener listener)
                    throws java.io.IOException,
                           NXCException
Install (upload) package on server

Parameters:
info - package information
pkgFile - package file
listener - progress listener (may be null)
Returns:
unique ID assigned to package
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getInstalledPackages

public java.util.List<PackageInfo> getInstalledPackages()
                                                 throws java.io.IOException,
                                                        NXCException
Get list of installed packages

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

deployPackage

public void deployPackage(long packageId,
                          java.lang.Long[] nodeList,
                          PackageDeploymentListener listener)
                   throws java.io.IOException,
                          NXCException
Deploy agent packages onto given nodes

Parameters:
packageId - package ID
nodeList - list of nodes
listener - deployment progress listener (may be null)
Throws:
java.io.IOException - if socket or file I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

lockPackageDatabase

public void lockPackageDatabase()
                         throws java.io.IOException,
                                NXCException
Lock package database

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

unlockPackageDatabase

public void unlockPackageDatabase()
                           throws java.io.IOException,
                                  NXCException
Unlock package database

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

sendSMS

public void sendSMS(java.lang.String phoneNumber,
                    java.lang.String message)
             throws java.io.IOException,
                    NXCException
Send SMS via server. User should have appropriate rights to execute this command.

Parameters:
phoneNumber - target phone number
message - message text
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

pushDciData

public void pushDciData(DciPushData[] data)
                 throws java.io.IOException,
                        NXCException
Push data to server.

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

pushDciData

public void pushDciData(long nodeId,
                        long dciId,
                        java.lang.String value)
                 throws java.io.IOException,
                        NXCException
Push value for single DCI.

Parameters:
nodeId - node ID
dciId - DCI ID
value - value to push
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

pushDciData

public void pushDciData(java.lang.String nodeName,
                        java.lang.String dciName,
                        java.lang.String value)
                 throws java.io.IOException,
                        NXCException
Push value for single DCI.

Parameters:
nodeName - node name
dciName - DCI name
value - value to push
Throws:
java.io.IOException - if socket I/O error occurs
NXCException - if NetXMS server returns an error or operation was timed out

getClientType

public int getClientType()
Returns:
the clientType

setClientType

public void setClientType(int clientType)
Set client type. Can be one of the following: DESKTOP_CLIENT WEB_CLIENT MOBILE_CLIENT TABLET_CLIENT APPLICATION_CLIENT Must be called before connect(), otherwise will not have any effect. Ignored by servers prior to 1.2.2.

Parameters:
clientType - the clientType to set

getDateFormat

public java.lang.String getDateFormat()
Specified by:
getDateFormat in interface Session

getTimeFormat

public java.lang.String getTimeFormat()
Specified by:
getTimeFormat in interface Session

handover

public void handover(NXCSession target)
Handover object cache to new session. After call to this method, object cache of this session invalidated and should not be used.

Parameters:
target - target session object


Copyright © 2012. All Rights Reserved.