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;
 
 

This factory will create and return a KnowledgeBase instance, an optional KnowledgeBaseConfiguration can be provided. The KnowledgeBaseConfiguration is also itself created from this factory.

 KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
 

Create sequential KnowledgeBase using the given ClassLoader.

 Properties properties = new Properties();
 properties.setOption( SequentialOption.YES );
 KnowledgeBaseConfiguration kbConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(properties, myClassLoader);
 KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbConf);
 

The above could also have used the supported property

 properties.setProperty( "org.drools.sequential", "true");
 

See also:
KnowledgeBase
 
 public class KnowledgeBaseFactory  {
     private static KnowledgeBaseFactoryService factoryService;

    
Create a new KnowledgeBase using the default KnowledgeBaseConfiguration

Returns:
The KnowledgeBase
 
     public static KnowledgeBase newKnowledgeBase() {
         return getKnowledgeBaseFactoryService().newKnowledgeBase();
     }

    
Create a new KnowledgeBase using the default KnowledgeBaseConfiguration and the given KnowledgeBase ID.

Parameters:
kbaseId A string Identifier for the knowledge base. Specially useful when enabling JMX monitoring and management, as that ID will be used to compose the JMX ObjectName for all related MBeans. The application must ensure all kbase IDs are unique.
Returns:
The KnowledgeBase
 
     public static KnowledgeBase newKnowledgeBase(String kbaseId) {
         return getKnowledgeBaseFactoryService().newKnowledgeBase(kbaseId);
     }

    
Create a new KnowledgeBase using the given KnowledgeBaseConfiguration

Returns:
The KnowledgeBase
 
     public static KnowledgeBase newKnowledgeBase(KnowledgeBaseConfiguration conf) {
         return getKnowledgeBaseFactoryService().newKnowledgeBaseconf );
     }

    
Create a new KnowledgeBase using the given KnowledgeBaseConfiguration and the given KnowledgeBase ID.

Parameters:
kbaseId A string Identifier for the knowledge base. Specially useful when enabling JMX monitoring and management, as that ID will be used to compose the JMX ObjectName for all related MBeans. The application must ensure all kbase IDs are unique.
Returns:
The KnowledgeBase
    public static KnowledgeBase newKnowledgeBase(String kbaseId,
                                                 KnowledgeBaseConfiguration conf) {
        return getKnowledgeBaseFactoryService().newKnowledgeBasekbaseIdconf );
    }

    
Create a KnowledgeBaseConfiguration on which properties can be set.

Returns:
The KnowledgeBaseConfiguration.
    }

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

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

    
Create a KnowledgeSessionConfiguration on which properties can be set.

Returns:
The KnowledgeSessionConfiguration.
    }

    
Create a KnowledgeSessionConfiguration on which properties can be set.

Returns:
The KnowledgeSessionConfiguration.
        return getKnowledgeBaseFactoryService().newKnowledgeSessionConfigurationproperties );
    }
    public static Environment newEnvironment() {
    }
    public static synchronized void setKnowledgeBaseServiceFactory(KnowledgeBaseFactoryService serviceFactory) {
        . = serviceFactory;
    }
    private static synchronized KnowledgeBaseFactoryService getKnowledgeBaseFactoryService() {
        if (  == null ) {
            loadServiceFactory();
        }
        return ;
    }
    @SuppressWarnings("unchecked")
    private static void loadServiceFactory() {
        setKnowledgeBaseServiceFactory( ServiceRegistryImpl.getInstance().getKnowledgeBaseFactoryService.class ) );
    }
New to GrepCode? Check out our FAQ X