Package com.microej.soar
Class FeatureOptimizer
- java.lang.Object
-
- com.microej.soar.FeatureOptimizer
-
public class FeatureOptimizer extends Object
The SOAR Optimizer (akaSOAR-O) public API for building Features.
The SOAR Optimizer allows to build Feature (.fofiles) for the very Kernel on which it is executed. Then the.fofile can be dynamically linked usingej.kf.Kernel.install(InputStream). The Kernel metadata content is loaded and cached on demand. The more a Feature adheres to a Kernel (i.e. depends on various Kernel APIs types, methods and fields), the more this instance will allocate and cache Kernel metadata objects in Java heap.
-
-
Constructor Summary
Constructors Constructor Description FeatureOptimizer(KernelMetadataProvider kernelMetadataProvider)Creates a newFeatureOptimizerinstance with the given Kernel metadata provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuild(InputStream fsoFile, OutputStream foFile)Builds a Feature (.fofile) for this Kernel from a shared Feature (.fsofile).byte[]getKernelUID()Gets the Kernel UID of the loaded Kernel metadata.
-
-
-
Constructor Detail
-
FeatureOptimizer
public FeatureOptimizer(KernelMetadataProvider kernelMetadataProvider) throws FeatureOptimizerException
Creates a newFeatureOptimizerinstance with the given Kernel metadata provider.It loads the Kernel metadata header and checks whether it corresponds to the Kernel on which this method is actually executed.
- Parameters:
kernelMetadataProvider- the Kernel metadata provider.- Throws:
FeatureOptimizerException- if the Kernel metadata cannot be loaded.
-
-
Method Detail
-
build
public void build(InputStream fsoFile, OutputStream foFile) throws FeatureOptimizerException
Builds a Feature (.fofile) for this Kernel from a shared Feature (.fsofile).This methods blocks until the Feature
.fofile is fully generated and flushed to the given output stream. An error may be thrown while the output stream is partially written.- Parameters:
fsoFile- the input stream for the loaded shared Feature (.fsofile).foFile- the output stream for the generated Feature (.fofile).- Throws:
FeatureOptimizerException- if the Feature cannot be built on this Kernel.
-
getKernelUID
public byte[] getKernelUID()
Gets the Kernel UID of the loaded Kernel metadata.- Returns:
- the Kernel UID of the loaded Kernel metadata.
-
-