public class NCSpringModelFactory extends Object implements NCModelFactory
NCModel
s to the Spring Framework.
This factory requires one of the following configuration properties:
Configuration
annotation
probe.conf
from Names example
using Spring-based factory:
nlpcraft { probe { id = "names" token = "3141592653589793" upLink = "localhost:8201" # Server to probe data pipe. downLink = "localhost:8202" # Probe to server data pipe. jarsFolder = null models = [ "org.nlpcraft.examples.names.NamesModel" ] modelFactory = { type = "org.nlpcraft.model.factories.spring.NCSpringModelFactory" properties = { javaConfig = "org.nlpcraft.examples.names.NamesConfig" } } lifecycle = [ ] resultMaxSizeBytes = 1048576 } nlpEngine = "opennlp" versionCheckDisable = false }
Lines 10-15 specify data model factory and its configuration properties.
Modifier and Type | Field and Description |
---|---|
static String |
JAVA_CONFIG_PROP
Configuration property for Java Config-based Spring configuration.
|
static String |
XML_CONFIG_PROP
Configuration property for XML-based Spring configuration.
|
Constructor and Description |
---|
NCSpringModelFactory() |
Modifier and Type | Method and Description |
---|---|
void |
initialize(Map<String,String> props)
Initializes this factory with properties specified in probe configuration.
|
NCModel |
mkModel(Class<? extends NCModel> claxx)
Constructs a model instance.
|
void |
terminate()
Terminates this factory when probe stops.
|
public static final String JAVA_CONFIG_PROP
public static final String XML_CONFIG_PROP
public void initialize(Map<String,String> props)
NCModelFactory
initialize
in interface NCModelFactory
props
- Configuration properties.public NCModel mkModel(Class<? extends NCModel> claxx)
NCModelFactory
mkModel
in interface NCModelFactory
claxx
- Model type.public void terminate()
NCModelFactory
terminate
in interface NCModelFactory
Copyright © 2020 NLPCraft. All rights reserved.