JASMI API

com.agentpp.smi
Interface IRepository

All Known Implementing Classes:
SMIRepository

public interface IRepository

This interfaces specifies methods for MIB repositories.

Since:
1.8.1
Version:
1.8.1
Author:
Frank Fock

Method Summary
 void addObject(IObject object)
          Adds an IObject to the MIB repository.
 java.util.Vector getChildren(IObject object)
          Gets the children of a given object.
 java.util.Vector getChildren(IObjectID oid)
          Gets the children of an object given by its object ID.
 java.util.Vector getChildren(java.lang.String objectName)
          Gets the children of an object given by its name.
 java.util.Vector getDescendants(IObject object)
          Gets the descendants of a given object.
 ITextualConvention getEffectiveSyntax(ISyntax syntax)
          Get the effective syntax for a given ISyntax.
 IModule getModule(java.lang.String moduleName)
          Gets a MIB module with a given name.
 java.util.Vector getModuleNames()
          Gets a Vector of module names of this MIB repository.
 java.util.Enumeration getModulesSortedByName()
          Gets an Enumeration of all modules sorted by name.
 java.util.Vector getNonOidObjects(boolean textualConventionsOnly)
          Get all objects in the repository that do not have an object identifier.
 IObject getObject(IObjectID oid)
          Gets an IObject with a given object ID.
 IObject getObject(java.lang.String name)
          Gets a MIB object with a given name.
 IObject getObject(java.lang.String moduleName, java.lang.String name)
          Gets the MIB object with a given name from a given module.
 IObject getObjectByOID(java.lang.String oid)
          Gets an IObject with a given object ID string.
 IObjectType getObjectClass(java.lang.String oid)
          Gets the object class OBJECT-TYPE definition for the supplied instance OID.
 java.util.Vector getObjectClassOID(java.lang.String oid)
          Gets the class OID of a given instance OID and the corresponding instance suffix.
 IObjectID getObjectID(java.lang.String name)
          Gets the object ID for a given name.
 IObjectID getObjectID(java.lang.String moduleName, java.lang.String name)
          Gets the object ID for a given name.
 java.lang.String getObjectName(IObjectID oid)
          Gets the object name for a given object ID.
 IObject[] getObjectsByName(java.lang.String name)
          Gets all objects with a given name.
 IObject[] getObjectsByOid(IObjectID oid)
          Gets all objects with a given OID.
 IObject[] getObjectsByOid(java.lang.String oid)
          Gets all objects with a given OID string.
 IObject getParent(IObject object)
          Gets the parent MIBObject for a given object
 java.lang.String getPath(IObjectID oid, boolean withID)
          Get the object name path for a given object ID.
 java.lang.String getPath(java.lang.String oid, boolean withID)
          Get the object name path for a given object ID.
 IObjectID makeObjectID(java.lang.String dottedString)
          Creates an IObjectID from a dotted string or object name path.
 int moduleCount()
          Return the number of modules in the MIB repository.
 java.util.Enumeration modules()
          Deprecated. Use modulesIterator() instead.
 java.util.Iterator modulesIterator()
          Returns an Iterator of all modules.
 java.util.Enumeration objects()
          Returns an Enumeration of all objects.
 java.util.Enumeration objectsByName()
          Returns an Enumeration of all objects ordered by name.
 java.util.Iterator objectsOrderedByOccurance()
          Returns an Iterator on the objects contained in this module ordered by their occurance in the original (compiled) MIB module.
 java.lang.String printModule(java.lang.String moduleName)
          Return the SMI definition of a given module.
 void remove(IModule module)
          Remove an IModule including its content from the MIB repository.
 boolean removeModule(java.lang.String moduleName)
          Removes a MIB module given by its module name.
 void removeObject(IObject object)
          Removes the given object from the MIB repository.
 int size()
          Return the size of the repository.
 void structureChanged()
          This method should always called when the structure of the repository has been changed (i.e., a MIB module has been added or MIB objects have been added or deleted).
 

Method Detail

size

int size()
Return the size of the repository. The size is equal to the count of MIBObjects returned by the objects() enumeration.

Returns:
the size of the repository

moduleCount

int moduleCount()
Return the number of modules in the MIB repository.

Returns:
the MIB module count.

addObject

void addObject(IObject object)
Adds an IObject to the MIB repository. Modules should be added before their objects are added, otherwise, after adding all objects, structureChanged() must be called to ensure, that the modules know about their objects.

Parameters:
object - an IObject instance.

getObjectName

java.lang.String getObjectName(IObjectID oid)
Gets the object name for a given object ID.

Parameters:
oid - an object identifier.
Returns:
an object name associated with the given object ID. Note, that there may be more than one name associated with the same object ID. In that case it is undefined which name is returned. If the given object ID could not be found, null is returned.

getObjectID

IObjectID getObjectID(java.lang.String name)
Gets the object ID for a given name.

Parameters:
name - an object name.
Returns:
an object ID associated with the given object name. Note, that there may be more than one object ID associated with the same object name, because it is allowed in SMI to use the same name for different objects within different modules. In that case it is not defined which ID is returned. If the given object name could not be found, null is returned.

getObjectID

IObjectID getObjectID(java.lang.String moduleName,
                      java.lang.String name)
Gets the object ID for a given name.

Parameters:
moduleName - the name of the MIB module to search for the object ID.
name - an object name.
Returns:
an object ID associated with the given object name. If the given object name could not be found in the MIB module moduleName, null is returned.

getObject

IObject getObject(java.lang.String moduleName,
                  java.lang.String name)
Gets the MIB object with a given name from a given module.

Parameters:
moduleName - a module name.
name - the object's name.
Returns:
an IObject instance if the requested object could be found, or null otherwise.

getChildren

java.util.Vector getChildren(java.lang.String objectName)
Gets the children of an object given by its name.

Parameters:
objectName - an object name.
Returns:
a possibly empty Vector of children if the object could be found, or null otherwise.

getChildren

java.util.Vector getChildren(IObjectID oid)
Gets the children of an object given by its object ID.

Parameters:
oid - an IObjectID instance.
Returns:
a possibly empty Vector of children.

getChildren

java.util.Vector getChildren(IObject object)
Gets the children of a given object.

Parameters:
object - an IObject instance.
Returns:
a possibly empty Vector of children.

getDescendants

java.util.Vector getDescendants(IObject object)
Gets the descendants of a given object. Thus, all objects in the subtree of the given object are returned.

Parameters:
object - an IObject instance.
Returns:
a possibly empty Vector of children.

getParent

IObject getParent(IObject object)
Gets the parent MIBObject for a given object

Parameters:
object - an IObject instance.
Returns:
an IObject instance if there exists an object with an object ID that matches the object ID object without its last sub-identifier. In any other case null is returned.

getObjectsByName

IObject[] getObjectsByName(java.lang.String name)
Gets all objects with a given name.

Parameters:
name - an object name.
Returns:
a possibly empty array of IObject instances.

getObjectsByOid

IObject[] getObjectsByOid(IObjectID oid)
Gets all objects with a given OID.

Parameters:
oid - an IObjectID instance.
Returns:
a possibly empty array of IObject instances.

getObjectsByOid

IObject[] getObjectsByOid(java.lang.String oid)
Gets all objects with a given OID string.

Parameters:
oid - an OID string with numerical subidentifiers.
Returns:
a possibly empty array of IObject instances.

remove

void remove(IModule module)
Remove an IModule including its content from the MIB repository.

Parameters:
module - an IModule instance.

removeObject

void removeObject(IObject object)
Removes the given object from the MIB repository.

Parameters:
object - an IObject instance.

removeModule

boolean removeModule(java.lang.String moduleName)
Removes a MIB module given by its module name. The contents of the module is removed too.

Parameters:
moduleName - a module name.
Returns:
true if the module could be removed, false otherwise.

getModule

IModule getModule(java.lang.String moduleName)
Gets a MIB module with a given name.

Parameters:
moduleName - a module name.
Returns:
an IModule instance if such an instance could be found, null otherwise.

getObject

IObject getObject(java.lang.String name)
Gets a MIB object with a given name.

Parameters:
name - an object name, for example "sysDescr" or "SNMPv2-MIB.sysDescr".
Returns:
an IObject instance if such an instance could be found, null otherwise.

getObject

IObject getObject(IObjectID oid)
Gets an IObject with a given object ID.

Parameters:
oid - an IObjectID.
Returns:
an IObject instance if such an instance could be found, null otherwise.

getObjectByOID

IObject getObjectByOID(java.lang.String oid)
Gets an IObject with a given object ID string.

Parameters:
oid - an OID string with numerical subidentifiers.
Returns:
an IObject instance if such an instance could be found, null otherwise.

modules

java.util.Enumeration modules()
Deprecated. Use modulesIterator() instead.

Returns an Enumeration of all modules.

Returns:
an Enumeration of IModule instances.

modulesIterator

java.util.Iterator modulesIterator()
Returns an Iterator of all modules.

Returns:
an Enumeration of IModule instances.
Since:
2.5

getModulesSortedByName

java.util.Enumeration getModulesSortedByName()
Gets an Enumeration of all modules sorted by name.

Returns:
an Enumeration of IModule instances.

getModuleNames

java.util.Vector getModuleNames()
Gets a Vector of module names of this MIB repository.

Returns:
a Vector of Strings.

objects

java.util.Enumeration objects()
Returns an Enumeration of all objects.

Returns:
an Enumeration of IObject instances.

objectsByName

java.util.Enumeration objectsByName()
Returns an Enumeration of all objects ordered by name.

Returns:
an Enumeration of IObject instances.

objectsOrderedByOccurance

java.util.Iterator objectsOrderedByOccurance()
Returns an Iterator on the objects contained in this module ordered by their occurance in the original (compiled) MIB module.

Returns:
an Iterator on the MIB objects of this module.

structureChanged

void structureChanged()
This method should always called when the structure of the repository has been changed (i.e., a MIB module has been added or MIB objects have been added or deleted).


getPath

java.lang.String getPath(IObjectID oid,
                         boolean withID)
Get the object name path for a given object ID. For example, an object ID "1.3.6.1" will return "iso.org.dod.internet".

Parameters:
oid - an IObjectID instance to convert.
withID - if true after each name, the corresponding sub-identifier will be returned, for example "1.3.6.1" will return "iso(1).org(3).dod(6).internet(1)".

getPath

java.lang.String getPath(java.lang.String oid,
                         boolean withID)
Get the object name path for a given object ID. For example, an object ID "1.3.6.1" will return "iso.org.dod.internet".

Parameters:
oid - a numerical OID string to convert.
withID - if true after each name, the corresponding sub-identifier will be returned, for example "1.3.6.1" will return "iso(1).org(3).dod(6).internet(1)".

getNonOidObjects

java.util.Vector getNonOidObjects(boolean textualConventionsOnly)
Get all objects in the repository that do not have an object identifier. These objects are likely to be textual conventions and SMIv1 MIB modules.

Parameters:
textualConventionsOnly - if true only ITextualConvention instances are returned.
Returns:
a vector of IObject instances.

printModule

java.lang.String printModule(java.lang.String moduleName)
Return the SMI definition of a given module.

Parameters:
moduleName - a module name.
Returns:
the SMI definition of the module.

makeObjectID

IObjectID makeObjectID(java.lang.String dottedString)
Creates an IObjectID from a dotted string or object name path.

Parameters:
dottedString - a dotted String, for example "1.3.6.1.2" or "iso.org.dod.internet".
Returns:
an IObjectID. If a non-numerical OID string cannot be resolved, then null will be returned.

getEffectiveSyntax

ITextualConvention getEffectiveSyntax(ISyntax syntax)
Get the effective syntax for a given ISyntax. The effective syntax is the base syntax with possibly additional range restrictions or enumerations.

Parameters:
syntax - a ISyntax instance.
Returns:
a ITextualConvention instance containing a ISyntax instance possibly indentical to 'syntax' and, if available, a display hint String. If 'syntax' is not of type SMI.SYN_CONVENTION or if its base syntax cannot be determined, then syntax is returned.

getObjectClassOID

java.util.Vector getObjectClassOID(java.lang.String oid)
Gets the class OID of a given instance OID and the corresponding instance suffix. For example, for "1.3.6.1.2.1.1.1.0" it will return "1.3.6.1.2.1.1.1" and "0".

Parameters:
oid - a dotted String.
Returns:
a Vector of two elements. The first contains the object class OID as a dotted String with numerical sub-identifiers, if the object class could be determined by the information in the repository (otherwise the first element will be null). The second element contains the instance OID suffix as a dotted numerical String. If the object class is null, then the second element is identical to oid.

getObjectClass

IObjectType getObjectClass(java.lang.String oid)
Gets the object class OBJECT-TYPE definition for the supplied instance OID. If the object type for the instance OID cannot be determined, null is returned. See also getObjectClassOID(String oid).

Parameters:
oid - the instance OID as a dotted String.
Returns:
the OBJECT-TYPE definition of the corresponding MIB object if it can be determined, otherwise null is returned.

JASMI API

JASMI 3
Copyright 2001-2010 Frank Fock
All Rights Reserved