NvdmAPI
Class NvdmObject

java.lang.Object
  extended byNvdmAPI.NvdmObject

public class NvdmObject
extends java.lang.Object

Class representing an object (i.e., class instance) in the Radia database.

Version:
1.0, 6-Oct-2002
Author:
Lothar Baum

Constructor Summary
NvdmObject(java.lang.String file, java.lang.String dom, java.lang.String clss, java.lang.String inst)
          Creates a new (empty) object.
 
Method Summary
 void add(NvdmVariable var)
          Adds a variable to the object.
 void dump(java.io.PrintStream where)
          Dumps the contents of the object to a stream.
 java.lang.String getClss()
          Returns the class name this object was created for.
 java.lang.String getClssFriendly()
          Returns the friendly (long) class name for this object.
 java.lang.String getDate()
          Returns the datestamp for this object.
 java.lang.String getDomain()
          Returns the domain name this object was created for.
 java.lang.String getFile()
          Returns the file name this object was created for.
 java.lang.String getName()
          Returns the instance name of this object.
 int getRC()
          Returns the error code of the operation that created this object.
 java.lang.String getTime()
          Returns the timestamp for this object.
 NvdmVariable getVariable(int index)
          Returns a variable of this object.
 NvdmVariable getVariable(java.lang.String varName)
          Returns a variable of this object.
 NvdmVariable getVariable(java.lang.String varName, int relIdx)
          Returns a variable of this object.
 int getVariableCount()
          Returns the number of variables in this object.
 java.lang.String getVariableDataString(java.lang.String varName)
          Returns the actual value of the specified variable.
 java.util.Enumeration getVariables()
          Returns an Enumeration of the currently contained variables.
 boolean isOk()
          Tests if operation completed successfully.
 int updateVariable(java.lang.String varName, int relIdx, java.lang.String varValue)
          Modifies the actual value of a variable.
 int updateVariable(java.lang.String varName, java.lang.String varValue)
          Modifies the actual value of a variable.
 boolean variableExists(java.lang.String varName)
          Checks for the existence of a variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NvdmObject

public NvdmObject(java.lang.String file,
                  java.lang.String dom,
                  java.lang.String clss,
                  java.lang.String inst)
Creates a new (empty) object. The storage location in the Radia database is specified by file, dom, clss, and inst, where inst is the object's short instance name (unique, maximum of 32 characters).

Parameters:
file - the file
dom - the domain
clss - the class
inst - the instance name
Method Detail

add

public void add(NvdmVariable var)
Adds a variable to the object. The NvdmVariable to be added must be defined as an attribute of the corresponding class in the Radia database (note that this method does not change the class definition!).

Parameters:
var - the variable to be added

getName

public java.lang.String getName()
Returns the instance name of this object. The instance name is the 32 character short name.

Returns:
instance name of this object

getClss

public java.lang.String getClss()
Returns the class name this object was created for.

Returns:
class name the object was created for

getClssFriendly

public java.lang.String getClssFriendly()
Returns the friendly (long) class name for this object.

Returns:
friendly (long) name of this object's class

getFile

public java.lang.String getFile()
Returns the file name this object was created for.

Returns:
file name the object was created for

getDomain

public java.lang.String getDomain()
Returns the domain name this object was created for.

Returns:
domain name the object was created for

getTime

public java.lang.String getTime()
Returns the timestamp for this object. The format is hh:mm:ss (h=hour, m=minute, s=second).

Returns:
the timestamp for this object

getDate

public java.lang.String getDate()
Returns the datestamp for this object. The format is yyyymmdd (y=year, m=month, d=day).

Returns:
the datestamp for this object

getRC

public int getRC()
Returns the error code of the operation that created this object.

Returns:
0 if successful, or an error code > 0 (see RTE.getErrorText)

isOk

public boolean isOk()
Tests if operation completed successfully. Basically a shortcut for testing getRC to be 0.

Returns:
true if object could successfully be retrieved from RCS, false in the case of an error

getVariables

public java.util.Enumeration getVariables()
Returns an Enumeration of the currently contained variables. The result enumerates NvdmVariable objects. If the object was read from the Radia database, the enumeration will also contain variables usually hidden by the Radia System Explorer (e.g., ZOBJDATE and ZOBJTIME).

Returns:
Enumeration of NvdmVariable objects

updateVariable

public int updateVariable(java.lang.String varName,
                          java.lang.String varValue)
Modifies the actual value of a variable. The variable must be existing for this object (i.e., either be manually added to the object or already read from the Radia database) and must be defined as an attribute of this object's class. The new value of the variable must fit into the space reserved for this attribute.
If the class defines more than one attribute with this varName (e.g., for _ALWAYS_ connections, the first variable found will be modified. If you need to specifically address another variable of that name, use the updateVariable method with the relIdx attribute.

Parameters:
varName - name of the variable (max. 8 characters)
varValue - the new value of the variable
Returns:
0 if successful, or an error code > 0 (see RTE.getErrorText)

updateVariable

public int updateVariable(java.lang.String varName,
                          int relIdx,
                          java.lang.String varValue)
Modifies the actual value of a variable. The variable must be existing for this object (i.e., either be manually added to the object or already read from the Radia database) and must be defined as an attribute of this object's class. The new value of the variable must fit into the space reserved for this attribute.
The relIdx argument allows to address a specific variable in case the class defines more than one attribute with this varName (e.g., for _ALWAYS_ connections). relIdx specifies the relative index (starting with 0) of the variable in the list of variable with the name varName. For example, to address the 3rd _ALWAYS_ variable, call
	updateVariable("_ALWAYS_", 2, newValue)
	

Parameters:
varName - name of the variable (max. 8 characters)
relIdx - relative index of the variable in the list of variables with the same name
varValue - the new value of the variable
Returns:
0 if successful, or an error code > 0 (see RTE.getErrorText)

getVariable

public NvdmVariable getVariable(int index)
Returns a variable of this object. The desired variable is specified via its index (starting with 1) in the list of variables of this object. Note that if the object has been read from the RCS, this list includes variables that are usually hidden by the Radia System Explorer (such as ZOBJDATE and ZOBJTIME). In case of an error (e.g., if the variable does not exist), an "empty" variable object will be returned which just contains an error code.

Parameters:
index - the index (starting with 1) of the requested variable
Returns:
the requested variable

variableExists

public boolean variableExists(java.lang.String varName)
Checks for the existence of a variable. Note that this check is performed locally on this particular object without any communication with the RCS -- only if the object has previously been read from the Radia database it can be concluded that the specified variable is or is not defined in this object's class.

Parameters:
varName - the variable to be checked
Returns:
true if the variable exists in this object, false if it does not exist

getVariable

public NvdmVariable getVariable(java.lang.String varName)
Returns a variable of this object. The desired variable is specified via its name (max. 8 characters). In case of an error (e.g., if the variable does not exist), an "empty" variable object will be returned which just contains an error code.
If the object's class definition specifies more than one variable with this name (e.g., for _ALWAYS_ connections), the first variable found will be returned. If you need to specifically address another variable of that name, use the getVariable method with the relIdx attribute.

Parameters:
varName - the name of the requested variable
Returns:
the requested variable.

getVariable

public NvdmVariable getVariable(java.lang.String varName,
                                int relIdx)
Returns a variable of this object. The desired variable is specified via its name (max. 8 characters) and a relative index relIdx. relIdx is the index (starting with 0) of the requested variable in the list of variables with the same name. This allows for addressing a specific variable if the object's class definition specifies more than one variable with this name (e.g., for _ALWAYS_ connections).
In case of an error (e.g., if the variable does not exist), an "empty" variable object will be returned which just contains an error code.

Parameters:
varName - the name of the requested variable
relIdx - the relative index (starting with 0) of the variable in the list of variables with the same name
Returns:
the requested variable.

getVariableDataString

public java.lang.String getVariableDataString(java.lang.String varName)
Returns the actual value of the specified variable. This is basically a shortcut for first getting the specified NvdmVariable object and then reading its contents.
The desired variable is specified via its name (max. 8 characters). In case of an error (e.g., if the variable does not exist), an empty string will be returned.
If the object's class definition specifies more than one variable with this name (e.g., for _ALWAYS_ connections), the first variable found will be returned. If you need to specifically address another variable of that name, use the getVariable method with the relIdx attribute and then read this variable's contents via NvdmVariable.getDataString.

Parameters:
varName - the name of the requested variable
Returns:
a text string containing the variable's value (in case of an error, the result will be empty)

getVariableCount

public int getVariableCount()
Returns the number of variables in this object. Note that this number is calculated locally for this particular object without any communication with the RCS -- only if the object has previously been read from the Radia database it can be concluded how many variables are defined in this object's class. Note as well that this number may contain variables usually hidden by the Radia System Explorer (e.g., ZOBJDATE and ZOBJTIME).

Returns:
number of variables contained in this object (0 if none)

dump

public void dump(java.io.PrintStream where)
Dumps the contents of the object to a stream. May be used for debugging purposes to see all contents of this object.

Parameters:
where - the stream where to dump the information