View Javadoc

1   /*
2    *
3    *   Copyright 2006 The Apache Software Foundation.
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   *
17   */
18  package org.apache.commons.scxml.test;
19  
20  import org.apache.commons.scxml.Evaluator;
21  import org.apache.commons.scxml.env.jexl.JexlEvaluator;
22  
23  /***
24   * Standalone SCXML interpreter, useful for command-line testing and
25   * debugging, where expressions are JEXL expressions.
26   *
27   * <p>USAGE:</p>
28   * <p><code>java org.apache.commons.scxml.test.StandaloneJexlExpressions
29   *          url</code></p>
30   * <p>or</p>
31   * <p><code>java org.apache.commons.scxml.test.StandaloneJexlExpressions
32   *          filename</code>
33   * </p>
34   *
35   * <p>RUNNING:</p>
36   * <ul>
37   *  <li>Enter a space-separated list of "events"</li>
38   *  <li>To quit, enter "quit"</li>
39   *  <li>To populate a variable in the current context,
40   *      type "name=value"</li>
41   *  <li>To reset state machine, enter "reset"</li>
42   * </ul>
43   *
44   */
45  public final class StandaloneJexlExpressions {
46  
47      /***
48       * Launcher.
49       * @param args The arguments, one expected, the URI or filename of the
50       *             SCXML document
51       */
52      public static void main(final String[] args) {
53          if (args.length < 1) {
54              System.out.println("USAGE: java "
55                      + StandaloneJexlExpressions.class.getName()
56                      + "<url|filename>");
57              System.exit(-1);
58          }
59          Evaluator evaluator = new JexlEvaluator();
60          StandaloneUtils.execute(args[0], evaluator);
61      }
62  
63      /***
64       * Discourage instantiation since this is a utility class.
65       */
66      private StandaloneJexlExpressions() {
67          super();
68      }
69  
70  }
71