Package org.openiaml.model.drools

Examples of org.openiaml.model.drools.CreateMissingElementsWithDrools


   * @see CreateMissingElementsWithDrools#getRuleFiles()
   * @return a map of filename to XML strings
   * @throws InferenceException
   */
  public Map<String,String> getRuleXmls() throws InferenceException {
    CreateMissingElementsWithDrools ce = new CreateMissingElementsWithDrools(null, false);
    List<String> files = ce.getRuleFiles();
    Map<String,String> result = new HashMap<String,String>();
   
    for (String f : files) {
      Reader source = new InputStreamReader(
          CreateMissingElementsWithDrools.class.getResourceAsStream( f ) );
View Full Code Here


   *
   * @return The engine to use
   */
  public DroolsInferenceEngine getEngine(ICreateElementsFactory factory) {
    // we add trackInsertions=true so we can actually get tracked insertions
    return new CreateMissingElementsWithDrools(factory, true);
  }
View Full Code Here

      return super.getInferenceEngine(handler, trackInsertions, reloader);
   
    final Class<?> caller = getClass();
   
    // return engine which checks EMF properties
    return new CreateMissingElementsWithDrools(handler, trackInsertions) {

      @Override
      public void create(EObject model, boolean logRuleSource,
          IProgressMonitor monitor) throws InferenceException {
View Full Code Here

  protected ProgressEnabledAction<GraphicalEditPart> getAction() {
    return new InferContainedElementsAction() {

      @Override
      public DroolsInferenceEngine getEngine(ICreateElementsFactory handler) {
        return new CreateMissingElementsWithDrools(handler, true) {

          /**
           * We need to extend this to use the testing classloader,
           * not the drools plugin classloader.
           */
 
View Full Code Here

  protected ProgressEnabledAction<IFile> getFullAction() {
    return new InferEntireModelAction() {

      @Override
      public DroolsInferenceEngine getEngine(ICreateElementsFactory handler) {
        return new CreateMissingElementsWithDrools(handler, true) {

          /**
           * We need to extend this to use the testing classloader,
           * not the drools plugin classloader.
           */
 
View Full Code Here

   
   
    // load all rule files for inference semantics
    {
      ILoader loader = new LoadSemanticsFromRules(
          new CreateMissingElementsWithDrools(null, false) /* engine */,
          "org.openiaml.model.drools" /* plugin */,
          "../org.openiaml.model.drools/" /* engine base */,
          this
      );
      loader.load(factory, root);
View Full Code Here

   * <p>Create a new instance of the inference engine.</p>
   *
   * @return
   */
  public CreateMissingElementsWithDrools getInferenceEngine(ICreateElementsFactory handler, boolean trackInsertions, final IModelReloader reloader) {
    return new CreateMissingElementsWithDrools(handler, trackInsertions);
  }
View Full Code Here

    if (resource == null) {
      throw new IllegalArgumentException("EObject '" + root + "' has a null resource.");
    }
   
    ICreateElementsFactory handler = createCreateElementsFactory();
    CreateMissingElementsWithDrools ce = provider.getInferenceEngine(handler, false, reloader);
    ce.create(root, logRuleSource, createMonitor());

    // write out this inferred model for reference
    inferredModel = provider.saveInferredModel(resource);

    return root;
View Full Code Here

      if (resource == null) {
        throw new IllegalArgumentException("EObject '" + root + "' has a null resource.");
      }
     
      ICreateElementsFactory handler = createCreateElementsFactory();
      CreateMissingElementsWithDrools ce = provider.getInferenceEngine(handler, false, new IModelReloader() {

        @Override
        public EObject reload() throws InferenceException {
          try {
            return loader.loadDirectly(loadClass, logRuleSource);
          } catch (Exception e) {
            throw new InferenceException(e);
          }
        }
       
      });

      logTimed("infer", "performing inference", "", "");
      ce.create(root, logRuleSource, monitor);
 
      // write out this inferred model for reference
      logTimed("infer", "writing out inferred model", "", "");
      inferredModel = provider.saveInferredModel(resource);
     
View Full Code Here

  public static final String DROOLS_PLUGIN_ROOT = "../org.openiaml.model.drools/";
 
  public void testPackages() throws Exception {
   
    DroolsInferenceEngine engine =
      new CreateMissingElementsWithDrools(null, false);
   
    Map<String,String> foundPackages = new HashMap<String,String>();
   
    for (String file : engine.getRuleFiles()) {
      // check file
      String input = readFile(new File(DROOLS_PLUGIN_ROOT + file));
      String[] split = input.split("\n");
     
      for (String line : split) {
View Full Code Here

TOP

Related Classes of org.openiaml.model.drools.CreateMissingElementsWithDrools

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.