jdk/src/share/classes/javax/script/package.html
author ohair
Wed, 26 May 2010 20:28:04 -0700
changeset 5551 327690766109
parent 5506 202f599c92aa
permissions -rw-r--r--
6956202: Fix a few missed rebranding issues, please contact lines etc. Reviewed-by: jjg, darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
<html>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
<head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
<!--
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     5
Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    10
published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    12
by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
5551
327690766109 6956202: Fix a few missed rebranding issues, please contact lines etc.
ohair
parents: 5506
diff changeset
    24
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
327690766109 6956202: Fix a few missed rebranding issues, please contact lines etc.
ohair
parents: 5506
diff changeset
    25
or visit www.oracle.com if you need additional information or have any
327690766109 6956202: Fix a few missed rebranding issues, please contact lines etc.
ohair
parents: 5506
diff changeset
    26
questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
-->
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
</head>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
<body bgcolor="white">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
<p>The scripting API consists of interfaces and classes that define
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
Java <font size=1><sup>TM</sup></font> Scripting Engines and provides
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
a framework for their use in Java applications. This API is intended
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
for use by application programmers who wish to execute programs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
written in scripting languages in their Java applications. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
scripting language programs are usually provided by the end-users of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
the applications. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
<p>The main areas of functionality of <code>javax.script</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
package include 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
<ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
	<li><p><b>Script execution</b>: Scripts
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
	are streams of characters used as sources for  programs executed by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
	script engines. Script execution uses 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        {@link javax.script.ScriptEngine#eval eval} methods of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
	{@link javax.script.ScriptEngine ScriptEngine} and methods of the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        {@link javax.script.Invocable Invocable} interface. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
	</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
	<li><p><b>Binding</b>: This facility
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
	allows Java objects to be exposed to script programs as named
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
	variables. {@link javax.script.Bindings Bindings} and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        {@link javax.script.ScriptContext ScriptContext}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
	classes are used for this purpose. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
	</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
	<li><p><b>Compilation</b>: This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
	functionality allows the intermediate code generated by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
	front-end of a script engine to be stored and executed repeatedly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
	This benefits applications that execute the same script multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
	times. These applications can gain efficiency since the engines'
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
	front-ends only need to execute once per script rather than once per
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
	script execution. Note that this functionality is optional and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
	script engines may choose not to implement it. Callers need to check
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
	for availability of the {@link javax.script.Compilable Compilable}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        interface using an <I>instanceof</I> check. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
	</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
	<li><p><b>Invocation</b>: This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
	functionality allows the reuse of intermediate code generated by a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
	script engine's front-end. Whereas Compilation allows entire scripts
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
	represented by intermediate code to be re-executed, Invocation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
	functionality allows individual procedures/methods in the scripts to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
	be re-executed. As in the case with compilation, not all script
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
	engines are required to provide this facility. Caller has to check
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
	for {@link javax.script.Invocable Invocable} availability. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
	</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
	<li><p><b>Script engine discovery and Metadata</b>: Applications
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
	written to the Scripting API might have specific requirements on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
	script engines. Some may require a specific scripting language
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
	and/or version while others may require a specific implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
	engine and/or version. Script engines are packaged in a specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
	way so that engines can be discovered at runtime and queried for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
	attributes. The Engine discovery mechanism is based on the Service
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
	discovery mechanism described in the <b>Jar File Specification</b>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
	Script engine implementing classes are packaged in jar files that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
	include a  text resource named
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
	<b>META-INF/services/javax.script.ScriptEngineFactory</b>. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
	resource must include a line for each 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        {@link javax.script.ScriptEngineFactory ScriptEngineFactory}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
	that is packaged in the jar file. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        {@link javax.script.ScriptEngineManager ScriptEngineManager}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
	includes 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        {@link javax.script.ScriptEngineManager#getEngineFactories getEngineFactories} method to get all
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
	{@link javax.script.ScriptEngineFactory ScriptEngineFactory} instances 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        discovered using this mechanism. <code>ScriptEngineFactory</code> has 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        methods to query attributes about script engine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
	</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
</ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
@since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
</body>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
</html>