ceki 2004/04/10 06:55:58
Modified: examples/src/joran/implicit PrintMe.java
examples/src/joran/newRule NewRuleCalculator.java
examples/src/joran/calculator Calculator1.java
Calculator2.java
Log:
Improved docs.
Revision Changes Path
1.2 +11 -13 logging-log4j/examples/src/joran/implicit/PrintMe.java
Index: PrintMe.java
===================================================================
RCS file: /home/cvs/logging-log4j/examples/src/joran/implicit/PrintMe.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PrintMe.java 10 Apr 2004 13:47:58 -0000 1.1
+++ PrintMe.java 10 Apr 2004 13:55:58 -0000 1.2
@@ -16,12 +16,9 @@
package joran.implicit;
-import joran.calculator.ComputationAction2;
-
import org.apache.joran.Interpreter;
import org.apache.joran.Pattern;
import org.apache.joran.RuleStore;
-import org.apache.joran.action.NewRuleAction;
import org.apache.joran.helper.SimpleRuleStore;
import java.util.List;
@@ -31,12 +28,12 @@
/**
- * This example illustrates the usage of NewRuleAction which allows the Joran
- * interpreter to learn new rules on the fly from the XML file being
- * interpreted.
- *
- * This example relies heavily on the code from the joran.calculator package.
- *
+ * This example illustrates the usage of implcit actions.
+ *
+ * The crucial point to remember about implicit actions is that they
+ * are not associated with a pattern. Moreover, they are added directly to
+ * a Joran Interpreter instead of a rule store.
+ *
* @author Ceki Güulcü
*/
public class PrintMe {
@@ -57,9 +54,9 @@
// Create a new Joran Interpreter and hand it our simple rule store.
Interpreter ji = new Interpreter(ruleStore);
- //
- // Add an implicit action.
- //
+ // --------------------------+
+ // Add an implicit action. |
+ // --------------------------+
ji.addImplcitAction(new PrintMeImplicitAction());
// Create a SAX parser
@@ -70,7 +67,8 @@
// set the SAX ContentHandler to the Joran Interpreter we just created.
saxParser.parse(args[0], ji);
- // The file has been parsed and interpreted. We now errors if any.
+ // The file has been parsed and interpreted. We now print any errors that
+ // might have occured.
List errorList = ji.getExecutionContext().getErrorList();
if (errorList.size() > 0) {
1.2 +3 -3 logging-log4j/examples/src/joran/newRule/NewRuleCalculator.java
Index: NewRuleCalculator.java
===================================================================
RCS file: /home/cvs/logging-log4j/examples/src/joran/newRule/NewRuleCalculator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NewRuleCalculator.java 9 Apr 2004 18:39:32 -0000 1.1
+++ NewRuleCalculator.java 10 Apr 2004 13:55:58 -0000 1.2
@@ -40,8 +40,6 @@
* @author Ceki Güulcü
*/
public class NewRuleCalculator {
-
-
public static void main(String[] args) throws Exception {
// Uncomment the following line in order to enable log statements generated
// from joran itself.
@@ -70,7 +68,9 @@
// set the SAX ContentHandler to the Joran Interpreter we just created.
saxParser.parse(args[0], ji);
- // The file has been parsed and interpreted. We now errors if any.
+
+ // The file has been parsed and interpreted. We now print any errors that
+ // might have occured.
List errorList = ji.getExecutionContext().getErrorList();
if (errorList.size() > 0) {
1.3 +2 -1 logging-log4j/examples/src/joran/calculator/Calculator1.java
Index: Calculator1.java
===================================================================
RCS file: /home/cvs/logging-log4j/examples/src/joran/calculator/Calculator1.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Calculator1.java 9 Apr 2004 16:03:19 -0000 1.2
+++ Calculator1.java 10 Apr 2004 13:55:58 -0000 1.3
@@ -72,7 +72,8 @@
// set the SAX ContentHandler to the Joran Interpreter we just created.
saxParser.parse(args[0], ji);
- // The file has been parsed and interpreted. We now errors if any.
+ // The file has been parsed and interpreted. We now print any errors that
+ // might have occured.
List errorList = ji.getExecutionContext().getErrorList();
if(errorList.size() > 0) {
System.out.println("The following errors occured:");
1.3 +2 -1 logging-log4j/examples/src/joran/calculator/Calculator2.java
Index: Calculator2.java
===================================================================
RCS file: /home/cvs/logging-log4j/examples/src/joran/calculator/Calculator2.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Calculator2.java 9 Apr 2004 16:03:19 -0000 1.2
+++ Calculator2.java 10 Apr 2004 13:55:58 -0000 1.3
@@ -61,7 +61,8 @@
// set the SAX ContentHandler to the Joran Interpreter we just created.
saxParser.parse(args[0], ji);
- // The file has been parsed and interpreted. We now errors if any.
+ // The file has been parsed and interpreted. We now print any errors that
+ // might have occured.
List errorList = ji.getExecutionContext().getErrorList();
if(errorList.size() > 0) {
System.out.println("The following errors occured:");
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]