Package org.kie.internal.builder.help
Class KnowledgeBuilderHelper
java.lang.Object
org.kie.internal.builder.help.KnowledgeBuilderHelper
Provides helper methods for working with JAXB and a Knowledgebase, it takes care of the Classpath issues when
mapping against internal type declarations.
This api is experimental and thus the classes and the interfaces returned are subject to change.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]addXsdModel(Resource resource, KnowledgeBuilder kbuilder, com.sun.tools.xjc.Options xjcOpts, String systemId) Generates pojos for a given XSD using XJC and adds them to the specified KnowlegeBase.static DroolsJaxbHelperProviderstatic jakarta.xml.bind.JAXBContextnewJAXBContext(String[] classNames, Map<String, ?> properties, KieBase kbase) static jakarta.xml.bind.JAXBContextnewJAXBContext(String[] classNames, KieBase kbase) Creates a new JAXBContext, from which the Marshaller and Unmarshaller can be created, which are used by the Transformer pipeline stage.
-
Constructor Details
-
KnowledgeBuilderHelper
public KnowledgeBuilderHelper()
-
-
Method Details
-
addXsdModel
public static String[] addXsdModel(Resource resource, KnowledgeBuilder kbuilder, com.sun.tools.xjc.Options xjcOpts, String systemId) throws IOException Generates pojos for a given XSD using XJC and adds them to the specified KnowlegeBase.Options xjcOpts = new Options(); xjcOpts.setSchemaLanguage( Language.XMLSCHEMA ); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); String[] classNames = KnowledgeBuilderHelper.addXsdModel( ResourceFactory.newClassPathResource( "order.xsd", getClass() ), kbuilder, xjcOpts, "xsd" );- Parameters:
resource- The resource to the XSD modelkbuilder- the KnowledgeBuilder where the generated .class files will be placedxjcOpts- XJC OptionssystemId- XJC systemId- Returns:
- Returns an array of class names that where generated by the XSD.
- Throws:
IOException
-
newJAXBContext
public static jakarta.xml.bind.JAXBContext newJAXBContext(String[] classNames, KieBase kbase) throws jakarta.xml.bind.JAXBException Creates a new JAXBContext, from which the Marshaller and Unmarshaller can be created, which are used by the Transformer pipeline stage.- Parameters:
classNames- An array of class names that can be resolved by this JAXBContextkbase- The KnowledgeBase- Returns:
- The JAXB Context
- Throws:
jakarta.xml.bind.JAXBException
-
newJAXBContext
public static jakarta.xml.bind.JAXBContext newJAXBContext(String[] classNames, Map<String, ?> properties, KieBase kbase) throws jakarta.xml.bind.JAXBException- Throws:
jakarta.xml.bind.JAXBException
-
getDroolsJaxbHelperProvider
-