Package com.snmp4j.smi
Interface SmiCompiler
- All Known Implementing Classes:
SmiManager
public interface SmiCompiler
The SmiCompiler provides a simple yet complete interface to check, compile,
store, and load MIB files content (i.e., MIB modules).
- Since:
- 1.4
- Author:
- Frank Fock
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
The OverwriteMode defines whether existing MIB modules should be overwritten or not.static class
The Strictness defines the number of syntax checks done on the sources.static class
The TargetMode defines the target for the compiled MIB modules. -
Method Summary
Modifier and TypeMethodDescriptioncompile(NamedInputStream[] files, CompilationMonitor compilationMonitor, SmiCompiler.TargetMode compilerTargetMode, SmiCompiler.OverwriteMode overwriteMode, SmiCompiler.Strictness strictness)
Compiles an array of text or ZIP files provided asNamedInputStream
s.
-
Method Details
-
compile
List<CompilationResult> compile(NamedInputStream[] files, CompilationMonitor compilationMonitor, SmiCompiler.TargetMode compilerTargetMode, SmiCompiler.OverwriteMode overwriteMode, SmiCompiler.Strictness strictness) throws IOExceptionCompiles an array of text or ZIP files provided asNamedInputStream
s. The compilation is executed in three phases:- The provided
NamedInputStream
s are loaded into memory. - The loaded files are analyzed about their module names and then sorted according to their dependencies to other modules.
- The sorted MIB modules will then be compiled and written into the internal MIB repository. In addition, if enabled, the compiled MIB modules will also be loaded into the MIB cache.
CompilationMonitor
interface.- Parameters:
files
- an array ofNamedInputStream
instances where each instance may represent a text or ZIP file.compilationMonitor
- an optionalCompilationMonitor
implementation to monitor the progress of the compilation.compilerTargetMode
- with the modeSmiCompiler.TargetMode.storeIntoRepositoryAndLoad
the compiled MIB modules will not only be stored into the internal MIB repository, but also directly loaded into the MIB cache so that they can be used right after this method call completes. WithSmiCompiler.TargetMode.dryRun
no modifications to the MIB repository or MIB cache are done and only the result of the syntax check is returned.overwriteMode
- specifies whether compiled MIB modules will replace existing MIB modules in the MIB repository as well as in the cache with the same module names or not.strictness
- ifSmiCompiler.Strictness.lenient
is used then syntax and semantic checks are limited to the necessary minimum. A MIB module that can be successfully parsed in lenient mode may contain severe standard violations and even errors that can affect proper formatting and value parsing support for SNMP4J. Use this option only if you can handle the risk or if you are not able to fix or let fix the errors in the MIB specification(s).- Returns:
- a List of
CompilationResult
instances. Each instance represents an input file. For ZIP files, aCompilationResult
instance is returned for each ZIP file entry. - Throws:
IOException
- if any IO operation fails when accessing the inputfiles
(InputStream
s).- Since:
- 1.4
- The provided
-