|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.percederberg.mibble.MibLoader
A MIB file loader. This class contains a search path for locating MIB files, and also holds a refererence to previously loaded MIB files to avoid loading the same file multiple times. The MIB search path consists of directories with MIB files that can be imported into another MIB. If an import isn't found in the search path, the default IANA and IETF MIB directories are searched. Note that these files are normally stored as resources together with the compiled code.
The MIB loader is not thread-safe, i.e. it cannot be used concurrently in multiple threads.
Constructor Summary | |
MibLoader()
Creates a new MIB loader. |
Method Summary | |
void |
addAllDirs(java.io.File dir)
Adds a directory and all subdirectories to the MIB search path. |
void |
addDir(java.io.File dir)
Adds a directory to the MIB search path. |
void |
addDirs(java.io.File[] dirs)
Adds directories to the MIB search path. |
void |
addResourceDir(java.lang.String dir)
Adds a directory to the MIB resource search path. |
Mib[] |
getAllMibs()
Returns all previously loaded MIB files. |
MibContext |
getDefaultContext()
Returns the default MIB context. |
Mib |
getMib(java.io.File file)
Returns a previously loaded MIB file. |
Mib |
getMib(java.lang.String name)
Returns a previously loaded MIB file. |
Mib |
load(java.io.File file)
Loads a MIB file. |
Mib |
load(java.io.Reader input)
Loads a MIB file from the specified input reader. |
Mib |
load(java.lang.String name)
Loads a MIB file with the specified base name. |
Mib |
load(java.net.URL url)
Loads a MIB file from the specified URL. |
void |
removeAllDirs()
Removes all directories from the MIB search path. |
void |
removeAllResourceDirs()
Removes all directories from the MIB resource search path. |
void |
removeDir(java.io.File dir)
Removes a directory from the MIB search path. |
void |
removeResourceDir(java.lang.String dir)
Removes a directory from the MIB resource search path. |
void |
reset()
Resets this loader. |
void |
unload(java.io.File file)
Unloads a MIB. |
void |
unload(Mib mib)
Unloads a MIB. |
void |
unload(java.lang.String name)
Unloads a MIB. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MibLoader()
Method Detail |
public void addDir(java.io.File dir)
dir
- the directory to addpublic void addDirs(java.io.File[] dirs)
dirs
- the directories to addpublic void addAllDirs(java.io.File dir)
dir
- the directory to addpublic void removeDir(java.io.File dir)
dir
- the directory to removepublic void removeAllDirs()
public void addResourceDir(java.lang.String dir)
dir
- the resource directory to addpublic void removeResourceDir(java.lang.String dir)
dir
- the resource directory to removepublic void removeAllResourceDirs()
public void reset()
public MibContext getDefaultContext()
public Mib getMib(java.lang.String name)
name
- the MIB (module) name
public Mib getMib(java.io.File file)
file
- the MIB file
public Mib[] getAllMibs()
public Mib load(java.lang.String name) throws java.io.IOException, MibLoaderException
name
- the MIB name (filename without extension)
java.io.IOException
- if the MIB file couldn't be found in the
MIB search path
MibLoaderException
- if the MIB file couldn't be loaded
correctlypublic Mib load(java.io.File file) throws java.io.IOException, MibLoaderException
file
- the MIB file
java.io.IOException
- if the MIB file couldn't be read
MibLoaderException
- if the MIB file couldn't be loaded
correctlypublic Mib load(java.net.URL url) throws java.io.IOException, MibLoaderException
url
- the URL containing the MIB
java.io.IOException
- if the MIB URL couldn't be read
MibLoaderException
- if the MIB file couldn't be loaded
correctlypublic Mib load(java.io.Reader input) throws java.io.IOException, MibLoaderException
input
- the input stream containing the MIB
java.io.IOException
- if the input stream couldn't be read
MibLoaderException
- if the MIB file couldn't be loaded
correctlypublic void unload(java.lang.String name) throws MibLoaderException
name
- the MIB name
MibLoaderException
- if the MIB couldn't be unloaded
due to dependencies from other loaded MIBsreset()
public void unload(java.io.File file) throws MibLoaderException
file
- the MIB file
MibLoaderException
- if the MIB couldn't be unloaded
due to dependencies from other loaded MIBsreset()
public void unload(Mib mib) throws MibLoaderException
mib
- the MIB
MibLoaderException
- if the MIB couldn't be unloaded
due to dependencies from other loaded MIBsreset()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |