jdk/src/share/demo/scripting/jconsole-plugin/README.txt
author nloodin
Wed, 31 Aug 2011 13:48:04 +0200
changeset 10292 ed7db6a12c2a
parent 2 90ce3da70b43
permissions -rw-r--r--
7067811: Update demo/sample code to state it should not be used for production Summary: Added comment block after copyright block stating that code is unfit for production. Reviewed-by: ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
What is this demo about?
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
This is "script shell" plugin for jconsole  - the monitoring and management 
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
client tool shipped with JRE. This plugin adds "Script Shell" tab to jconsole.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
This serves as a demo for jconsole plugin API (com.sun.tools.jconsole) as well 
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
as a demo for scripting API (javax.script) for the Java platform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
Script console is an interactive read-eval-print interface that can be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
used to execute advanced monitoring and management queries. By default,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
JavaScript is used as the scripting language. The scripting language can be 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
changed using the system property com.sun.demo.jconsole.console.language. To 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
use other scripting languages, you need to specify the corresponding engine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
jar file in pluginpath along with this plugin's jar file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
The following 3 global variables are exposed to the script engine:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
    window      javax.swing.JPanel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
    engine      javax.script.ScriptEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
    plugin      com.sun.tools.jconsole.JConsolePlugin
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
If you use JavaScript, there are many useful global functions defined in 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
./src/resources/jconsole.js. This is built into the script plugin jar file. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
In addition, you can add other global functions and global variables by 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
defining those in ~/jconsole.js (or jconsole.<ext> where <ext> is the file 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
extension for your scripting language of choice under your home directory).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
How do I compile script console plugin?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
You can use the Java based build tool "ant" (http://ant.apache.org) to build 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
this plugin. To build using ant, please use the following command in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
current directory:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
    ant
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
How do I use script console plugin?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
To start jconsole with this plugin, please use the following command
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    jconsole -pluginpath jconsole-plugin.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
How do I load my own script files in script console?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
If you use JavaScript (the default), then there is a global function called
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
"load" to load any script file from your file system. In script console
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
prompt, enter the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    load(<script-file-path>);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
where <script-file-path> is the path of your script file to load. If you don't 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
specify the file path, then the load function shows file dialog box to choose 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
the script file to load.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
How do I get help on script global functions?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
If you use JavaScript (the default), then there is a global function called
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
"help" that prints one-line help messages on global functions. In script
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
console prompt, enter the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    help(); 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
Where are the sample JavaScript files?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
./src/scripts directory contains JavaScript files that can be loaded into
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
script console.