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
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe OverwriteMode defines whether existing MIB modules should be overwritten or not.static enumThe Strictness defines the number of syntax checks done on the sources.static enumThe 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 asNamedInputStreams.
-
Method Details
-
compile
List<CompilationResult> compile(NamedInputStream[] files, CompilationMonitor compilationMonitor, SmiCompiler.TargetMode compilerTargetMode, SmiCompiler.OverwriteMode overwriteMode, SmiCompiler.Strictness strictness) throws IOException Compiles an array of text or ZIP files provided asNamedInputStreams. The compilation is executed in three phases:- The provided
NamedInputStreams 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.
CompilationMonitorinterface.- Parameters:
files- an array ofNamedInputStreaminstances where each instance may represent a text or ZIP file.compilationMonitor- an optionalCompilationMonitorimplementation to monitor the progress of the compilation.compilerTargetMode- with the modeSmiCompiler.TargetMode.storeIntoRepositoryAndLoadthe 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.dryRunno 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.lenientis 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
CompilationResultinstances. Each instance represents an input file. For ZIP files, aCompilationResultinstance is returned for each ZIP file entry. - Throws:
IOException- if any IO operation fails when accessing the inputfiles(InputStreams).- Since:
- 1.4
- The provided
-