Package org.kie.dmn.core.compiler
Class DMNCompilerImpl
- java.lang.Object
-
- org.kie.dmn.core.compiler.DMNCompilerImpl
-
- All Implemented Interfaces:
org.kie.dmn.api.core.DMNCompiler
public class DMNCompilerImpl extends Object implements org.kie.dmn.api.core.DMNCompiler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDMNCompilerImpl.AfterProcessDrgElementsstatic classDMNCompilerImpl.PMMLImportErrConsumer
-
Constructor Summary
Constructors Constructor Description DMNCompilerImpl()DMNCompilerImpl(org.kie.dmn.api.core.DMNCompilerConfiguration dmnCompilerConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCallback(DMNCompilerImpl.AfterProcessDrgElements callback)org.kie.dmn.api.core.DMNModelcompile(Reader source, Collection<org.kie.dmn.api.core.DMNModel> dmnModels)org.kie.dmn.api.core.DMNModelcompile(Reader source, Collection<org.kie.dmn.api.core.DMNModel> dmnModels, org.kie.api.io.Resource resource)org.kie.dmn.api.core.DMNModelcompile(org.kie.api.io.Resource resource, Collection<org.kie.dmn.api.core.DMNModel> dmnModels)org.kie.dmn.api.core.DMNModelcompile(org.kie.dmn.model.api.Definitions dmndefs, Collection<org.kie.dmn.api.core.DMNModel> dmnModels)org.kie.dmn.api.core.DMNModelcompile(org.kie.dmn.model.api.Definitions dmndefs, Collection<org.kie.dmn.api.core.DMNModel> dmnModels, org.kie.api.io.Resource resource, Function<String,Reader> relativeResolver)org.kie.dmn.api.core.DMNModelcompile(org.kie.dmn.model.api.Definitions dmndefs, org.kie.api.io.Resource resource, Collection<org.kie.dmn.api.core.DMNModel> dmnModels)org.kie.dmn.api.core.DMNCompilerConfigurationgetDmnCompilerConfig()DMNDecisionLogicCompilergetEvaluatorCompiler()static StringgetId(org.kie.dmn.model.api.DMNElementReference er)For the purpose of Compilation, in the DMNModel the DRGElements are stored with their full ID, so an ElementReference might reference in two forms: - #id (a local to the model ID) - namespace#id (an imported DRGElement ID) This method now returns in the first case the proper ID, while leave unchanged in the latter case, in order for the ID to be reconciliable on the DMNModel.org.kie.dmn.api.marshalling.DMNMarshallergetMarshaller()static QNamegetNamespaceAndName(org.kie.dmn.model.api.DMNModelInstrumentedBase localElement, Map<String,QName> importAliases, QName typeRef, String modelNamespace)Given a typeRef in the form of prefix:localname or importalias.localname, resolves namespace and localname appropriately.List<org.kie.dmn.api.marshalling.DMNExtensionRegister>getRegisteredExtensions()voidlinkRequirements(DMNModelImpl model, DMNBaseNode node)protected static URLpmmlImportURL(ClassLoader classLoader, DMNModelImpl model, org.kie.dmn.model.api.Import i, org.kie.dmn.model.api.DMNModelInstrumentedBase node)protected static org.kie.api.io.ResourceresolveRelativeResource(ClassLoader classLoader, DMNModelImpl model, org.kie.dmn.model.api.Import i, org.kie.dmn.model.api.DMNModelInstrumentedBase node, Function<String,Reader> relativeResolver)protected static URIresolveRelativeURI(DMNModelImpl model, String relative)org.kie.dmn.api.core.DMNTyperesolveTypeRef(DMNModelImpl dmnModel, org.kie.dmn.model.api.NamedElement model, org.kie.dmn.model.api.DMNModelInstrumentedBase localElement, QName typeRef)Resolve the QName typeRef accordingly to definition of builtin (FEEL) types, local model ItemDef or imported definitions.
-
-
-
Method Detail
-
compile
public org.kie.dmn.api.core.DMNModel compile(org.kie.api.io.Resource resource, Collection<org.kie.dmn.api.core.DMNModel> dmnModels)- Specified by:
compilein interfaceorg.kie.dmn.api.core.DMNCompiler
-
compile
public org.kie.dmn.api.core.DMNModel compile(Reader source, Collection<org.kie.dmn.api.core.DMNModel> dmnModels)
- Specified by:
compilein interfaceorg.kie.dmn.api.core.DMNCompiler
-
compile
public org.kie.dmn.api.core.DMNModel compile(Reader source, Collection<org.kie.dmn.api.core.DMNModel> dmnModels, org.kie.api.io.Resource resource)
-
getMarshaller
public org.kie.dmn.api.marshalling.DMNMarshaller getMarshaller()
-
compile
public org.kie.dmn.api.core.DMNModel compile(org.kie.dmn.model.api.Definitions dmndefs, Collection<org.kie.dmn.api.core.DMNModel> dmnModels)- Specified by:
compilein interfaceorg.kie.dmn.api.core.DMNCompiler
-
compile
public org.kie.dmn.api.core.DMNModel compile(org.kie.dmn.model.api.Definitions dmndefs, org.kie.api.io.Resource resource, Collection<org.kie.dmn.api.core.DMNModel> dmnModels)- Specified by:
compilein interfaceorg.kie.dmn.api.core.DMNCompiler
-
compile
public org.kie.dmn.api.core.DMNModel compile(org.kie.dmn.model.api.Definitions dmndefs, Collection<org.kie.dmn.api.core.DMNModel> dmnModels, org.kie.api.io.Resource resource, Function<String,Reader> relativeResolver)
-
resolveRelativeResource
protected static org.kie.api.io.Resource resolveRelativeResource(ClassLoader classLoader, DMNModelImpl model, org.kie.dmn.model.api.Import i, org.kie.dmn.model.api.DMNModelInstrumentedBase node, Function<String,Reader> relativeResolver)
-
pmmlImportURL
protected static URL pmmlImportURL(ClassLoader classLoader, DMNModelImpl model, org.kie.dmn.model.api.Import i, org.kie.dmn.model.api.DMNModelInstrumentedBase node)
-
resolveRelativeURI
protected static URI resolveRelativeURI(DMNModelImpl model, String relative) throws URISyntaxException, IOException
- Throws:
URISyntaxExceptionIOException
-
addCallback
public void addCallback(DMNCompilerImpl.AfterProcessDrgElements callback)
-
linkRequirements
public void linkRequirements(DMNModelImpl model, DMNBaseNode node)
-
getId
public static String getId(org.kie.dmn.model.api.DMNElementReference er)
For the purpose of Compilation, in the DMNModel the DRGElements are stored with their full ID, so an ElementReference might reference in two forms: - #id (a local to the model ID) - namespace#id (an imported DRGElement ID) This method now returns in the first case the proper ID, while leave unchanged in the latter case, in order for the ID to be reconciliable on the DMNModel.
-
resolveTypeRef
public org.kie.dmn.api.core.DMNType resolveTypeRef(DMNModelImpl dmnModel, org.kie.dmn.model.api.NamedElement model, org.kie.dmn.model.api.DMNModelInstrumentedBase localElement, QName typeRef)
Resolve the QName typeRef accordingly to definition of builtin (FEEL) types, local model ItemDef or imported definitions. If the typeRef cannot be resolved, (FEEL) UNKNOWN is returned and an error logged using standard DMN message logging.
-
getNamespaceAndName
public static QName getNamespaceAndName(org.kie.dmn.model.api.DMNModelInstrumentedBase localElement, Map<String,QName> importAliases, QName typeRef, String modelNamespace)
Given a typeRef in the form of prefix:localname or importalias.localname, resolves namespace and localname appropriately.
Example:feel:stringwould be resolved ashttp://www.omg.org/spec/FEEL/20140401, string.
Example:myimport.tPersonassuming an external model namespace as "http://drools.org" would be resolved ashttp://drools.org, tPerson.- Parameters:
localElement- the local element is used to determine the namespace from the prefix if present, as in the form prefix:localnameimportAliases- the map of import aliases is used to determine the namespace, as in the form importalias.localnametypeRef- the typeRef to be resolved.- Returns:
-
getDmnCompilerConfig
public org.kie.dmn.api.core.DMNCompilerConfiguration getDmnCompilerConfig()
-
getRegisteredExtensions
public List<org.kie.dmn.api.marshalling.DMNExtensionRegister> getRegisteredExtensions()
-
getEvaluatorCompiler
public DMNDecisionLogicCompiler getEvaluatorCompiler()
-
-