Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.drools.builder.help
Class KnowledgeBuilderHelper

    java.lang.Object
      org.drools.builder.help.KnowledgeBuilderHelper

    public class KnowledgeBuilderHelper

extends Object

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
`KnowledgeBuilderHelper()`

Method Summary
`static String[]` | `addXsdModel(Resource resource, KnowledgeBuilder kbuilder, Options xjcOpts, String systemId)` Generates pojos for a given XSD using XJC and adds them to the specified KnowlegeBase.
`static DroolsJaxbHelperProvider` | `getDroolsJaxbHelperProvider()`
`static javax.xml.bind.JAXBContext` | `newJAXBContext(String[] classNames, KnowledgeBase kbase)` Creates a new JAXBContext, from which the Marshaller and Unmarshaller can be created, which are used by the Transformer pipeline stage.
`static javax.xml.bind.JAXBContext` | `newJAXBContext(String[] classNames, Map<String,?> properties, KnowledgeBase kbase)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### KnowledgeBuilderHelper

    public KnowledgeBuilderHelper()

Method Detail

### addXsdModel

    public static String[] addXsdModel(Resource resource,
                                       KnowledgeBuilder kbuilder,
                                       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 model
    `kbuilder` - the KnowledgeBuilder where the generated .class files will be placed
    `xjcOpts` - XJC Options
    `systemId` - XJC systemId
  Returns:
    Returns an array of class names that where generated by the XSD.
  Throws:
    `IOException`

### newJAXBContext

    public static javax.xml.bind.JAXBContext newJAXBContext(String[] classNames,
                                                            KnowledgeBase kbase)
                                                     throws javax.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 JAXBContext
    `properties` - JAXB properties
    `kbase` - The KnowledgeBase
  Returns:
    The JAXB Context
  Throws:
    `javax.xml.bind.JAXBException`

### newJAXBContext

    public static javax.xml.bind.JAXBContext newJAXBContext(String[] classNames,
                                                            Map<String,?> properties,
                                                            KnowledgeBase kbase)
                                                     throws javax.xml.bind.JAXBException

  Throws:
    `javax.xml.bind.JAXBException`

### getDroolsJaxbHelperProvider

    public static DroolsJaxbHelperProvider getDroolsJaxbHelperProvider()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.