1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. 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 package org.apache.commons.scxml2.test; 18 19 import org.apache.commons.scxml2.Evaluator; 20 import org.apache.commons.scxml2.env.jexl.JexlEvaluator; 21 22 /** 23 * Standalone SCXML interpreter, useful for command-line testing and 24 * debugging, where expressions are JEXL expressions. 25 * 26 * <p>USAGE:</p> 27 * <p><code>java org.apache.commons.scxml2.test.StandaloneJexlExpressions 28 * url</code></p> 29 * <p>or</p> 30 * <p><code>java org.apache.commons.scxml2.test.StandaloneJexlExpressions 31 * filename</code> 32 * </p> 33 * 34 * <p>RUNNING:</p> 35 * <ul> 36 * <li>Enter a space-separated list of "events"</li> 37 * <li>To quit, enter "quit"</li> 38 * <li>To populate a variable in the current context, 39 * type "name=value"</li> 40 * <li>To reset state machine, enter "reset"</li> 41 * </ul> 42 * 43 */ 44 public final class StandaloneJexlExpressions { 45 46 /** 47 * Launcher. 48 * @param args The arguments, one expected, the URI or filename of the 49 * SCXML document 50 */ 51 public static void main(final String[] args) { 52 if (args.length < 1) { 53 System.out.println("USAGE: java " 54 + StandaloneJexlExpressions.class.getName() 55 + "<url|filename>"); 56 System.exit(-1); 57 } 58 Evaluator evaluator = new JexlEvaluator(); 59 StandaloneUtils.execute(args[0], evaluator); 60 } 61 62 /** 63 * Discourage instantiation since this is a utility class. 64 */ 65 private StandaloneJexlExpressions() { 66 super(); 67 } 68 69 } 70