Guest User

Untitled

a guest
Jul 18th, 2016
21
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ar.uba.fi.fallas;
  2.  
  3. import javax.inject.Inject;
  4. import org.jboss.weld.environment.se.Weld;
  5. import org.jboss.weld.environment.se.WeldContainer;
  6. import org.kie.api.cdi.KSession;
  7. import org.kie.api.runtime.KieSession;
  8.  
  9. /**
  10.  * Hello world!
  11.  *
  12.  */
  13. public class App
  14. {
  15.     @Inject
  16.     @KSession()
  17.     private KieSession kSession;
  18.    
  19.     public void bootstrapDrools() {
  20.         // The KieSession was injected so we can use it now
  21.         kSession.insert("Hi There!");
  22.         int rulesFired = kSession.fireAllRules();
  23.         System.out.println("Rules Fired: "+rulesFired);
  24.     }
  25.    
  26.     public static void main( String[] args )
  27.     {
  28.         //Boostrap the CDI container, in this case WELD
  29.         Weld w = new Weld();
  30.      
  31.         WeldContainer wc = w.initialize();
  32.         App app = wc.instance().select(App.class).get();
  33.         app.bootstrapDrools();
  34.      
  35.         w.shutdown();
  36.     }
  37. }
RAW Paste Data