/** * Create a new KnowledgeBase using the default KnowledgeBaseConfiguration * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase() { return getKnowledgeBaseFactoryService().newKnowledgeBase(); }
KnowledgeBase kbase = remoteN1.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase(kbaseConf);
/** * Create a new KnowledgeBase using the default KnowledgeBaseConfiguration * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase() { return getKnowledgeBaseFactoryService().newKnowledgeBase(); }
KnowledgeBase kbase = remoteN1.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase(kbaseConf);
/** * Create a new KnowledgeBase using the given KnowledgeBaseConfiguration * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase(KnowledgeBaseConfiguration conf) { return getKnowledgeBaseFactoryService().newKnowledgeBase( conf ); }
KnowledgeBase kbase = kbfs.newKnowledgeBase( kbfs.newKnowledgeBaseConfiguration() );
/** * Create a new KnowledgeBase using the given KnowledgeBaseConfiguration * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase(KnowledgeBaseConfiguration conf) { return getKnowledgeBaseFactoryService().newKnowledgeBase( conf ); }
/** * Create a new KnowledgeBase using the default KnowledgeBaseConfiguration * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase() { return getKnowledgeBaseFactoryService().newKnowledgeBase(); }
/** * Create a new KnowledgeBase using the given KnowledgeBaseConfiguration * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase(KnowledgeBaseConfiguration conf) { return getKnowledgeBaseFactoryService().newKnowledgeBase( conf ); }
/** * Create a new KnowledgeBase using the default KnowledgeBaseConfiguration and * the given KnowledgeBase ID. * * @param 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. * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase(String kbaseId) { return getKnowledgeBaseFactoryService().newKnowledgeBase(kbaseId); }
/** * Create a new KnowledgeBase using the default KnowledgeBaseConfiguration and * the given KnowledgeBase ID. * * @param 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. * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase(String kbaseId) { return getKnowledgeBaseFactoryService().newKnowledgeBase(kbaseId); }
/** * Create a new KnowledgeBase using the default KnowledgeBaseConfiguration and * the given KnowledgeBase ID. * * @param 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. * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase(String kbaseId) { return getKnowledgeBaseFactoryService().newKnowledgeBase(kbaseId); }
/** * Create a new KnowledgeBase using the given KnowledgeBaseConfiguration and * the given KnowledgeBase ID. * * @param 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. * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase(String kbaseId, KnowledgeBaseConfiguration conf) { return getKnowledgeBaseFactoryService().newKnowledgeBase( kbaseId, conf ); }
/** * Create a new KnowledgeBase using the given KnowledgeBaseConfiguration and * the given KnowledgeBase ID. * * @param 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. * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase(String kbaseId, KnowledgeBaseConfiguration conf) { return getKnowledgeBaseFactoryService().newKnowledgeBase( kbaseId, conf ); }
/** * Create a new KnowledgeBase using the given KnowledgeBaseConfiguration and * the given KnowledgeBase ID. * * @param 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. * @return * The KnowledgeBase */ public static KnowledgeBase newKnowledgeBase(String kbaseId, KnowledgeBaseConfiguration conf) { return getKnowledgeBaseFactoryService().newKnowledgeBase( kbaseId, conf ); }
public static KnowledgeBase createKnowledgeBase(GridNode node,String resource,String resourcetype){ if ( node == null ) { node = new GridNodeImpl(); } //kbase configuration PackageBuilderConfiguration kconf = (PackageBuilderConfiguration) KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,DroolsBlueprintBean.class.getClassLoader()); //kbuilder KnowledgeBuilder kbuilder = node.get( KnowledgeBuilderFactoryService.class ).newKnowledgeBuilder( kconf); kbuilder.add(parseResource(resource),ResourceType.getResourceType(resourcetype)); // error handling KnowledgeBuilderErrors errors = kbuilder.getErrors(); if ( !errors.isEmpty() ) { throw new RuntimeException( errors.toString() ); } //KnowledgeBase KnowledgeBaseConfiguration kbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null, DroolsBlueprintBean.class.getClassLoader()); KnowledgeBase kbase = node.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase(kbaseConfig); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); return kbase; }
kbase = node.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase( conf ); } else { kbase = node.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase();
kbase = node.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase( conf ); } else { kbase = node.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase();
@Test public void testSetObject() { GridConnection<GridNode> connection = new LocalGridNodeConnection( "test-id", null ); GridNode gnode = connection.connect(); KnowledgeBaseFactoryService kbfService = gnode.get( KnowledgeBaseFactoryService.class ); KnowledgeBase kbase = kbfService.newKnowledgeBase(); gnode.set( "id1", kbase ); assertSame( kbase, gnode.get( "id1", KnowledgeBase.class ) ); }
@Test public void localNodeTest() { Grid grid = new GridImpl( new HashMap<String, Object>() ); GridPeerConfiguration conf = new GridPeerConfiguration(); GridPeerServiceConfiguration wpconf = new WhitePagesLocalConfiguration(); conf.addConfiguration( wpconf ); conf.configure( grid ); GridNode gnode = grid.createGridNode( "n1" ); KnowledgeBuilder kbuilder = gnode.get( KnowledgeBuilderFactoryService.class ).newKnowledgeBuilder(); assertNotNull( kbuilder ); KnowledgeBase kbase = gnode.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase(); assertNotNull( kbase ); StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession(); assertNotNull( session ); WhitePages wp = grid.get( WhitePages.class ); GridServiceDescription gsd = wp.lookup( "n1" ); assertNotNull(gsd); assertEquals( 0, gsd.getAddresses().size() ); GridNode gnode1 = grid.getGridNode( gsd.getId() ); assertNotNull( gnode1 ); grid.removeGridNode( gsd.getId() ); assertNull( wp.lookup( "n1" ) ); assertNull( grid.getGridNode( gsd.getId() ) ); grid.dispose(); // node has been removed, so disposal should not affect it assertFalse( gnode.isDisposed() ); gnode.dispose(); assertTrue( gnode.isDisposed() ); }