Solution_
- the solution type, the class with the PlanningSolution
annotationpublic abstract class SolverFactory<Solution_> extends Object
Solver
instances.
To build an instance, use createFromXmlResource(String)
or any of the other creation methods.
Supports tweaking the configuration programmatically before a Solver
instance is build.
Constructor and Description |
---|
SolverFactory() |
Modifier and Type | Method and Description |
---|---|
abstract Solver<Solution_> |
buildSolver()
Creates a new
Solver instance. |
abstract SolverFactory<Solution_> |
cloneSolverFactory()
Build a
SolverFactory quickly (without parsing XML) that builds the exact same Solver
with buildSolver() , but can also be modified with getSolverConfig() to build a different
Solver without affecting the original SolverFactory . |
static <Solution_> |
createEmpty()
Useful to build configuration programmatically, although it's almost always recommended
to instead load a partial configuration with
createFromXmlResource(String)
and configure the remainder programmatically with getSolverConfig() . |
static <Solution_> |
createEmpty(ClassLoader classLoader)
See
createEmpty() . |
static <Solution_> |
createEmptyFromKieContainer(org.kie.api.runtime.KieContainer kieContainer) |
static <Solution_> |
createEmptyFromKieContainer(org.kie.api.builder.ReleaseId releaseId) |
static <Solution_> |
createFromKieContainerXmlResource(org.kie.api.runtime.KieContainer kieContainer,
String solverConfigResource) |
static <Solution_> |
createFromKieContainerXmlResource(org.kie.api.builder.ReleaseId releaseId,
String solverConfigResource) |
static <Solution_> |
createFromKieContainerXmlResource(String solverConfigResource)
Uses
KieServices.getKieClasspathContainer() . |
static <Solution_> |
createFromXmlFile(File solverConfigFile) |
static <Solution_> |
createFromXmlFile(File solverConfigFile,
ClassLoader classLoader) |
static <Solution_> |
createFromXmlInputStream(InputStream in) |
static <Solution_> |
createFromXmlInputStream(InputStream in,
ClassLoader classLoader) |
static <Solution_> |
createFromXmlReader(Reader reader) |
static <Solution_> |
createFromXmlReader(Reader reader,
ClassLoader classLoader) |
static <Solution_> |
createFromXmlResource(String solverConfigResource) |
static <Solution_> |
createFromXmlResource(String solverConfigResource,
ClassLoader classLoader)
|
abstract SolverConfig |
getSolverConfig()
Allows you to programmatically change the
SolverConfig at runtime before building the Solver . |
public static <Solution_> SolverFactory<Solution_> createFromKieContainerXmlResource(String solverConfigResource)
KieServices.getKieClasspathContainer()
.solverConfigResource
- never null, a classpath resource in the KieContainer
as defined by ClassLoader.getResource(String)
public static <Solution_> SolverFactory<Solution_> createFromKieContainerXmlResource(org.kie.api.builder.ReleaseId releaseId, String solverConfigResource)
releaseId
- never nullsolverConfigResource
- never null, a classpath resource in the KieContainer
as defined by ClassLoader.getResource(String)
public static <Solution_> SolverFactory<Solution_> createFromKieContainerXmlResource(org.kie.api.runtime.KieContainer kieContainer, String solverConfigResource)
kieContainer
- never nullsolverConfigResource
- never null, a classpath resource in the KieContainer
as defined by ClassLoader.getResource(String)
public static <Solution_> SolverFactory<Solution_> createFromXmlResource(String solverConfigResource)
solverConfigResource
- never null, a classpath resource
as defined by ClassLoader.getResource(String)
public static <Solution_> SolverFactory<Solution_> createFromXmlResource(String solverConfigResource, ClassLoader classLoader)
solverConfigResource
- never null, a classpath resource
as defined by ClassLoader.getResource(String)
classLoader
- sometimes null, the ClassLoader
to use for loading all resources and Class
es,
null to use the default ClassLoader
public static <Solution_> SolverFactory<Solution_> createFromXmlFile(File solverConfigFile)
solverConfigFile
- never nullpublic static <Solution_> SolverFactory<Solution_> createFromXmlFile(File solverConfigFile, ClassLoader classLoader)
solverConfigFile
- never nullclassLoader
- sometimes null, the ClassLoader
to use for loading all resources and Class
es,
null to use the default ClassLoader
public static <Solution_> SolverFactory<Solution_> createFromXmlInputStream(InputStream in)
in
- never null, gets closedpublic static <Solution_> SolverFactory<Solution_> createFromXmlInputStream(InputStream in, ClassLoader classLoader)
in
- never null, gets closedclassLoader
- sometimes null, the ClassLoader
to use for loading all resources and Class
es,
null to use the default ClassLoader
public static <Solution_> SolverFactory<Solution_> createFromXmlReader(Reader reader)
reader
- never null, gets closedpublic static <Solution_> SolverFactory<Solution_> createFromXmlReader(Reader reader, ClassLoader classLoader)
reader
- never null, gets closedclassLoader
- sometimes null, the ClassLoader
to use for loading all resources and Class
es,
null to use the default ClassLoader
public static <Solution_> SolverFactory<Solution_> createEmpty()
createFromXmlResource(String)
and configure the remainder programmatically with getSolverConfig()
.public static <Solution_> SolverFactory<Solution_> createEmpty(ClassLoader classLoader)
createEmpty()
.classLoader
- sometimes null, the ClassLoader
to use for loading all resources and Class
es,
null to use the default ClassLoader
public static <Solution_> SolverFactory<Solution_> createEmptyFromKieContainer(org.kie.api.builder.ReleaseId releaseId)
releaseId
- never nullpublic static <Solution_> SolverFactory<Solution_> createEmptyFromKieContainer(org.kie.api.runtime.KieContainer kieContainer)
kieContainer
- never nullpublic abstract SolverConfig getSolverConfig()
SolverConfig
at runtime before building the Solver
.
This method is not thread-safe. To configure a SolverConfig
differently for parallel requests,
build a template SolverFactory
from XML
and clone it cloneSolverFactory()
for each request, before before calling this method.
public abstract SolverFactory<Solution_> cloneSolverFactory()
SolverFactory
quickly (without parsing XML) that builds the exact same Solver
with buildSolver()
, but can also be modified with getSolverConfig()
to build a different
Solver
without affecting the original SolverFactory
.SolverFactory
subclass implementation than this instanceCopyright © 2006–2018 JBoss by Red Hat. All rights reserved.