4.A.1.1. Introduction

BeanShell plugin, provides a scripting language compatible with Java.

The exact specification can be found at BeanShell

The plug-in attaches to the program ORBADA in many places. Provides a scripting language to better and more easily take advantage of the program.
Listed below are places where you can use a scripting language:

  • BeanShell view is available from the menu View
  • Script executed at the opening and closing of the program
  • In the view of SQL queries by using block beanshell { ... }
  • Action scripts anchoring wherever, where is used a universal mechanism of action

4.A.1.2. BeanShell view

BeanShell view, is available by selecting from a menu View->BeanShell editor
View is available for both the perspective connection to the database and tool perspective.

In the BeanShell editor is available all Java classes and objects of the program. Are also defined permanent:

PropertyDescription
selfConstant indicating the class object Interpreter BeanShell library
databaseIf you have a connection to the database, this constant is an object of class Database UseDB library
applicationAllows you to access the properties through the application's interface features IApplication of ORBADA program

4.A.1.3. Startup and shutdown the ORBADA program

Configuration scripts start and finish is available in Program->Settings->Plug-in settings->BeanShell->Start and shutdown

The scripts will be executed immediately after starting the program and just before its closure.

In the BeanShell editor is available all Java classes and objects of the program. Are also defined permanent:

PropertyDescription
selfConstant indicating the class object Interpreter BeanShell library
applicationAllows you to access the properties through the application's interface features IApplication of ORBADA program

4.A.1.4. SQL queries view

In SQL queries view, you can use BeanShell script in two ways:

  1. Typing between beanshell {, a } script
    np. beanshell { 2 +2 *2; }
    Once launched, the screen in the window, will be the result of executing the script.
  2. The SQL commands by typing between beanshell {, a } script eg.:
    1. select beanshell { 2 +2 *2; } from dual
      When you run the query, on results list, you will see a row with the value "6"
    2. select 'beanshell { new pl.mpak.util.id.VersionID(1, 0, 0, 150) }' value from dual
      When you run the query on results list, you will see a text representation of the version '1.0.0.150'
    Note
    In this case, the script will be executed before executing the SQL command, and the result will be inserted in place of the script as a string

In the BeanShell editor is available all Java classes and objects of the program. Are also defined permanent:

PropertyDescription
selfConstant indicating the class object Interpreter BeanShell library
applicationAllows you to access the properties through the application's interface features IApplication of ORBADA program

4.A.1.5. Action configuration

Description of the steps that must be done to hook the BeanShell actions in program.

4.A.1.6. Predefined functions BeanShell

BeanShell provides a collection of predefined commands that are in the directory bsh-2.0b4.jar\bsh\commands
In addition, the plugin provides a few commands useful during software development. They are located in the directory orbada-beanshell.jar\pl\mpak\orbada\beanshell\commands

4.A.1.7. Examples

A few examples showing how to write BeanShell scripts and where to use them