Package chapter3

Examples of chapter3.SimpleConfigurator


    ruleMap.put(new Pattern("*/foo"), new NOPAction());

    // Add an implicit action.
    List<ImplicitAction> iaList = new ArrayList<ImplicitAction>();
    iaList.add(new PrintMeImplicitAction());
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap,
        iaList);

    // link the configurator with its context
    simpleConfigurator.setContext(context);

    simpleConfigurator.doConfigure(args[0]);
    StatusPrinter.printInCaseOfErrorsOrWarnings(context);
   
  }
View Full Code Here


    // Other associations
    ruleMap.put(new Pattern("/computation/literal"), new LiteralAction());
    ruleMap.put(new Pattern("/computation/add"), new AddAction());
    ruleMap.put(new Pattern("/computation/multiply"), new MultiplyAction());

    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    simpleConfigurator.doConfigure(args[0]);
    // Print any errors that might have occured.
    StatusPrinter.print(context);
  }
View Full Code Here

    // Associate "hello-world" pattern with HelloWorldAction
    ruleMap.put(new Pattern("hello-world"), new HelloWorldAction());

    // Joran needs to work within a context.
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    simpleConfigurator.doConfigure(args[0]);
    StatusPrinter.print(context);
  }
View Full Code Here

    // org.apache.joran.action package.
    //
    // We will let the XML file to teach the Joran interpreter about new rules
    ruleMap.put(new Pattern("/computation/new-rule"), new NewRuleAction());

    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    simpleConfigurator.doConfigure(args[0]);

    // Print any errors that might have occured.
    StatusPrinter.printInCaseOfErrorsOrWarnings(context);
  }
View Full Code Here

    ruleMap.put(new Pattern("*/computation/literal"), new LiteralAction());
    ruleMap.put(new Pattern("*/computation/add"), new AddAction());
    ruleMap.put(new Pattern("*/computation/multiply"), new MultiplyAction());
   
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
      simpleConfigurator.doConfigure(args[0]);
    } catch (JoranException e) {
      // Print any errors that might have occured.
      StatusPrinter.print(context);
    }
  }
View Full Code Here

    ruleMap.put(new Pattern("*/foo"), new NOPAction());

    // Add an implicit action.
    List<ImplicitAction> iaList = new ArrayList<ImplicitAction>();
    iaList.add(new PrintMeImplicitAction());
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap,
        iaList);

    // link the configurator with its context
    simpleConfigurator.setContext(context);

    simpleConfigurator.doConfigure(args[0]);
    StatusPrinter.printInCaseOfErrorsOrWarnings(context);
   
  }
View Full Code Here

    // Associate "hello-world" pattern with HelloWorldAction
    ruleMap.put(new Pattern("hello-world"), new HelloWorldAction());

    // Joran needs to work within a context.
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    simpleConfigurator.doConfigure(args[0]);
    StatusPrinter.print(context);
  }
View Full Code Here

    // Other associations
    ruleMap.put(new Pattern("/computation/literal"), new LiteralAction());
    ruleMap.put(new Pattern("/computation/add"), new AddAction());
    ruleMap.put(new Pattern("/computation/multiply"), new MultiplyAction());

    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    simpleConfigurator.doConfigure(args[0]);
    // Print any errors that might have occured.
    StatusPrinter.print(context);
  }
View Full Code Here

    // org.apache.joran.action package.
    //
    // We will let the XML file to teach the Joran interpreter about new rules
    ruleMap.put(new Pattern("/computation/new-rule"), new NewRuleAction());

    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    simpleConfigurator.doConfigure(args[0]);

    // Print any errors that might have occured.
    StatusPrinter.printInCaseOfErrorsOrWarnings(context);
  }
View Full Code Here

    ruleMap.put(new Pattern("*/computation/literal"), new LiteralAction());
    ruleMap.put(new Pattern("*/computation/add"), new AddAction());
    ruleMap.put(new Pattern("*/computation/multiply"), new MultiplyAction());
   
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
      simpleConfigurator.doConfigure(args[0]);
    } catch (JoranException e) {
      // Print any errors that might have occured.
      StatusPrinter.print(context);
    }
  }
View Full Code Here

TOP

Related Classes of chapter3.SimpleConfigurator

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.