author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 34949 | jdk/src/java.scripting/share/classes/javax/script/package-info.java@304424bbae03 |
permissions | -rw-r--r-- |
34949
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
1 |
/* |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
2 |
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
4 |
* |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
10 |
* |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
15 |
* accompanied this code). |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
16 |
* |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
20 |
* |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
23 |
* questions. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
24 |
*/ |
2 | 25 |
|
34949
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
26 |
/** |
2 | 27 |
|
28 |
<p>The scripting API consists of interfaces and classes that define |
|
30678 | 29 |
Java™ Scripting Engines and provides |
2 | 30 |
a framework for their use in Java applications. This API is intended |
31 |
for use by application programmers who wish to execute programs |
|
32 |
written in scripting languages in their Java applications. The |
|
33 |
scripting language programs are usually provided by the end-users of |
|
34949
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
34 |
the applications. |
2 | 35 |
</p> |
36 |
<p>The main areas of functionality of <code>javax.script</code> |
|
34949
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
37 |
package include |
2 | 38 |
</p> |
39 |
<ol> |
|
34949
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
40 |
<li><p><b>Script execution</b>: Scripts |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
41 |
are streams of characters used as sources for programs executed by |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
42 |
script engines. Script execution uses |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
43 |
{@link javax.script.ScriptEngine#eval eval} methods of |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
44 |
{@link javax.script.ScriptEngine ScriptEngine} and methods of the |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
45 |
{@link javax.script.Invocable Invocable} interface. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
46 |
</p> |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
47 |
<li><p><b>Binding</b>: This facility |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
48 |
allows Java objects to be exposed to script programs as named |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
49 |
variables. {@link javax.script.Bindings Bindings} and |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
50 |
{@link javax.script.ScriptContext ScriptContext} |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
51 |
classes are used for this purpose. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
52 |
</p> |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
53 |
<li><p><b>Compilation</b>: This |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
54 |
functionality allows the intermediate code generated by the |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
55 |
front-end of a script engine to be stored and executed repeatedly. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
56 |
This benefits applications that execute the same script multiple |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
57 |
times. These applications can gain efficiency since the engines' |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
58 |
front-ends only need to execute once per script rather than once per |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
59 |
script execution. Note that this functionality is optional and |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
60 |
script engines may choose not to implement it. Callers need to check |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
61 |
for availability of the {@link javax.script.Compilable Compilable} |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
62 |
interface using an <I>instanceof</I> check. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
63 |
</p> |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
64 |
<li><p><b>Invocation</b>: This |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
65 |
functionality allows the reuse of intermediate code generated by a |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
66 |
script engine's front-end. Whereas Compilation allows entire scripts |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
67 |
represented by intermediate code to be re-executed, Invocation |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
68 |
functionality allows individual procedures/methods in the scripts to |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
69 |
be re-executed. As in the case with compilation, not all script |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
70 |
engines are required to provide this facility. Caller has to check |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
71 |
for {@link javax.script.Invocable Invocable} availability. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
72 |
</p> |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
73 |
<li><p><b>Script engine discovery</b>: Applications |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
74 |
written to the Scripting API might have specific requirements on |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
75 |
script engines. Some may require a specific scripting language |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
76 |
and/or version while others may require a specific implementation |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
77 |
engine and/or version. Script engines are packaged in a specified |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
78 |
way so that engines can be discovered at runtime and queried for |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
79 |
attributes. The Engine discovery mechanism is based on the service-provider |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
80 |
loading facility described in the {@link java.util.ServiceLoader} class. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
81 |
{@link javax.script.ScriptEngineManager ScriptEngineManager} |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
82 |
includes |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
83 |
{@link javax.script.ScriptEngineManager#getEngineFactories getEngineFactories} method to get all |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
84 |
{@link javax.script.ScriptEngineFactory ScriptEngineFactory} instances |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
85 |
discovered using this mechanism. <code>ScriptEngineFactory</code> has |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
86 |
methods to query attributes about script engine. |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
87 |
</p> |
2 | 88 |
</ol> |
89 |
||
90 |
@since 1.6 |
|
34949
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
91 |
*/ |
2 | 92 |
|
34949
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
93 |
package javax.script; |
304424bbae03
8068938: javax.script package description should specify use of ServiceLoader
sundar
parents:
30678
diff
changeset
|
94 |