# 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 Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `SmiCompiler.OverwriteMode`
  The OverwriteMode defines whether existing MIB modules should be overwritten or not.
  `static enum`
  `SmiCompiler.Strictness`
  The Strictness defines the number of syntax checks done on the sources.
  `static enum`
  `SmiCompiler.TargetMode`
  The TargetMode defines the target for the compiled MIB modules.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<CompilationResult>`
  `compile(NamedInputStream[] files, CompilationMonitor compilationMonitor, SmiCompiler.TargetMode compilerTargetMode, SmiCompiler.OverwriteMode overwriteMode, SmiCompiler.Strictness strictness)`
  Compiles an array of text or ZIP files provided as `NamedInputStream`s.

- ## 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 as `NamedInputStream`s. The compilation is executed in three phases:
    1. The provided `NamedInputStream`s are loaded into memory.
    2. The loaded files are analyzed about their module names and then sorted according to their dependencies to other modules.
    3. 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.
    The compilation progress can be monitored by callbacks through the `CompilationMonitor` interface.
    Parameters:
      `files` - an array of `NamedInputStream` instances where each instance may represent a text or ZIP file.
      `compilationMonitor` - an optional `CompilationMonitor` implementation to monitor the progress of the compilation.
      `compilerTargetMode` - with the mode `SmiCompiler.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. With `SmiCompiler.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` - if `SmiCompiler.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, a `CompilationResult` instance is returned for each ZIP file entry.
    Throws:
      `IOException` - if any IO operation fails when accessing the input `files` (`InputStream`s).
    Since:
      1.4