Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010 JBoss Inc
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.drools.builder;
 
 
 
 import  com.sun.tools.xjc.Options;

This factory is used to build the knowledge base resources that are held collectively in KnowledgePackages. The KnowledgePackage also provides the role of 'namespacing'. An optional KnowlegeBuilderConfiguration can be supplied. The KnowledgeBuilderConfiguration is itself created from this factory. The KnowledgeBuilderConfiguration allows you to set the ClassLoader to be used along with other setting like the default dialect and compiler, as well as many other options.
 KnowledgeBuilder kbuilder = KnowlegeBuilderFactory.newKnowledgeBuilder();
 
 
 public class KnowledgeBuilderFactory {
     private static volatile KnowledgeBuilderFactoryService factoryService;

    
Create and return a new KnowledgeBuilder, using the default KnowledgeBuilderConfigurations

Returns:
The KnowledgeBuilder
 
     public static KnowledgeBuilder newKnowledgeBuilder() {
     }

    
Create and return a new KnowledgeBuilder, using he given KnowledgeBuilderConfigurations

Returns:
The KnowledgeBuilder
 
         return getKnowledgeBuilderServiceFactory().newKnowledgeBuilderconf );
     }
 
     public static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase) {
         return getKnowledgeBuilderServiceFactory().newKnowledgeBuilderkbase );
     }
 
     public static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase,
                                                        KnowledgeBuilderConfiguration conf) {
         return getKnowledgeBuilderServiceFactory().newKnowledgeBuilderkbase,
                                                                   conf );
     }

    
Create a KnowledgeBuilderConfiguration on which properties can be set.

Returns:
The KnowledgeBuilderConfiguration.
 
     }

    
Create a KnowledgeBuilderConfiguration on which properties can be set. Use the given properties file and ClassLoader - either of which can be null.

Returns:
The KnowledgeBuilderConfiguration.
 
                                                                                  ClassLoader... classLoaders) {
                                                                                      classLoaders );
     }

    
DecisionTable resources require a ResourceConfiguration, that configuration instance is created here. Note that if you are passing a Reader, you must use an InputStreamReader so the encoding can be determined.
 KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
 DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration();
 dtconf.setInputType( DecisionTableInputType.XLS );
 dtconf.setWorksheetName( "Tables_2" );
 kbuilder.add( new URL( "file://IntegrationExampleTest.xls" ),
                       ResourceType.DTABLE,
                       dtconf );
 assertFalse( kbuilder.hasErrors() );
 KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
 

Returns:
    }
    public static JaxbConfiguration newJaxbConfiguration(Options xjcOpts,
                                                         String systemId) {
                                                                        systemId);
    }
    
    private static synchronized void setKnowledgeBuilderFactoryService(KnowledgeBuilderFactoryService serviceFactory) {
        . = serviceFactory;
    }
    private static synchronized KnowledgeBuilderFactoryService getKnowledgeBuilderServiceFactory() {
        if (  == null ) {
            loadServiceFactory();
        }
        return ;
    }
    private static void loadServiceFactory() {
        setKnowledgeBuilderFactoryService( ServiceRegistryImpl.getInstance().getKnowledgeBuilderFactoryService.class ) );
    }
New to GrepCode? Check out our FAQ X