48
TIBCO ActiveMatrix ® Implementation Type for Scripting in Ruby User’s Guide Software Release 1.0 December 2008

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

TIBCO ActiveMatrix®

Implementation Type for Scripting

in Ruby

User’s Guide

Software Release 1.0December 2008

Important Information

SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDED OR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITED ADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLED SOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE OR FOR ANY OTHER PURPOSE.

USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONS OF A LICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSE AGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USER LICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THE SOFTWARE (AND WHICH IS DUPLICATED IN LICENSE.PDF) OR IF THERE IS NO SUCH SOFTWARE LICENSE AGREEMENT OR CLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATED IN THE “LICENSE” FILE(S) OF THE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMS AND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF AND AN AGREEMENT TO BE BOUND BY THE SAME.

This document contains confidential information that is subject to U.S. and international copyright laws and treaties. No part of this document may be reproduced in any form without the written authorization of TIBCO Software Inc.

TIB, TIBCO, TIBCO ActiveMatrix, TIBCO Adapter, TIBCO Administrator, TIBCO AutoMeditate, TIBCO Enterprise Message Service, ActiveMatrix, AutoMediate, Predictive Business, Information Bus, The Power of Now, and TIBCO Rendezvous are either registered trademarks or trademarks of TIBCO Software Inc. in the United States and/or other countries.

EJB, Java EE, J2EE, and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.

All other product and company names and marks mentioned in this document are the property of their respective owners and are mentioned for identification purposes only.

THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALL OPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THE SAME TIME. PLEASE SEE THE README.TXT FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON A SPECIFIC OPERATING SYSTEM PLATFORM.

THIS DOCUMENT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.

THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS DOCUMENT AT ANY TIME.

THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY OR INDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES.

Copyright © 2005-2008 TIBCO Software Inc. ALL RIGHTS RESERVED.

TIBCO Software Inc. Confidential Information

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

| iii

Contents

Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby Documentation . . . . . . . . . . . . . . . . . . . . . viii

Other TIBCO Product Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

Third Party Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x

How to Contact TIBCO Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

Chapter 1 Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Installation Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Installation Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Installation Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Supported Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Installer Account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Installer Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

System Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Disk Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Installation Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

TIBCO ActiveMatrix Service Bus or Service Grid 2.1.x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

JRuby 1.1.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Installing TIBCO ActiveMatrix Implementation Type for Scripting in Ruby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Installing in GUI Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Installing in Console Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Installing in Silent Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Post-Installation Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Enabling and Activating Ruby Containers on ActiveMatrix Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Setting up ActiveMatrix Nodes For Ruby Gems Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Uninstalling the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Chapter 2 Developing and Deploying Ruby Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Ruby Component Development and Deployment Process Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

iv | Contents

Sample Hello World Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Developing Ruby Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Ruby Component Development. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Setting Plug-in Project Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Specifying the Implementation Script and Library Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Setting Script Validation Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Packaging Ruby Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Developing Ruby Component Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Life Cycle Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Invoking a Reference Operation in a Ruby Component Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Logging From a Ruby Component Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Running Service Assemblies Containing Ruby Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Deploying Service Assemblies Containing Ruby Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Accessing Ruby Gems Libraries from Ruby Component Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Updating a Dynamically Bound Ruby Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

| v

Tables

Table 1 General Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x

Table 2 Syntax Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

vi | Tables

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

| vii

Preface

TIBCO ActiveMatrix® Implementation Type for Scripting in Ruby is a scalable and extensible platform for developing, deploying, and managing applications that conform to a service-oriented architecture.

Topics

• Related Documentation, page viii

• Typographical Conventions, page x

• How to Contact TIBCO Support, page xiii

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

viii | Related Documentation

Related Documentation

This section lists documentation resources you may find useful.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby Documentation

The following documents form the TIBCO ActiveMatrix Implementation Type for Scripting in Ruby documentation set:

• TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide: Read the user’s guide to learn how to develop Ruby components.

• TIBCO ActiveMatrix Implementation Type for Scripting in Ruby Release Notes: Read the release notes for a list of new and changed features. This manual also contains lists of known issues and closed issues for this release.

Other TIBCO Product Documentation

You may find it useful to read the documentation for the following TIBCO products:

• TIBCO ActiveMatrix® Service Bus

• TIBCO ActiveMatrix® Service Grid

• TIBCO ActiveMatrix® Registry

• TIBCO ActiveMatrix® Policy Manager

Third Party Documentation

TIBCO ActiveMatrix software supports the following standards:

• Service Component Architecture

http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications

• World Web Web Consortium web services activity

http://www.w3.org/2002/ws/

— Simple Object Access Protocol (SOAP) 1.1 W3C Note

http://www.w3.org/TR/2000/NOTE-SOAP-20000508/

— WSDL 1.1 W3C Note

http://www.w3.org/TR/wsdl

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Preface | ix

• OASIS

http://www.oasis-open.org/committees/tc_cat.php?cat=ws

— UDDI Version 3 OASIS Standard

http://www.oasis-open.org/specs/index.php#uddiv2

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

x | Typographical Conventions

Typographical Conventions

The following typographical conventions are used in this manual.

Table 1 General Typographical Conventions

Convention Use

TIBCO_HOME

ENV_NAME

ENV_HOME

AMX_HOME

AMX_ADMIN_HOME

Many TIBCO products are installed within the same home directory. This directory is referenced in documentation as TIBCO_HOME. The value of TIBCO_HOME depends on the operating system. For example, on Windows systems the default value is C:\tibco.

Other TIBCO products are installed into an installation environment. A product installed into an installation environment does not access components in other installation environments. Incompatible products and multiple instances of the same product must be installed into different installation environments. An installation environment consists of the following properties:

• Name Identifies the installation environment. The name is appended to the name of Windows services created by the installer and is used in the path to the product in the Windows Start > All Programs menu. This directory is referenced in documentation as ENV_NAME.

• Description Provides information about what the environment contains or is used for.

• Path The directory into which the product is installed. This directory is referenced in documentation as ENV_HOME. The value of ENV_HOME depends on the operating system. For example, on Windows systems the default value is C:\tibco.

TIBCO ActiveMatrix installs into a directory inside ENV_HOME. This directory is referenced in documentation as AMX_HOME. The value of AMX_HOME depends on the operating system. For example, on Windows systems the default value is C:\tibco\ruby\.

TIBCO ActiveMatrix Administrator installs into a directory inside ENV_HOME. This directory is referenced in documentation as AMX_ADMIN_HOME. The value of AMX_ADMIN_HOME depends on the operating system. For example, on Windows systems the default value is C:\tibco\amxadministrator\.

code font Code font identifies commands, code examples, filenames, pathnames, and output displayed in a command window. For example:

Use MyCommand to start the foo process.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Preface | xi

bold code font Bold code font is used in the following ways:

• In procedures, to indicate what a user types. For example: Type admin.

• In large code samples, to indicate the parts of the sample that are of particular interest.

• In command syntax, to indicate the default parameter for a command. For example, if no parameter is specified, MyCommand is enabled:

MyCommand [enable | disable]

italic font Italic font is used in the following ways:

• To indicate a document title. For example: See TIBCO BusinessWorks Concepts.

• To introduce new terms For example: A portal page may contain several portlets. Portlets are mini-applications that run in a portal.

• To indicate a variable in a command or code syntax that you must replace. For example: MyCommand pathname

Key combinations Key name separated by a plus sign indicate keys pressed simultaneously. For example: Ctrl+C.

Key names separated by a comma and space indicate keys pressed one after the other. For example: Esc, Ctrl+Q.

The note icon indicates information that is of special interest or importance, for example, an additional action required only in certain circumstances.

The tip icon indicates an idea that could be useful, for example, a way to apply the information provided in the current section to achieve a specific result.

The warning icon indicates the potential for a damaging situation, for example, data loss or corruption if certain steps are taken or not taken.

Table 1 General Typographical Conventions (Cont’d)

Convention Use

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

xii | Typographical Conventions

Table 2 Syntax Typographical Conventions

Convention Use

[ ] An optional item in a command or code syntax.

For example:

MyCommand [optional_parameter] required_parameter

| A logical ’OR’ that separates multiple items of which only one may be chosen.

For example, you can select only one of the following parameters:

MyCommand para1 | param2 | param3

{ } A logical group of items in a command. Other syntax notations may appear within each logical group.

For example, the following command requires two parameters, which can be either the pair param1 and param2, or the pair param3 and param4.

MyCommand {param1 param2} | {param3 param4}

In the next example, the command requires two parameters. The first parameter can be either param1 or param2 and the second can be either param3 or param4:

MyCommand {param1 | param2} {param3 | param4}

In the next example, the command can accept either two or three parameters. The first parameter must be param1. You can optionally include param2 as the second parameter. And the last parameter is either param3 or param4.

MyCommand param1 [param2] {param3 | param4}

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Preface | xiii

How to Contact TIBCO Support

For comments or problems with this manual or the software it addresses, please contact TIBCO Support as follows.

• For an overview of TIBCO Support, and information about getting started with TIBCO Support, visit this site:

http://www.tibco.com/services/support

• If you already have a valid maintenance or support contract, visit this site:

https://support.tibco.com

Entry to this site requires a username and password. If you do not have a username, you can request one.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

xiv | How to Contact TIBCO Support

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

| 1

Chapter 1 Installation

This chapter describes how to install TIBCO ActiveMatrix Implementation Type for Scripting in Ruby on all supported platforms.

Topics

• Installation Overview, page 2

• Software Requirements, page 6

• Installing TIBCO ActiveMatrix Implementation Type for Scripting in Ruby, page 7

• Post-Installation Procedures, page 10

• Uninstalling the Software, page 11

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

2 | Chapter 1 Installation

Installation Overview

This section provides an overview of TIBCO ActiveMatrix Implementation Type for Scripting in Ruby installation.

Installation Modes

Three installation modes are available: GUI, console, and silent. For details on each mode, see Installing TIBCO ActiveMatrix Implementation Type for Scripting in Ruby on page 7.

Installation Types

Two installation types are available: typical and custom. The typical installation type installs all the products in the package on the specified platform. The custom installation type allows you to select the components to be installed. When you select the custom installation type, the following components are available:

• Design Installs the design time component of the product.

• Runtime Installs the runtime component of the product.

Supported Platforms

Linux

• Red Hat Enterprise Linux 4.0 AS/ES Update 2, GTK on x86

• SUSE Linux Enterprise Server 10, GTK on x86

Windows

• Windows Server 2003 on x86

• Windows XP Professional on x86

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Installation Overview | 3

Installer Account

Microsoft Windows

You must have administrator privileges for the machine on which TIBCO ActiveMatrix Implementation Type for Scripting in Ruby is installed. If you do not have administrator privileges, the installer exits. You must then log out of the system and log in as a user with the required privileges, or request your system administrator to assign the privileges to your account.

If you want to install the product on a network drive, you must ensure that the account used for installation has permission to access the network drive.

UNIX

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby can be installed by any type of user: regular (non-root) user and super-user (root). While installing the product on UNIX platforms, ensure that the same installer account is used to install all TIBCO ActiveMatrix products.

A graphic environment such as CDE or XWindows is required to run the installer in GUI mode.

Installer Log File

The installer log file, tibco_universal_installer.timestamp.username_install.txt, is written to the .TIBCO folder of the user’s home directory. The installer log file captures the following information:

• Installation environment details such as the user that invoked the installer, hostname, Java home in the environment, operating system details, and so on.

• List of assemblies installed.

System Memory

A minimum of 2 GB of physical memory is required.

On Microsoft Windows 2003, before you start the installation, ensure that the files vpd.properties and vpd.properties.tibco.hostname, are available in the USER_HOME\Windows\ folder. If not, copy these files from C:\Windows\ to the USER_HOME\Windows\ directory.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

4 | Chapter 1 Installation

Disk Space

Disk Space Before Installation

Before installing TIBCO ActiveMatrix Implementation Type for Scripting in Ruby you must extract the contents of the installation archive to a temporary directory. The installer files consume up to 55 MB of disk space.

Temporary Disk Space Required by the Installer

The installer requires at least 70 MB of free space in the temporary directory. On Microsoft Windows, temporary directory location is %SystemDrive%:\Documents and Settings\user_name\Local Settings\Temp

If your system does not have sufficient disk space in the default temporary area, you can run the installer with a different temporary directory by using the following option when starting the installer:

-is:tempdir /new_temp

where /new_temp has sufficient free disk space.

The installer calculates the disk space required in the product home location for the selected components before the actual installation (copying of files to system) begins. The installer will proceed only if sufficient free disk space is available in the product home location.

If the disk space required is consumed by another process while the installer is copying the files, the disk space available can be reduced. In such a case, the installer may fail and will then give a failure message.

While performing installation, it is recommended not to run other processes that consume disk space in the product home location.

Disk Space After Installation

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby consumes 90 MB of disk space under TIBCO_HOME.

Installation Directory

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby is installed in the directory AMX_HOME\extensions\ruby\1.0.0. This directory contains the following subdirectories:

• doc Documentation.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Installation Overview | 5

• samples Sample ActiveMatrix SOA project and a TIBCO General Interface client.

• uninstaller_archives Uninstall data.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

6 | Chapter 1 Installation

Software Requirements

This section lists required and optional software products.

TIBCO ActiveMatrix Service Bus or Service Grid 2.1.x

Required. See the respective product documentation for the list of requirements and procedures for installing TIBCO ActiveMatrix Service Bus or TIBCO ActiveMatrix Service Grid.

JRuby 1.1.5

ActiveMatrix Implementation Type for Scripting in Ruby 1.0 supports JRuby 1.1.5.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Installing TIBCO ActiveMatrix Implementation Type for Scripting in Ruby | 7

Installing TIBCO ActiveMatrix Implementation Type for Scripting in

Ruby

This section describes the steps to install TIBCO ActiveMatrix Implementation Type for Scripting in Ruby using the modes described in the sections:

• Installing in GUI Mode on page 7

• Installing in Console Mode on page 8

• Installing in Silent Mode on page 9

Installing in GUI Mode

In the GUI mode, the installer presents panels that allow you to make choices about product features, product installation location, and so on.

The installation procedure for Microsoft Windows and UNIX platforms is almost the same. Wherever the steps differ, platform specific information is provided.

To install the product in GUI mode:

1. Open the physical media or download the TIBCO ActiveMatrix Implementation Type for Scripting in Ruby package.

2. Extract the contents of the package to a temporary directory.

3. Navigate to the temporary directory.

4. Run TIBCOUniversalInstaller.

5. The Welcome screen appears. Click Next.

6. The License Agreement screen appears. After reading through the license text, click I accept the terms of the license agreement and then click Next.

Before installing TIBCO ActiveMatrix Implementation Type for Scripting in Ruby, shut down the Management Daemon process, ActiveMatrix Administrator servers, and ActiveMatrix nodes running on the machine.

After you complete the installation, restart in the following order:

1. ActiveMatrix Administrator server

2. Management Daemon process

3. ActiveMatrix nodes

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

8 | Chapter 1 Installation

7. The Important Notice screen appears. Read through the information and click Next.

8. In the Environment drop-down list, select the installation environment you selected for the prerequisite software. Click Next.

9. Select Typical to install all the available features or Custom to choose the features to install. Click Next.

10. If you selected Custom in step 9, the Product Features screen appears. This screen lists the components available for installation. By default, all the components are selected. Uncheck the checkbox next to the component you don’t want installed and click Next. If you did not select Custom, proceed to step 11.

11. The Pre Install summary screen appears. Verify the list of products selected for install and then click Install. Click Yes to All to close any popup windows that display during installation.

12. The Post Install Summary screen appears. This screen summarizes the installation process. Click Finish to complete the installation process and close the installer window.

Installing in Console Mode

In the console mode, you can install the product in an non-Windows environment.

The following procedure explains how to install the product in console mode.

1. Open the physical media or download the TIBCO ActiveMatrix Implementation Type for Scripting in Ruby package.

2. Extract the contents of the package to a temporary directory.

3. Using a console window, navigate to the temporary directory.

4. Run TIBCOUniversalInstaller with the option -console. On Microsoft Windows, run TIBCOUniversalInstaller.exe -console.On UNIX platforms, run TIBCOUniversalInstaller.bin -console

5. Complete the installation by responding to the console window prompts.

While running in the console mode, you can use the following keys to move through the installation process:

Enter: Moves forward in the installer.

BackSpace or 2: Goes back to the previous screen.

3: Cancels the Wizard and exits the installation or uninstallation.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Installing TIBCO ActiveMatrix Implementation Type for Scripting in Ruby | 9

5: Redisplays the current screen.

Installing in Silent Mode

In silent mode, the universal installer does not prompt for any inputs during installation. Instead, the inputs are read from a response file that can be provided as a command line parameter. If no value is specified, the installer uses the default TIBCOUniversalInstaller.silent file.

The TIBCOUniversalInstaller.silent file is packaged in the directory that contains the universal installer. You must edit the file with information for your environment before launching the silent installation. The file includes comments that describe the installation properties you can set. While you can use the TIBCOUniversalInstaller.silent file, it’s good practice to copy the file to a different name and use that file for the silent install.

The following procedure explains how to install the product in silent mode. If errors occur during installation, they will be listed in the installation log file contained in User_Home/.TIBCO directory.

1. Open the physical media or download the TIBCO ActiveMatrix Implementation Type for Scripting in Ruby package.

2. Extract the contents of the package to a temporary directory.

3. Using a console window, navigate to the temporary directory.

4. Make a copy of the TIBCOUniversalInstaller.silent file and rename the file.

5. Using a text editor, open the copied file and update the install location and features to install.

6. Run TIBCOUniversalInstaller -silent -V responseFile="myfilename.silent".

When installation completes, a line similar to the following is written to the installer log file:

Install, com.tibco.installer.util.TIBCOInstaller, dbg.Debug,

The installation has completed. Please check the log file for

additional information.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

10 | Chapter 1 Installation

Post-Installation Procedures

Enabling and Activating Ruby Containers on ActiveMatrix Nodes

Before deploying and running Ruby components you must enable and activate the Ruby container on the nodes that were created before you installed TIBCO ActiveMatrix Implementation Type for Scripting in Ruby. For information on how to perform these procedures, see TIBCO ActiveMatrix Service Grid Release Notes and TIBCO ActiveMatrix Administration.

Setting up ActiveMatrix Nodes For Ruby Gems Libraries

Ruby Gems is a mechanism for packaging and distributing Ruby libraries. For each node on which you plan to deploy a Ruby component that uses a Ruby Gems library:

1. Stop the node.

2. Install the JRuby 1.1.5 Ruby implementation. You can download JRuby from http://jruby.codehaus.org/.

3. Set the java.property.jruby.home property in the node’s TRA file (located in AMX_HOME\data\envname\nodename\bin\envname_nodename.tra) to the location of the JRuby installation.

If the JRUBY_HOME environment variable is set, then you can set this property by adding the following entry to the node’s TRA file:

java.property.jruby.home=%JRUBY_HOME%

If JRUBY_HOME environment variable is not set, add the following entry (assuming JRUBY_HOME is c:\JRuby\.jruby):

java.property.jruby.home=C:\\JRuby\\.jruby

4. Start the node.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Uninstalling the Software | 11

Uninstalling the Software

To uninstall TIBCO ActiveMatrix Implementation Type for Scripting in Ruby:

1. Remap service units containing Ruby components and then relocate service assemblies:

a. In ActiveMatrix Administrator, remap all Ruby service units mapped to nodes running on the machine to nodes running on different machines.

b. Relocate the service assemblies that contain the remapped service units.

2. Stop any nodes with activated Ruby containers.

3. Stop any instances of TIBCO Business Studio.

4. Run the uninstaller:

a. Navigate to the TIBCO_HOME\_uninstall directory and run universal_uninstall. A splash screen displays. Click Next.

b. Keep the default selection Custom Uninstall. Click Next.

c. A screen displays uninstall options for all the installed TIBCO ActiveMatrix products. See TIBCO ActiveMatrix Service Grid Installation for details about uninstalling ActiveMatrix products. Deselect all checkboxes except TIBCO ActiveMatrix Implementation Type for Scripting in Ruby and then click Next.

When uninstalling, popup windows appear warning that an updated file needs to be deleted. Click Yes to All to remove the file and subsequent files in the assembly. Because popup windows are generated for each installed assembly, you may see multiple popup windows.

d. Review the Pre-Uninstall Summary and click Uninstall.

e. The summary screen appears. Click Finish to exit the uninstall wizard. After uninstalling the software, the uninstaller may prompt you to reboot your computer.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

12 | Chapter 1 Installation

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

| 13

Chapter 2 Developing and Deploying Ruby

Components

This chapter describes how to develop and deploy Ruby components and component implementations.

Topics

• Overview, page 14

• Developing Ruby Components, page 19

• Developing Ruby Component Implementations, page 26

• Running Service Assemblies Containing Ruby Components, page 28

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

14 | Chapter 2 Developing and Deploying Ruby Components

Overview

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby supports a hybrid approach to developing Ruby components. In top-down development you start with WSDL files that define the component’s services and references.In bottom-up development you start with an implementation that defines the component’s service. When developing Ruby components with ActiveMatrix Implementation Type for Scripting in Ruby, you start with a WSDL file and use it to add services or references to the component. You then bind a Ruby script that implements the services and invokes the reference to the component. There are two ways to bind the script: static and dynamic.

In static binding, you explicitly specify the script’s workspace location in the component’s script property. When you specify the script, TIBCO ActiveMatrix Implementation Type for Scripting in Ruby validates that the port types and operations defined in the WSDL file are implemented in the classes and functions defined in the script. When you package the component into a service assembly, the script is included in the package and cannot be modified once the service assembly is deployed.

With dynamic binding, you bind the component’s script property to a substitution variable. At deployment time, you must configure the substitution variable in the service assembly to reference a script available on the machine on which you deploy the assembly. The script is then validated when you deploy the service assembly. Since the script is not packaged in the service assembly, you can update the script after the service assembly has been deployed.

Ruby Component Development and Deployment Process Summary

The process for developing and deploying a composite containing Ruby components and the tools used in the process can be summarized as follows:

1. In a Ruby development environment, create a Ruby script. You can use the Ruby Development Toolkit (RDT) 0.9.1 plug-in to TIBCO Business Studio, included with TIBCO ActiveMatrix Implementation Type for Scripting in Ruby or your preferred development environment. For information on how to use RDT, in TIBCO Business Studio see Help > Help Contents > Ruby Development Tools.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Overview | 15

If you do not have a Ruby interpreter installed on your machine, the first time you start TIBCO Business Studio after installing TIBCO ActiveMatrix Implementation Type for Scripting in Ruby the following dialog displays:

Click Use included JRuby.

2. Create an ActiveMatrix SOA project.

3. Import the Ruby script and the WSDL files defining the services and references that will be added to the Ruby component into the project.

4. Open the composite and add the Ruby component to the composite canvas.

5. Add services or references defined by a WSDL files to the component.

6. Configure the component to reference the Ruby script.

Sample Hello World Service

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby is distributed with sample files for a Hello World service that returns an acknowledgement string when a user submits a name to a Hello World SOAP client. The sample files include an ActiveMatrix composite containing a Ruby component and SOAP service, a deployable service assembly archive, and a TIBCO General Interface SOAP client.

The files for the sample are located in the directories AMX_HOME\extensions\ruby\1.0.0\samples\SOAProject and AMX_HOME\extensions\ruby\1.0.0\samples\Client.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

16 | Chapter 2 Developing and Deploying Ruby Components

The SOAProject directory contains the subdirectories:

• com.tibco.amx.sample.helloworld.simple.ruby.soa, which contains an ActiveMatrix SOA project that you can open in TIBCO Business Studio. The project contains the following subfolders:

— Composites folder containing a composite named com.tibco.amx.sample.helloworld.simple.ruby.soa.composite:

The Composites folder also contains a concrete WSDL file named HelloWorld_HelloWorldPT_511868935.wsdl which you can used to develop a SOAP client for the Hello World service. This WSDL was used to develop the HelloWorldRubyClient TIBCO General Interface client.

— Deployment Packages folder containing a service assembly archive com.tibco.amx.sample.helloworld.simple.ruby.soa.zip which you can deploy using ActiveMatrix Administrator.

— Service Descriptors folder containing the HelloWorld.wsdl file and the HelloWorld.rb implementation script.

• com.tibco.amx.sample.helloworld.simple.ruby.soaRubyComponent.scri

pt.interfaces, which contains the data binding classes that enable the Ruby container to convert ActiveMatrix data types to Ruby data types and vice versa.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Overview | 17

Developing Hello World Service

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby includes a cheat sheet that guides you through the process of developing the Hello World sample service. For information on cheat sheets, see Help > Help Contents > Reference > User interface information > Help contents > Working with cheat sheets. To access the Ruby Hello World cheat sheet, select Help > Cheat Sheets > ActiveMatrix SOA Tutorials > General > Hello World Ruby Example.

Deploying and Running Hello World Service

The Client folder contains a TIBCO General Interface client for invoking the Hello World service. To run the Hello World service and client:

1. Upload the Hello World service assembly archive following the procedures in Uploading a Service Assembly in TIBCO ActiveMatrix Administration.

2. Configure the service assembly and bind the substitution variable /com.tibco.amx.sample.helloworld.simple.ruby.soa/Shared

Resources/SubstitutionVariables/rubyScript to AMX_HOME\extensions\ruby\1.0.0\samples\SOAProject\com.tibco.a

mx.sample.helloworld.simple.ruby.soa\Service

Descriptors\HelloWorld.rb following the procedures in Configuring a Service Assembly in TIBCO ActiveMatrix Administration.

3. Deploy the archive following the procedures in Working with Service Assemblies in TIBCO ActiveMatrix Administration.

4. Open the file AMX_HOME\extensions\ruby\1.0.0\samples\Client\HelloWorldRubyC

lient.html in a browser. The following displays:

5. Type a name in the Name field.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

18 | Chapter 2 Developing and Deploying Ruby Components

6. Click the Submit button. The following displays:

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Developing Ruby Components | 19

Developing Ruby Components

This section describes how to develop Ruby components.

Ruby Component Development

To perform Ruby component development you begin by creating a Ruby component. Once you have created the component, TIBCO Business Studio provides an easy way to add services and references to Ruby components. When you add services and references to a Ruby component Business Studio creates a Java plug-in project, generates binding classes that convert between Ruby data types and ActiveMatrix data types and Java interfaces that represent the port types and adds the classes and interfaces to a Java plug-in project. This section discusses the Ruby component development tasks:

• Creating a Ruby Component on page 19

• Using Services in Ruby Components on page 20

• Using References In a Ruby Component on page 22

Creating a Ruby Component

To create a Ruby component:

1. Start TIBCO Business Studio.

If you do not have a Ruby interpreter installed on your machine, the first time you start TIBCO Business Studio after installing TIBCO ActiveMatrix Implementation Type for Scripting in Ruby the following dialog displays:

Click Use included JRuby.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

20 | Chapter 2 Developing and Deploying Ruby Components

2. Create an ActiveMatrix SOA project. When you select a project template, select Basic SOA Project.

3. Open the project’s composite.

4. Click the canvas and click the Ruby component icon in the popup toolbar (see Popup Toolbars in TIBCO ActiveMatrix Composite Editor User’s Guide) or click Ruby in the Components group in the Palette and click the canvas. A Ruby component is added to the Components area.

5. Type a name in the component’s activated input field. The name cannot contain spaces.

Using Services in Ruby Components

A service represents the port type provided by the component. ActiveMatrix Implementation Type for Scripting in Ruby services support all MEPs.

Adding a Service to a Ruby Component

To add a service to a Ruby component:

1. Add the WSDL file defining the exported port type to the project.

2. Hover over the component until the popup toolbar (see Popup Toolbars in TIBCO ActiveMatrix Composite Editor User’s Guide) displays and then click the component service icon in the toolbar.

or

Click the Service icon in the Palette and click the component.

or

Click the component. In the Properties view, click the Services tab. Click Add.

A Resource Picker displays.

a. In the List of Files filter, enter the name of a port type to expand the nodes or manually expand the nodes until you see the desired port type in the tree below the filter. Click the port type and then click OK.

3. The first time you add a service to a Ruby component, a dialog where you specify the name of the Java plug-in project that will be created to contain the data binding classes and Java interfaces corresponding to the exported WSDL port types displays. Accept the default project name, ProjName.ComponentName.script.interfaces, or type a new name. Click OK.

4. Click the Save button .

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Developing Ruby Components | 21

If you have already specified the component implementation script, TIBCO Business Studio validates the script against the component’s services as follows:

— Matches service port types to classes

— Matches service operations to functions

The matching algorithm expects the names to conform to the mapping rules described in Chapter 20: Appendix: Mapping of XML Names of JSR 101 Java API for XML-Based RPC 1.1 available at http://jcp.org/en/jsr/detail?id=101.

If either of the matches fails, TIBCO Business Studio reports an error or warning based on the script validation configuration. See Setting Script Validation Parameters on page 25.

Code Generation

TIBCO Business Studio:

• Creates a Java plug-in project if none exists.

• Adds data binding class and Java interface libraries to the plug-in project. The libraries are stored in JARs named ProjName.ComponentName.script.interfaces/lib/ReferenceName-partner-beans.jar. and ProjName.ComponentName.script.interfaces/lib/ReferenceName-partner-i

nterface.jar.

Regenerating Data Binding Classes and Service Interfaces

After adding a service you may want to modify the WSDL that defines the service. To regenerate the data binding classes and Java service interfaces for a component after you change a type, message, or operation element in the WSDL file, click the Generate Implementation button at the top right of the Implementation tab in the Properties view.

Changes to port type names in the WSDL file are not automatically propagated to generated classes and interfaces. To propagate a change in a port type name, delete service from the component and the generated JAR files from the Java plug-in project and then re-add the service.

Removing a Service from a Ruby Component

To remove a service, do one of the following:

• Right click the component reference icon and select Delete.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

22 | Chapter 2 Developing and Deploying Ruby Components

• In the Properties view, click the Services tab, click the service, and click Remove.

Click the Save button .

Using References In a Ruby Component

A reference is a link to a consumed service. ActiveMatrix Implementation Type for Scripting in Ruby references support all MEPs.

To use a reference in a Ruby component:

1. Add the reference following the procedure described in Adding a Reference to a Ruby Component on page 22.

2. Bind the reference to a component service or composite reference, following the procedure described in Binding a Component Reference to a Component Service or Composite Reference in TIBCO ActiveMatrix Service Grid Component Developer’s Guide.

3. Invoke the reference operation in the script (see Invoking a Reference Operation in a Ruby Component Implementation on page 26).

Adding a Reference to a Ruby Component

To add a reference to a Ruby component:

1. Add the WSDL file defining the referenced port type to the project.

2. Click the component and click the Ruby reference icon in the component popup toolbar (see Popup Toolbars in TIBCO ActiveMatrix Composite Editor User’s Guide)

or

Click the Reference icon in the Palette and click the component.

or

Click the component. In the Properties view, click the References tab and Click Add.

3. A Resource picker displays.

a. Accept the default reference name or type a name in the Name field. In the List of Files field, enter the name of a port type or expand the nodes until you see the desired port type. Click the port type.

b. If the component will initiate reliable conversations, check the Reliable Conversation-End Operation checkbox and select the operation that ends the conversation.When any operation except the end operation within the

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Developing Ruby Components | 23

port type is invoked a conversation is started. When the end operation is invoked, the conversation is terminated.

c. Click OK.

4. The first time you add a reference to a Ruby component, a dialog where you specify the name of the Java plug-in project that will be created to contain the data binding classes and Java interfaces corresponding to the referenced WSDL port types displays. Accept the default project name, ProjName.ComponentName.script.interfaces, or type a new name. Click OK.

5. Click the Save button .

Code Generation

TIBCO Business Studio:

• Creates a Java plug-in project if none exists.

• Adds data binding class and Java interface libraries to the plug-in project. The libraries are stored in JARs named ProjName.ComponentName.script.interfaces/lib/ReferenceName-partner-beans.jar. and ProjName.ComponentName.script.interfaces/lib/ReferenceName-partner-i

nterface.jar.

Removing a Reference from a Ruby Component

To remove a reference, do one of the following:

• Right click the component reference icon and select Delete.

• In the Properties view, click the References tab, click the reference, and click Remove.

Click the Save button .

Setting Plug-in Project Defaults

To set default names for the plug-in project subfolders containing the data binding class and service interface JAR files:

1. Select Window >Preferences....

Both the composite reference to which the component reference is bound and the service to which the component reference is bound must have Reliable Messaging enabled. See Enabling Reliable Messaging in TIBCO ActiveMatrix Composite Editor User’s Guide.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

24 | Chapter 2 Developing and Deploying Ruby Components

2. Click the ActiveMatrix > Script > Code Generation Parameters node.

3. In the Default Parameters area, type the source and JAR folder names.

4. Click OK.

Specifying the Implementation Script and Library Path

The Ruby container uses the component’s implementation script and library settings to load the script and any libraries that the script depends on. If the implementation script property not set, TIBCO Business Studio will raise a validation warning on the composite.

To specify the component implementation script and library path:

1. If you intend to customize the location of the implementation script and library path on some deployment machines, create substitution variables for the script and library locations and set their values to the default paths to the script and library. For information on how to create substitution variables, see Creating a Substitution Variable in TIBCO ActiveMatrix Composite Editor User’s Guide.

2. If you intend to explicitly specify the implementation script, import the script into a project in the TIBCO Business Studio workspace.

3. Open the composite containing the Ruby component and click the component.

4. In the Properties view, ensure that the General tab is selected.

5. In the Script Configuration area, do one of the following:

— Bind the script and library to the substitution variables created in step 1 following the procedure in Binding a Property or Variable to a Substitution Variable in TIBCO ActiveMatrix Composite Editor User’s Guide. The following screenshot shows the Implementation Script property bound to a substitution variable:

— In the Implementation Script field, type path to the script or click Browse and navigate to the script location. If you type the path, it must include a project and resource name. In the Library Path field, type the location of the library on the machine on which the component will be deployed.

6. Click the Save button .

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Developing Ruby Components | 25

If you explicitly specify the script, TIBCO Business Studio validates the script against the component’s services as follows:

— Matches service port types to classes

— Matches service operations to functions

The matching algorithm expects the names to conform to the mapping rules described in Chapter 20: Appendix: Mapping of XML Names of JSR 101 Java API for XML-Based RPC 1.1 available at http://jcp.org/en/jsr/detail?id=101.

If either of the matches fails, TIBCO Business Studio reports an error or warning based on the script validation configuration. See Setting Script Validation Parameters on page 25.

Setting Script Validation Parameters

Every time you add a script or service to a Ruby component, TIBCO Business Studio validates the script against the service. In the Script Validation Parameters dialog you can specify whether TIBCO Business Studio flags a missing class or method as an error or warning. To configure how missing features are reported:

1. Select Window >Preferences....

2. Click the ActiveMatrix > Script > Script Validation Parameters node.

3. In the Default Log Levels area, select the log level in the Class Missing and Method Missing drop-down lists.

4. Click OK.

Packaging Ruby Components

To package Ruby components, follow the procedures described in Working with Service Assemblies in TIBCO ActiveMatrix Composite Editor User’s Guide.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

26 | Chapter 2 Developing and Deploying Ruby Components

Developing Ruby Component Implementations

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby includes the Ruby Development Toolkit 0.9.1 plug-in to TIBCO Business Studio, to support Ruby script development. For information on how to use the toolkit, in TIBCO Business Studio see Help > Help Contents > Ruby Development Tools.

This section describes aspects of developing Ruby component implementations.

Life Cycle Events

The ActiveMatrix runtime exposes component life cycle events—Init, Start, Stop, and Destroy—to component implementations. For information on the relationship between component life cycle events and service assembly life cycle, see Component Life Cycle Events in TIBCO ActiveMatrix Service Grid Component Developer’s Guide. In addition to the actions described in that document, the ActiveMatrix runtime validates the Ruby script when you deploy the service assembly.

When component life cycle events occur, the ActiveMatrix runtime invokes life cycle functions in the Ruby script. In order to have actions performed at component life cycle events add the corresponding functions to the script:

def init

...

end

def start

...

end

def stop

...

end

def destroy

...

end

Invoking a Reference Operation in a Ruby Component Implementation

To invoke an ActiveMatrix reference operation from a Ruby script, add the statement $ReferenceName.operation, where ReferenceName is the name of the reference and operation is the name of the operation. For example, the following statement invokes a credit check operation on a reference named Reference1 and returns the response to a variable named creditCheckResponse:

creditCheckResponse = $Reference1.in(creditcheckRequest)

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Developing Ruby Component Implementations | 27

Logging From a Ruby Component Implementation

To log messages from a Ruby component implementation to the standard output stream prepend a string representing the log level—INFO:, DEBUG:, WARN:—to the message. For example, to log a message at the INFO log level, the syntax is:

puts "INFO: Show this message"

A message with no log level string is logged at the DEBUG level:

puts "Show this message"

To control where log messages are directed, you set the logging configuration for the Ruby service unit that contains the component implementation. For information on logging configurations, see Working with Logging Configurations in TIBCO ActiveMatrix Administration.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

28 | Chapter 2 Developing and Deploying Ruby Components

Running Service Assemblies Containing Ruby Components

The procedures for deploying and running ActiveMatrix service assemblies are discussed in Chapter 8, Deploying Service Assemblies in TIBCO ActiveMatrix Administration. This section describes features unique to service assemblies containing Ruby components.

Deploying Service Assemblies Containing Ruby Components

When deploying service assemblies containing Ruby components, you must ensure the validity of the component’s implementation script and library path properties on the node on which the service assembly is deployed.

If the component’s implementation script property is bound to a script in the ActiveMatrix project, the script is packaged in the service assembly. If you explicitly specify the library path property, you must ensure that the path to the library is valid on the node on which you deploy the service assembly.

An implementation script set via a substitution variable is dynamically bound to the service assembly at deployment time. If the component implementation script and library path properties are bound to substitution variables you may have to reconfigure the variables so that the node on which the assembly is deployed can locate the component implementation script and libraries. The procedures for reconfiguring substitution variables are discussed in Working with Substitution Variables in TIBCO ActiveMatrix Administration.

Whether the script is packaged with or dynamically bound to the service assembly, when you deploy the service assembly the ActiveMatrix dynamically runtime validates the script against the exported services. If there is a validation error, deployment fails.

Accessing Ruby Gems Libraries from Ruby Component Implementations

Ruby Gems (http://www.rubygems.org/) is a packaging mechanism for destributing Ruby programs and libraries. Some Ruby Gems libraries make use of JAR files. For example, the Active Record Ruby Gem requires database driver JAR files.

When using a Ruby Gem library from a Ruby component implementation, special handling of these JAR files is required. This is needed because ActiveMatrix is an OSGI-based platform and just setting class path for the JAR files would not yield desired result. This section describes how to make these JAR files accessible to the ActiveMatrix Implementation Type for Scripting in Ruby runtime.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Running Service Assemblies Containing Ruby Components | 29

ActiveMatrix Implementation Type for Scripting in Ruby contains an empty Java plug-in named com.tibco.amxext.ruby.gems.wrapper which can be used as a storage location for all external JAR files required by Ruby Gems.

To use JAR files first you add them to the wrapper plug-in. For example, to allow the Active Record Ruby Gem to communicate with a MySQL database, you add the following JAR files to the wrapper: jdbc_adapter_internal.jar and mysql-connector-java-5.0.4-bin.jar.

Then, on each node on which you deploy Ruby components that access the libraries you export the wrapper plug-in to the ActiveMatrix plug-in store located in the directory ENV_HOME\components\eclipse.

Each time you export the plug-in, the plug-in directory is updated. You must restart the node so that the ActiveMatrix Implementation Type for Scripting in Ruby runtime uses the latest version.

Updating the Ruby Gems Wrapper Plug-in

To update the com.tibco.amxext.ruby.gems.wrapper plug-in:

1. Run TIBCO Business Studio.

2. Import the plug-in project AMX_HOME\extensions\ruby\1.0.0\samples\RubyGems\wrapper.plugin\com.tibco.amxext.ruby.gems.wrapper into your workspace using File > Import... > General >Existing Projects into Workspace.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

30 | Chapter 2 Developing and Deploying Ruby Components

3. Add the JAR files you want to use to the project:

4. Open the com.tibco.amxext.ruby.gems.wrapper\META-INF\MANIFEST.MF file.

5. Click the Runtime tab.

6. In the Classpath section, click the Add... button. Select the JARs you added in step 3 and click OK.

7. Save the MANIFEST.MF file.

8. In the Exported Packages section, click the Add... button. Select all the packages from the JARs you added in step 3 and click OK.

9. Save the MANIFEST.MF file.

In the General Information section in the Overview tab, the Host plug-in field is set to com.tibco.tpcl.org.jruby. Do not modify this setting.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

Running Service Assemblies Containing Ruby Components | 31

10. In the Project Explorer, right-click com.tibco.amxext.ruby.gems.wrapper and select Export....

a. In the Export dialog, select Plug-in Development > Deployable plug-ins and fragments and click Next.

b. In the Destination tab, click the Directory radio button. Type or browse to ENV_HOME\components\eclipse in the destination directory field.

c. Click the Options tab and uncheck Package plug-ins as individual JAR archives.

11. Click Finish.

12. Restart the node.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

32 | Chapter 2 Developing and Deploying Ruby Components

Updating a Dynamically Bound Ruby Script

One of the benefits of developing component implementations using a scripting language is the ease with which you can update and test scripts. ActiveMatrix Implementation Type for Scripting in Ruby allows you take advantage of this capability by supporting reloading of a dynamically bound Ruby script even after the service assembly has been deployed. An updated script is automatically reloaded when you save the script. However, since the script is not revalidated you must ensure that any changes you make to the script do not invalidate the WSDL contract implemented by the script.

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

| 33

Index

A

adding a reference to a Ruby component 22

adding a service to a Ruby component 20, 25

C

creating a Ruby component 23

customer support xiii

D

deploying and running service assemblies containing

Ruby components 28

deploying service assemblies containing Ruby

components 28

developing components 13

developing Ruby component implementations 26

developing Ruby components and component

implementations 19

disk space 4

disk space after installation 4

disk space before installation 4

I

installation

console mode 8

GUI mode 7

silent mode 9

installation directory 4

installation modes 2

installation overview 2

installation types 2

installer account 3

installer log file 3

installing in console mode 8

installing in GUI mode 7

installing in silent mode 9

L

lfe cycle events 26

Linux 2

logging from a Ruby component implementation 27

M

Microsoft Windows 3

O

overview 14

P

packaging Ruby components 25

physical memory requirement 3

post-installation procedures 10

product

platform support 2

TIBCO ActiveMatrix Implementation Type for Scripting in Ruby User’s Guide

34 | Index

R

reference code generation 23

regenerating data binding casses and service

intefaces 21

regenerating service implementations 21

related documentation viii, viii

removing a reference from a Ruby component 23

removing a service from a Ruby component 21

replacing a service in a Ruby component 25

required and optional software 6

Ruby component development 19

S

service code generation 21

services, references, properties, and resources 19

setting defaults for generated component

implementations 23

software requirements 6

specifying the component implementation library

name and path 24, 25

support, contacting xiii

supported platforms 2

system memory 3, 3

T

technical support xiii

temporary disk space required by the installer 4

TIBCO ActiveMatrix Service Grid 2.1.0 6

TIBCO_HOME x

U

uninstalling the software 11

UNIX 3

updating a dynamically bound Ruby script 32

using references in Ruby components 22

using services in Ruby components 19, 20

W

Windows 2