![]() |
NvdmAPI
The JavaTM API to Radia Configuration Servers Documentation
Version 1.0.11, 5-May-2005
|
![]() |
General Information
Guide to Features
API: Classes & Methods Version History Compatibility Download NvdmAPI.jar Download Documentation |
Your feedback is highly appreciated! Please send comments, bug reports, and enhancement requests to: lbaum@web.de.
General Information
The NvdmAPI provides a Java-based API to Novadigm Radia Configuration Servers (RCS). It performs basic read / write access to the Radia database from any Java-capable platform. The NvdmAPI provides similar functionality to the Novadigm proprietary Tcl-based API, which is available as part of the Radia Integration Server (RIS) package, and uses the original Novadigm TCP-based protocol also deployed by the Radia System Explorer.
The NvdmAPI offers enhanced performance, a broad availability for any Java-capable platform, and an improved programming experience (higher level data types and abstractions allow you to reduce the amount of coding required to achieve typical tasks).
NvdmAPI uses the Novadigm communication protocol that is used between the Radia System Explorer and the Radia Configuration Server. As this communication protocol is used by Novadigm as the fundamental basis for the overall Radia product suite, it is expected to remain stable with little or few changes in the future, and therefore the NvdmAPI can be expected to provide a stable basis for application programming for quite some time.
NvdmAPI has been written entirely from scratch and does not use or include any Novadigm related or proprietary code. As it is written in completely native Java, it is expected to run on any Java-capable platform version 1.2 and up.
Guide to Features
The NvdmAPI provides basic read / write access to the Radia database via a simple one port TCP connection. In principle, the underlying Novadigm protocol allows any operation on the database, including creation of new classes, domains etc. However, currently only instance related operations are supported by NvdmAPI. These include:
NvdmAPI provides easy to use abstractions to perform the above operations and to build individual functionality on top of these operations. The abstractions include:
- creation of a new instance of an existing class
- update on an existing class instance
- deletion of an existing class instance
- reading an existing class instance
- checking for the existence of a particular class instance
- listing of classes in a particular domain
- listing of instances of a particular class
The NvdmAPI is typically used in three consecutive stages:
- NvdmConnection, the central interface element for establishing a connection to the RCS, setting logging options, and to perform the operations mentioned above
- NvdmObject, the representation of a class instance in the Radia database
- NvdmVariable, the representation of an instance attribute (variable)
- NvdmList, the datastructure holding a list of entities (either class instances or classes)
- NvdmEntity, an abstraction of class instances and classes as being elements of a NvdmList
The following will give simple examples of how to use the NvdmAPI in the different stages (the NvdmConnection object 'rcs' created in the first example is expected to exist with a correctly opened connection throughout all examples). The full API documentation can be found here.
- stage 1: opening the connection, i.e., creation of a NvdmConnection object, setting the logging level, and logging on to the Radia server
- stage 2: performing a sequence of operations on the database
- stage 3: closing the connection
Establishing a connection
import NvdmAPI.*; NvdmConnection rcs; int rc; // create the connection object rcs = new NvdmConnection("15.136.123.255", 3464); // set up logging rcs.setLoggingStream(System.err); rcs.addLoggingLevel(RTE.BUFF); rcs.addLoggingLevel(RTE.OBJC); rcs.addLoggingLevel(RTE.APPL); rcs.addLoggingType(RTE.ERR); rcs.addLoggingType(RTE.INFO); // establish the connection and log in rc = rcs.open(); if ( rc != 0 ) { System.err.println("Error: "+RTE.getErrorText(rc)); System.exit(-1); }
Listing existing classes
Enumeration policyEnum; NvdmList policyList; NvdmEntity policyClass; int rc; // get all classes defined in the POLICY domain policyList = rcs.listClasses("PRIMARY","POLICY","*"); rc = policyList.getRC(); if ( rc != 0 ) { System.err.println("Error reading POLICY classes: "+RTE.getErrorText(rc)); System.exit(-1); } policyEnum = policyList.getEntries(); while ( policyEnum.hasMoreElements() ) { policyClass = (NvdmEntity) policyEnum.nextElement(); System.out.println("class found: "+policyClass.getClss()); }
Listing existing class instances
Enumeration usersEnum; NvdmList usersList; NvdmEntity user; int rc; // get all users/machines set up in the database usersList = rcs.listObjects("PRIMARY","POLICY","USER","*"); rc = usersList.getRC(); if ( rc != 0 ) { System.err.println("Error reading USER instances: "+RTE.getErrorText(rc)); System.exit(-1); } usersEnum = usersList.getEntries(); while ( usersEnum.hasMoreElements() ) { user = (NvdmEntity) usersEnum.nextElement(); System.out.println("instance found: "+user.getInstance()); }
Reading an existing instance
NvdmObject myMachine; NvdmVariable firstConnection; int rc; String userID; String software; // read the object from the database myMachine = rcs.getObject("PRIMARY","POLICY","USER","PC4711"); rc = myMachine.getRC(); if ( rc != 0 ) { System.err.println("Error reading PC4711: "+RTE.getErrorText(rc)); System.exit(-1); } // read the USERID attribute userID = myMachine.getVariableDataString("USERID"); System.out.println("The userID is "+userID); // read the first class connection attribute firstConnection = myMachine.getVariable("_ALWAYS_", 0); software = firstConnection.getDataString(); System.out.println("Assigned software is "+software);
Updating an existing instance
NvdmObject myMachine; int rc; // read the object from the database myMachine = rcs.getObject("PRIMARY","POLICY","USER","PC4711"); rc = myMachine.getRC(); if ( rc != 0 ) { System.err.println("Error reading PC4711: "+RTE.getErrorText(rc)); System.exit(-1); } // update the USERID attribute to 'lbaum' myMachine.updateVariable("USERID", "lbaum"); // write object back to database rc = rcs.updateObject(myMachine); if ( rc != 0 ) { System.err.println("Error updating PC4711: "+RTE.getErrorText(rc)); System.exit(-1); }
Creating a new instance
NvdmObject newMachine; int rc; // create new client-side object newMachine = new NvdmObject("PRIMARY","POLICY","USER","PSPC"); // add variables and their values newMachine.add(new NvdmVariable("USERID", "psmith")); newMachine.add(new NvdmVariable("NAME", "Peter Smith's PC")); newMachine.add(new NvdmVariable("ZTIMEO", "360")); newMachine.add(new NvdmVariable("_ALWAYS_", 0, "SOFTWARE.ZSERVICE.AMORTIZE")); newMachine.add(new NvdmVariable("_ALWAYS_", 1, "SOFTWARE.ZSERVICE.GS-CALC")); rc = rcs.createObject(newMachine); if ( rc != 0 ) { System.err.println("Error creating PSPC: "+RTE.getErrorText(rc)); System.exit(-1); }
Deleting an instance
int rc; // delete instance from database rc = rcs.deleteObject("PRIMARY","POLICY","USER","PSPC"); if ( rc != 0 ) { System.err.println("Error deleting PSPC: "+RTE.getErrorText(rc)); System.exit(-1); }
Checking the existence of an instance
if ( rcs.exists("PRIMARY","POLICY","USER","PSPC") ) System.out.println("instance 'PSPC' exists"); else System.out.println("instance 'PSPC' does not exist");
Closing the connection
int rc; // close connection rc = rcs.close(); if ( rc != 0 ) { System.err.println("Error closing: "+RTE.getErrorText(rc)); System.exit(-1); }
Compatibility
The NvdmAPI is expected to work with:
It has been successfully tested with:
- any 2.x, 3.x, and 4.x Radia Configuration Server
- any Java 1.2 (or higher) client platform
Please report other successful deployments (or bugs etc.) to lbaum@web.de.
- Windows RCS 4.4, 4.4.1, 4.4.2 (Radia 2.x)
- Windows RCS 4.5, 4.5.1, 4.5.2 (Radia 3.x)
- Windows RCS 4.5.3 (Radia 4.x)
- Sun's JDK 1.3 on Windows 2000
- Sun's JDK 1.3.1 on Windows 2000
- MacOS 10.1, 10.1.1 - 10.1.5 Java 1.3
- MacOS 10.2, 10.2.1 Java 1.3.1
- MacOS 10.2.4 - 10.2.6 Java 1.4.1
- MacOS 10.3.0 - 10.3.8 Java 1.4.2
Copyright © 2002/2003/2004/2005 Dr. Lothar Baum, All Rights Reserved. Please send comments, bug reports, and enhancement requests to: lbaum@web.de