001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.scxml2.test; 018 019import org.apache.commons.scxml2.Evaluator; 020import org.apache.commons.scxml2.env.jexl.JexlEvaluator; 021 022/** 023 * Standalone SCXML interpreter, useful for command-line testing and 024 * debugging, where expressions are JEXL expressions. 025 * 026 * <p>USAGE:</p> 027 * <p><code>java org.apache.commons.scxml2.test.StandaloneJexlExpressions 028 * url</code></p> 029 * <p>or</p> 030 * <p><code>java org.apache.commons.scxml2.test.StandaloneJexlExpressions 031 * filename</code> 032 * </p> 033 * 034 * <p>RUNNING:</p> 035 * <ul> 036 * <li>Enter a space-separated list of "events"</li> 037 * <li>To quit, enter "quit"</li> 038 * <li>To populate a variable in the current context, 039 * type "name=value"</li> 040 * <li>To reset state machine, enter "reset"</li> 041 * </ul> 042 * 043 */ 044public final class StandaloneJexlExpressions { 045 046 /** 047 * Launcher. 048 * @param args The arguments, one expected, the URI or filename of the 049 * SCXML document 050 */ 051 public static void main(final String[] args) { 052 if (args.length < 1) { 053 System.out.println("USAGE: java " 054 + StandaloneJexlExpressions.class.getName() 055 + "<url|filename>"); 056 System.exit(-1); 057 } 058 Evaluator evaluator = new JexlEvaluator(); 059 StandaloneUtils.execute(args[0], evaluator); 060 } 061 062 /** 063 * Discourage instantiation since this is a utility class. 064 */ 065 private StandaloneJexlExpressions() { 066 super(); 067 } 068 069} 070