public class FeatureOptimizer extends Object
SOAR-O
) public API for building Features. .fo
files) for the very Kernel on which it is executed. Then
the .fo
file can be dynamically linked using ej.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 and Description |
---|
FeatureOptimizer(KernelMetadataProvider kernelMetadataProvider)
Creates a new
FeatureOptimizer instance with the given Kernel metadata provider. |
Modifier and Type | Method and Description |
---|---|
void |
build(InputStream fsoFile,
OutputStream foFile)
Builds a Feature (
.fo file) for this Kernel from a shared Feature (.fso file). |
byte[] |
getKernelUID()
Gets the Kernel UID of the loaded Kernel metadata.
|
public FeatureOptimizer(KernelMetadataProvider kernelMetadataProvider) throws FeatureOptimizerException
FeatureOptimizer
instance 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.
kernelMetadataProvider
- the Kernel metadata provider.FeatureOptimizerException
- if the Kernel metadata cannot be loaded.public void build(InputStream fsoFile, OutputStream foFile) throws FeatureOptimizerException
.fo
file) for this Kernel from a shared Feature (.fso
file).
This methods blocks until the Feature .fo
file is fully generated and flushed to the given output
stream. An error may be thrown while the output stream is partially written.
fsoFile
- the input stream for the loaded shared Feature (.fso
file).foFile
- the output stream for the generated Feature (.fo
file).FeatureOptimizerException
- if the Feature cannot be built on this Kernel.public byte[] getKernelUID()