01: /*
02: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * All rights reserved.
04: * [See end of file]
05: */
06:
07: package jena;
08:
09: import java.lang.reflect.InvocationTargetException;
10: import java.lang.reflect.Method;
11:
12: public class query {
13: // Call-through to arq command line application
14: public static void main(String[] args) {
15: // Do this by reflection so it is not assumed that ARQ is available
16: // at compile time.
17:
18: invokeCmd("arq.query", args);
19: }
20:
21: public static void invokeCmd(String className, String[] args) {
22:
23: Class cmd = null;
24: try {
25: cmd = Class.forName(className);
26: } catch (ClassNotFoundException ex) {
27: System.err.println("Class '" + className + "' not found");
28: System.exit(1);
29: }
30:
31: Method method = null;
32: try {
33: method = cmd.getMethod("main",
34: new Class[] { String[].class });
35: } catch (NoSuchMethodException ex) {
36: System.err.println("'main' not found but the class '"
37: + className + "' was");
38: System.exit(1);
39: }
40:
41: try {
42: method.invoke(null, new Object[] { args });
43: return;
44: } catch (IllegalArgumentException ex) {
45: System.err.println("IllegalArgumentException exception: "
46: + ex.getMessage());
47: System.exit(7);
48: } catch (IllegalAccessException ex) {
49: System.err.println("IllegalAccessException exception: "
50: + ex.getMessage());
51: System.exit(8);
52: } catch (InvocationTargetException ex) {
53: System.err.println("InvocationTargetException exception: "
54: + ex.getMessage());
55: System.exit(9);
56: }
57:
58: //arq.query.main(args) ;
59: }
60: }
61:
62: /*
63: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
64: * All rights reserved.
65: *
66: * Redistribution and use in source and binary forms, with or without
67: * modification, are permitted provided that the following conditions
68: * are met:
69: * 1. Redistributions of source code must retain the above copyright
70: * notice, this list of conditions and the following disclaimer.
71: * 2. Redistributions in binary form must reproduce the above copyright
72: * notice, this list of conditions and the following disclaimer in the
73: * documentation and/or other materials provided with the distribution.
74: * 3. The name of the author may not be used to endorse or promote products
75: * derived from this software without specific prior written permission.
76: *
77: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
78: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
79: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
80: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
81: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
82: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
83: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
84: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
85: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
86: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
87: */
|