5.17.5.4 Searching/Retrieving Managed Objects from Database

 



 

Overview

 

An operation that determines the presence of a Managed Object based on certain properties in the database and recovers the same from the database is called Searching and Retrieving of Managed Objects.

 

TopoAPI provides a number of methods for this functionality.

 

Back

 

Searching for Managed Objects in the Database

 

During the operation of searching for Managed Objects in the database, only the keys of the Managed Object would be returned. This operations involves searching of Managed Objects in the database and returns a value which indicates the presence or absence of the Managed Object in the database.

 

A list of the functionality and the methods to perform the same are listed here:

 

Functionality

Method Provided

Searching for Managed Objects based on specific criteria (matching all the criteria listed)

getObjectNamesWithProps(Properties)

Searching for Managed Objects based on specific criteria (option for returning the object keys either matching all the criteria or matching any of the criteria)

getObjectNamesWithProps(Properties,boolean)

Checking for the presence of a Managed Object in the database (returns only a boolean value)

isManagedObjectPresent(String)

 

Sample code snippets are given here illustrating the usage of these methods:

 

Using isManagedObjectPresent(String)

Using getObjectNamesWithProps(Properties)

Using getObjectNamesWithProps(Properties,boolean)

Here, if the second argument specified is true, then keys are returned for objects that match any of the given criteria. If the argument specified is false, then keys are returned for objects which match all of the specified criteria.

 

Note: You can use wild card characters to search for Managed Objects in the database. You can refer to the section Match Criteria Patterns to get to know all the wild card characters that can be used in NMS.

 

Back

 

Retrieving Managed Objects from the Database

 

The objects that have been checked into the database can be fetched by using methods available in the TopoAPI. Here, the Managed Object matching the object key would be returned.

 

A list of functionality and methods used for the same are specified here:

 

Functionality

Method Provided

Retrieving names of all Managed Objects from the database.

getCompleteList()

This method returns a Vector containing the names of all the ManagedObjects in the database.

Retrieves a Managed Object from the database by specifying the object key

getByName(String)

Retrieves a Network Object from the database

getNet(String)

Retrieves a Node Object from the database

getNode(String)

Retrieves an Interface Object from the database

getInterface(String)

 

Sample code snippets are provided here which illustrate the usage of these methods:

 

Using getByName(String)

Using getNet(String)

Using getNode(String)

Using getInterface(String)

All the above methods mentioned for retrieving Managed Objects from the database would return a null, if the specified Managed Object is not present in the database.

 

Back



Copyright © 2011, ZOHO Corp. All Rights Reserved.