1 /* |
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 package org.banana; |
|
25 |
|
26 import java.util.Arrays; |
|
27 import java.util.List; |
|
28 import javax.script.ScriptEngine; |
|
29 import javax.script.ScriptEngineFactory; |
|
30 |
|
31 public class BananaScriptEngineFactory implements ScriptEngineFactory { |
|
32 |
|
33 static final BananaScriptEngineFactory INSTANCE = new BananaScriptEngineFactory(null); |
|
34 |
|
35 public BananaScriptEngineFactory() { |
|
36 throw new RuntimeException("Should not be called"); |
|
37 } |
|
38 |
|
39 private BananaScriptEngineFactory(Void param) { } |
|
40 |
|
41 public static BananaScriptEngineFactory provider() { |
|
42 return INSTANCE; |
|
43 } |
|
44 |
|
45 @Override |
|
46 public String getEngineName() { |
|
47 return "BananaScriptEngine"; |
|
48 } |
|
49 |
|
50 @Override |
|
51 public String getEngineVersion() { |
|
52 return "1.0"; |
|
53 } |
|
54 |
|
55 @Override |
|
56 public List<String> getExtensions() { |
|
57 return Arrays.asList("banana"); |
|
58 } |
|
59 |
|
60 @Override |
|
61 public List<String> getMimeTypes() { |
|
62 return Arrays.asList("application/x-bananascript"); |
|
63 } |
|
64 |
|
65 @Override |
|
66 public List<String> getNames() { |
|
67 return Arrays.asList("BananaScript"); |
|
68 } |
|
69 |
|
70 @Override |
|
71 public String getLanguageName() { |
|
72 return "BananaScript"; |
|
73 } |
|
74 |
|
75 @Override |
|
76 public String getLanguageVersion() { |
|
77 return "1.0"; |
|
78 } |
|
79 |
|
80 @Override |
|
81 public Object getParameter(String key) { |
|
82 return null; |
|
83 } |
|
84 |
|
85 @Override |
|
86 public String getMethodCallSyntax(String obj, String m, String... args) { |
|
87 throw new RuntimeException(); |
|
88 } |
|
89 |
|
90 @Override |
|
91 public String getOutputStatement(String toDisplay) { |
|
92 throw new RuntimeException(); |
|
93 } |
|
94 |
|
95 @Override |
|
96 public String getProgram(String... statements) { |
|
97 throw new RuntimeException(); |
|
98 } |
|
99 |
|
100 @Override |
|
101 public ScriptEngine getScriptEngine() { |
|
102 return new BananaScript(); |
|
103 } |
|
104 } |
|