Adobe 38000382 - Macromedia JRun - Mac Manual
Adobe 38000382 - Macromedia JRun - Mac Manual

Adobe 38000382 - Macromedia JRun - Mac Manual

Jrun sdk guide
Table of Contents

Advertisement

Quick Links

JRun SDK Guide

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 38000382 - Macromedia JRun - Mac and is the answer not in the manual?

Questions and answers

Summary of Contents for Adobe 38000382 - Macromedia JRun - Mac

  • Page 1 JRun SDK Guide...
  • Page 2 Trademarks Afterburner, AppletAce, Attain, Attain Enterprise Learning System, Attain Essentials, Attain Objects for Dreamweaver, Authorware, Authorware Attain, Authorware Interactive Studio, Authorware Star, Authorware Synergy, Backstage, Backstage Designer, Backstage Desktop Studio, Backstage Enterprise Studio, Backstage Internet Studio, ColdFusion, Design in Motion, Director, Director Multimedia Studio, Doc Around the Clock, Dreamweaver, Dreamweaver Attain, Drumbeat, Drumbeat 2000, Extreme 3D, Fireworks, Flash, Fontographer, FreeHand, FreeHand Graphics Studio, Generator, Generator Developer's Studio, Generator Dynamic Graphics Server, JRun, Knowledge Objects, Knowledge Stream, Knowledge Track, Lingo, Live Effects, Macromedia, Macromedia M Logo &...
  • Page 3: Table Of Contents

    CONTENTS ABOUT THIS BOOK ......VII Developer resources ............viii About JRun documentation.
  • Page 4 Overview of Windows installations ......... . .18 Windows Installer environments .
  • Page 5 JMC custom tags reference ..........52 add .
  • Page 6 Adding JRun service security ..........92 Loading MBeans through MLETs .
  • Page 7 ABOUT THIS BOOK The JRun SDK Guide is for OEMs and advanced users of Macromedia JRun. This book assumes that you are comfortable using JRun and understand the XML configuration files. This chapter tells you how to access JRun and Macromedia resources, such as websites, documentation, and technical support.
  • Page 8: About This Book

    Developer resources Macromedia, Inc. is committed to setting the standard for customer support in developer education, documentation, technical support, and professional services. The Macromedia website is designed to give you quick access to the entire range of online resources. The following table shows the locations of these resources: Resource Description Information on JRun...
  • Page 9: About Jrun Documentation

    Provides JMC users with usage notes, procedures, and concepts. Accessing online documentation All JRun documentation is available online in HTML and Adobe Acrobat formats. To access the documentation, open the following file on the server that is running JRun: /docs/dochome.htm.
  • Page 10: Other Resources

    Other resources You can consult the following resources for more information on topics described in JRun documentation. Books Servlets, JavaServer Pages, and Tag Libraries JRun Web Application Construction Drew Falkman Macromedia Press, 2001 ISBN: 0789726009 Java Server Pages Application Scott M. Stirling, et al. Development Sams, 2000 ISBN: 067231939X...
  • Page 11 JavaServer Pages Hans Bergsten O’Reilly & Associates, 2000 ISBN: 156592746X JSP Tag Libraries Gal Schachor, Adam Chace, and Magnus Rydin Manning Publications Company, 2001 ISBN: 193011009X Core JSP Damon Hougland and Aaron Tavistock Prentice Hall, 2000 ISBN: 0130882488 JSP: JavaServer Pages (Developer’s Barry Burd Guide) Hungry Minds Inc., 2001...
  • Page 12: Online Resources

    Designing Enterprise Applications Nicholas Kassem with the Java 2 Platform, Enterprise Addison-Wesley, 2000 Edition ISBN: 0201702770 (free download at http://java.sun.com/j2ee/ download.html#blueprints) Building Java Enterprise Systems Paul Perrone and Venkata S.R. “Krishna” .R. with J2EE Chaganti Sams, 2000 ISBN: 0672317958 J2EE: A Bird's Eye View (e-book) Rick Grehan Fawcette Technical Publications, 2001 ISBN: B00005BAZV...
  • Page 13: Contacting Macromedia

    Contacting Macromedia Corporate Macromedia, Inc. headquarters 600 Townsend Street San Francisco, CA 94103 Tel: 415.252.2000 Fax: 415.626.0554 Web: http:// www.macromedia.com Technical support Macromedia offers a range of telephone and web-based support options. Go to http://www.macromedia.com/support/ for a complete description of technical support services. You can make postings to the JRun Support Forum (http://webforums.macromedia.com) at any time.
  • Page 14 About This Book...
  • Page 15: Chapter 1 Introduction To The Sdk

    CHAPTER 1 Introduction to the SDK The JRun Software Development Kit (SDK) contains source code, Javadocs, and utilities for customizing the Macromedia JRun installation. It is primarily intended for OEMs, ISVs, and advanced JRun users. Contents About the JRun SDK....................2 Software requirements .....................
  • Page 16: About The Jrun Sdk

    About the JRun SDK The JRun Software Development Kit (SDK) is for OEM/ISV customers and advanced JRun users who embed, customize, or use the APIs in JRun. In JRun 3.x, the JRun SDK was called the JRun OEM kit. Getting the SDK You can download the JRun SDK from the Macromedia website.
  • Page 17: Software Requirements

    Software requirements You can use the SDK to compile your own custom connectors, recompile the JMC with custom functions, or compile your own JRun installer. Depending on what your purpose is, the SDK has various requirements. The following table describes the tools that you might need while working with the SDK: Tool Used for...
  • Page 18: Sdk File Group

    SDK file group The SDK consists of prebuilt filesets, which are installed under the sdk_root directory. The following table briefly describes these top-level directories: Directory Description filesets Contains the core components of JRun and localization files. For more information on the contents of the sdk_root/filesets directory, “JRun components”...
  • Page 19: Jrun Components

    Subdirectory Description webservices Includes all files used to implement Web Services on JRun. xdoclet Contains files for using the XDoclet XML generation tool with JRun. JRun components The sdk_root/filesets directory contains filesets for all JRun components. It also contains subdirectories for each supported platform with a binary code base for each of the following JRun tools: JRun EJB Deployment Wizard Web Services...
  • Page 20: Jrun Source Code

    JRun source code The JRun SDK includes source code for a subset of JRun tools. This gives you the most granular level of control over the JRun components. The source code is in the sdk_root/src directory in the SDK. The following table describes the files in the sdk_root/src directory of the SDK: Subdirectory Description Contains the source code for the following JRun components:...
  • Page 21: Sdk Documentation

    SDK documentation The docs directory contains this SDK Guide and JRun API Javadocs for the jrunx.jmc packages. The Javadocs for these packages are not included in the retail installation of JRun. Release notes containing last-minute updates to the documentation, known issues, and workarounds for issues are in the sdk_root directory.
  • Page 22 Chapter 1 Introduction to the SDK...
  • Page 23: Chapter 2 Jrun Installer Overview

    CHAPTER 2 JRun Installer Overview This chapter provides an overview of building installers in JRun for Windows and UNIX platforms. For advanced JRun users, it also includes instructions on how to customize your installation of JRun. Contents Installer overview ....................10 Configuring JRun during installation ..............
  • Page 24: Installer Overview

    Installer overview The files included in the JRun SDK for building custom installations are physically separated by functionality. In this book, each functional group is referred to as a module. Based on your license agreement, you can access some or all of these modules. JRun provides several sets of files that you can use to build a custom installer that includes your application running on top of JRun.
  • Page 25: Configuring Jrun During Installation

    Configuring JRun during installation This section describes common techniques that you might use when building either Windows or UNIX custom installers. Custom software requirements Users must have a JRE version 1.3.0 or later, and their system PATH environment variable must include the bin directory of the JRE. User input during installation The following table describes the parameters that the JRun installer requires to complete the installation:...
  • Page 26: Setting Ports

    Setting ports JRun uses several ports for exchanging information between servers and accepting requests from clients. The JRun installer scans for free ports in a default range and sets them during the installation process. The following table describes the ports that you must scan and assign for each JRun server: Port Description...
  • Page 27: Setting The Jmc Username And Password

    For more information on using GetControlPort, see “Using the GetControlPort tool” on page 72. For more information using XMLScript, see JRun Programmer’s Guide. Setting the JMC username and password The JMC requires a username and password to log in. The user sets these during the installation process.
  • Page 28: Building A Customized Version Of Jrun

    Building a customized version of JRun The standard JRun installation gives you some control over which components you can include, however, the SDK includes filesets and the build.txt file so that you can have much finer-grained control over your own installation. The following sections describe how to use the JRun filesets and build.xml file to customize your installation.
  • Page 29: Setting The Language

    Setting the language The SDK includes the following directories for creating custom localized JRun installations: sdk_root/filesets/english sdk_root/filesets/french sdk_root/filesets/japanese These directories include localized versions of JRun files. You can set the language using the Ant command. The following example shows an installer that uses the French-language fileset: %>...
  • Page 30 Chapter 2 JRun Installer Overview...
  • Page 31: Chapter 3 Windows Jrun Installers

    CHAPTER 3 Windows JRun Installers This chapter focuses on preparing a customized installation image of Macromedia JRun for OEM customers using a Microsoft Windows Installer development environment. Contents Overview of Windows installations................ 18 Customizing JRun installers with Windows Installer ..........19 Working with InstallShield Developer 7 ..............
  • Page 32: Overview Of Windows Installations

    Overview of Windows installations The JRun SDK includes merge modules that correspond to functional components in JRun. You can easily customize these modules, and add or remove them from installers on the Windows platform. When creating custom installers for the Windows platform, you have two choices: Windows Installer environment Non-Windows Installer environment This section explains the differences between the two environments.
  • Page 33: Customizing Jrun Installers With Windows Installer

    For information on using the Windows Installer wrapper that lets you use the merge modules to build JRun installers in a non-Windows Installer environment, see “Using the Windows Installer wrapper” on page Customizing JRun installers with Windows Installer The JRun SDK natively supports Windows Installer development environments by including the JRun core components as merge modules.
  • Page 34: Merge Module List

    Merge module list The merge modules roughly correspond to the filesets in the sdk_root/filesets/all directory of the SDK. The following table describes the merge modules: Merge module File name Description Core JRun4Core.msm (Required) Includes the basic files to run JRun and serve J2EE applications. Also includes the migration tool, XMLScript, and the JSPC compiler.
  • Page 35: Working With Installshield Developer 7

    Working with InstallShield Developer 7 To work with the OEM version of JRun for the Windows Installer development environment, you copy the merge modules into your defined Merge Module folder, and link the merge modules into your install. Note: The JRun Core merge module is the minimum that is required to build a JRun installer.
  • Page 36: Connecting A Merge Module

    Connecting a merge module You connect a merge module to existing Features within the InstallShield project. In order to map the modules to the Features, you must perform the following tasks: Create the Features. Connect the Features to the merge modules. Set the default destinations for each merge module.
  • Page 37 To connect the merge module to the new feature: 1 Select Specify Application Data > Merge Modules. InstallShield displays the available merge modules in the center pane, as the following figure shows: 2 Select the Feature that you want to connect. 3 Right- click the merge module that you want to connect to the Feature, and select Properties.
  • Page 38: Using Windows Installer On The Command Line

    4 In the Destination drop-down list box, select INSTALLDIR. 5 Click OK. 6 Repeat steps 2 through 5 for each merge module and feature combination. Using Windows Installer on the command line In addition to GUI tools such as InstallShield and Wise Solutions, you can use the Windows Installer service from the command line to create an installer from merge modules.
  • Page 39: Using The Windows Installer Wrapper

    Using the Windows Installer wrapper The Windows Installer wrapper has a graphical interface, however, its primary use is to run the Windows installation unattended. Run the Windows Installer wrapper, using the following command line syntax: setup.exe /s /v"/qn INSTALLDIR=<path to install>" The following table describes the command line arguments: Command line argument Description...
  • Page 40 Chapter 3 Windows JRun Installers...
  • Page 41: Chapter 4 Platform-Independent Jrun Installers

    CHAPTER 4 Platform-Independent JRun Installers This chapter focuses on preparing a customized installation image of Macromedia JRun 4 for OEM customers who are using any platform. Contents About files for custom installations ................ 28 Using BIN files...................... 28...
  • Page 42: About Files For Custom Installations

    About files for custom installations The JRun SDK includes the following groups of files that you can use to create custom JRun installers on any supported platform: Prebuilt binary files that you can use across platforms, separated into BIN files functional components.
  • Page 43: Bin File Properties

    BIN file File name Description Web services JRun4WebServices.bin (Optional) Includes all files used to implement web services on JRun. Documentation JRun4Docs.bin (Optional) Includes the PDF and HTML files for the basic documentation set. JDBC drivers JRun4JDBCDrivers.bin (Optional) Includes the JRun JDBC drivers.
  • Page 44 Chapter 4 Platform-Independent JRun Installers...
  • Page 45: Chapter 5 Embedding Jrun

    CHAPTER 5 Embedding JRun This chapter is intended for OEM customers who want to run their applications on top of the JRun application server and hide JRun from their customers. It includes techniques for adding functionality that transparently modifies the JRun server environment.
  • Page 46: Connecting To External Web Servers

    Connecting to external web servers After you install and configure JRun, you can connect it to an external web server so that requests made to Apache, for example, are examined by the JRun filter, processed, and then sent back through the Apache web server to the requesting client. Be aware that each JRun server is by default connected to an instance of the JRun Web Server (JWS).
  • Page 47: Including The Web Server Configuration Tool In The Installer

    Including the Web Server Configuration tool in the installer To set up the Web Server Configuration tool to configure the connection without requiring your users to run it, you can supply its settings and run it from the command line during the installation process. You can insert the following example into your installation scripts.
  • Page 48: Working With Web Applications

    Working with web applications This section describes how to work with web applications when building JRun installers or embedding JRun as your application server. Hiding JSP source code When deploying JSP pages as part of a web application, you might not want to provide your customers with the clear text version of those pages (the .jsp files).
  • Page 49: Adding Web Applications

    Precompiling JSPs When you turn off compilation, you must include the corresponding class files for all JSP pages in your installation. Therefore, you must precompile all JSP pages to create the class files before you deploy the application. You perform precompilation in one of two ways: With JSP page compilation enabled, request every JSP page in your application.
  • Page 50: Hiding The Jmc

    Application name JRun server File name Default samples jrun_root/servers/samples/default-ear/ Flash Remoting Samples samples jrun_root/servers/samples/flashsamples-ear/ SmarTicket samples jrun_root/servers/samples/smarticket.ear Techniques samples jrun_root/servers/samples/techniques-ear/ TravelNet samples jrun_root/servers/samples/travelnet-ear/ Web Services samples jrun_root/servers/samples/ws-ear/ WorldMusic samples jrun_root/servers/samples/worldmusic.war Note: The samples server is not included as a module in the JRun SDK. Hiding the JMC Retail customers use the JRun Management Console (JMC) to administer the installation and configuration of JRun and change settings, such as thread management...
  • Page 51: Rebranding Jrun Tools

    Rebranding JRun tools JRun includes several executable JAR files that have GUIs. These tools rely on image files and resource bundles for their look and feel. It is possible to edit these files to rebrand these tools. The tools with GUIs are: JRun Launcher Web Server Configuration tool JRun Enterprise Deployment Wizard...
  • Page 52 Replacing images The wsconfig.jar executable JAR file contains images used in the Web Server Configuration tool. The images are located in the /jrunx/connectorinstaller/gui/resources directory. The tool reads in these images at runtime. When you change the images, they appear the next time that you start the tool.
  • Page 53: Replacing Text

    Replacing text The wsconfig.jar executable JAR file contains text files that are used in the Web Server Configuration tool. The text files are located in the /jrunx/connectorinstaller/gui directory. Each resource bundle provides the text for the tool in one language. The following table describes the resource bundles used by the Web Server Configuration tool: File...
  • Page 54: Rebranding The Jrun Launcher

    Rebranding the JRun Launcher Retail JRun customers use the JRun Launcher to start, stop, and restart JRun servers. As an OEM, you can rebrand the tool to make it look like it is part of the customer’s application suite. To rebrand the JRun Launcher: 1 Stop all JRun servers and JRun utilities.
  • Page 55 Replacing text The jrun.jar executable JAR file contains text files used in the JRun Launcher. The text files are located in the /jrunx/launcher directory. To rebrand the JRun Launcher, change the values of the tokens in the properties file. The following table describes the tokens that you will most likely change for the JRun Launcher tool: Token...
  • Page 56: Rebranding The Jmc

    Rebranding the JMC As an OEM, you can rebrand the JRun Management Console (JMC) so that it appears to be part of your application toolset. You can also add your own panels to include settings that are specific to your application. You use the supplied JMC source code to rebrand the JMC.
  • Page 57 The following table describes the targets in the top-level build.xml file of the JMC application: Target Description compile Compiles the JMC application with an open directory structure. The open directory must be in the server deploy directory. This is the default target for the project. package Compiles the JMC application as an EAR file rather than an open directory structure.
  • Page 58: Creating A Custom Jrun Interface

    Creating a custom JRun interface To let your customers interact with the JRun servers and services but still maintain your application’s brand, you can do one of the following: Build a JRun management interface using the JMC custom tag library. For more information, see Chapter 6, “Using the JMC Custom Tag Library”...
  • Page 59: Using Exit Handlers

    Using exit handlers JRun lets you control the way your application behaves if it is running in the same virtual machine (VM) as JRun when JRun exits. You can use a custom exit handler to provide your own error messages or clean up files in the event of an unplanned exit or fatal error. By default, JRun calls the method with an exit code when exiting from System.exit...
  • Page 60: Exit Codes

    Exit codes The following exit codes are valid: Launcher.RESTART_EXIT Launcher.FATAL_ERROR_EXIT The normal execution of JRun commands (other than restart and status) do not produce an exit code or call the exit handler. Chapter 5 Embedding JRun...
  • Page 61: Chapter 6 Using The Jmc Custom Tag Library

    CHAPTER 6 Using the JMC Custom Tag Library The JMC uses its own custom tag library that provides access to JRun services. You can access this tag library and build JSPs that control the JRun environment. This chapter describes how to access the JMC custom tag library, defines the tags, and provides examples of using the tags.
  • Page 62: Extracting The Jmc Custom Tag Library

    Extracting the JMC custom tag library The JMC tag library is part of the JMC application, stored as jmc-app.ear in the admin JRun server’s root directory. JRun automatically deploys this application when you start the admin server. In order to use the tag library, you must put a copy of it in your web application’s lib directory.
  • Page 63: Strategies For Working With The Jmc Custom Tags

    Strategies for working with the JMC custom tags The JMC custom tags provide power and flexibility when working with JRun services and objects. This section describes some strategies for working with this custom tag library. Finding services, classes, and methods To find the possible attributes for services, look in the following places: Use this web-based interface to access services using JMX.
  • Page 64: Using The Mbean Attribute

    attribute identifies the JRun server. The attribute is usually used in server server combination with the attribute, unless otherwise noted. service If you specify a attribute but do not specify a attribute, the tag defaults service server to the current JRun server on which the JSP is running. Using the mbean attribute attribute specifies a JRun service that has an MBean interface.
  • Page 65: Using The Errorid Attribute

    If the tag does not specify Offline in its name, the tag gets and sets the attribute using Java Management Extensions (JMX). The JRun server must be running and the change immediately takes place on the running server. Some offline tags have non-offline (or online) counterparts. The following table lists offline tags and their online counterparts, if any: Offline tag Online counterpart...
  • Page 66: Jmc Custom Tags Reference

    JMC custom tags reference This section describes the custom tags in the JMC custom tag library. Adds a new data source, service, cluster, or server. The add tag can also add a server to a Description cluster. You specify properties for the add tag using the parameter tag. For information on using the parameter tag, see parameter on page Attributes...
  • Page 67 Attribute Description server=X Adds server X using the following parameters set in the parameter tag: servername (Optional.) Registers a JRun server under a different name than the server property. Only used for remote JRun servers. host Specify "localhost" or a remote machine or hostname. port Specify a JNDI port to access a remote JRun server.
  • Page 68: Addofflinepropertyvalue

    addOfflinePropertyValue Appends the name and value as a property to the specified service in the jrun.xml file. Description tag is similar to tag. This tag is addOfflinePropertyValue setOfflineProperty often used when adding properties for the DeployerService. Attributes Attribute Description service (Required.) The name of the service.
  • Page 69: Getconfiguration

    The following example detects if the samples server exists and then lists any read-only Example files or directories in the samples directory: <jmcmgmt:checkServer server="samples" directoryExistsId="exists"/> <% if (exists.booleanValue()) %> <% { %> <jmcmgmt:checkServer server="samples" readOnlyFilesId="read_only_files"/> <%= read_only_files %> <% } %> getConfiguration Retrieves an instance of the JMCConfiguration object and returns it as the variable Description...
  • Page 70: Getofflineproperty

    getOfflineProperty Returns a property value of the specified service. The tag reads the Description getOfflineProperty property directly from a file, regardless of whether the server is running. The tag reads properties from jvm.config, jrun.xml, or jndi.properties getOfflineProperty files. Attributes Attribute Description service Specifies the service path for the service.
  • Page 71: Getofflinepropertyvalues

    getOfflinePropertyValues Returns a java.util.List of all the properties for the specified service’s attributes in the Description jrun.xml file. For details on specifying a server and service path, see addOfflinePropertyValue on page Attributes Attribute Description service (Required.) The path of the service. server The name of the JRun server.
  • Page 72: Getserver

    Attribute Description Returns the named property of the specified enterprise application. ejbJar Returns the named property of the specified EJB JAR file. webapp Returns the named property of the specified web application. cluster Returns the named property of the specified cluster. server Returns the named property of the specified server.
  • Page 73: Getserversonhost

    getServersOnHost Returns a java.util.List of server names on the specified host. Description Attributes Attribute Description active Set to true to return only the names of servers that are currently running. The default is false. (Required.) The variable name of the returned List object. server Returns a list of servers on the host on which the specified server is running.
  • Page 74 Attribute Description useAdminServer Set to true in conjunction with specifying the server attribute to access the JRunAdminService on the first running server detected on the same host. method Specifies the method to invoke on the specified server or host. server If only server is specified and useAdminService is set to true, then the JRunAdminService is accessed on the next running server detected on the same host as the specified server (in other words, any...
  • Page 75: Isremoteserver

    isRemoteServer Detects if the server is remote; if it matches the specified value, then JRun executes the Description body of the tag. Attributes Attribute Description name (Required.) The name of the JRun server. value (Required.) Set to true to detect if the server is remote. Set to false to determine if the server is local.
  • Page 76: Parameter

    Attribute Description collectionId The variable name of the collection of objects. Use this attribute to return the objects as a Collection instance. The following example iterates over the returned attribute: Example 1 <jmcmgmt:objects server="default" type="ejbjar" id="ejb"> <jmcmgmt:getProperty server="default" id="<%= ejb %>" name="Name"/> </jmcmgmt:objects>...
  • Page 77: Removeallofflinepropertyvalues

    removeAllOfflinePropertyValues Removes all the named properties for the specified service. Description Attributes Attribute Description name (Required.) The name of the attribute to remove. service (Required.) The path of the service. server The name of the JRun server. Defaults to the server on which the JSP is invoked.
  • Page 78 The following example gets a list of available servers on the localhost and lets you delete Example one by selecting it from a drop-down list and clicking the Remove button: <%@ page import="javax.naming.Context, java.util.*"%> <jmcmgmt:getServersOnHost host="localhost" id="servers"/> <FORM METHOD="POST" ACTION="Remove.jsp"> <SELECT name="servers">...
  • Page 79: Setofflineproperty

    setOfflineProperty Sets an attribute for the specified MBean or service. The tag writes Description setOfflineProperty the property directly to a file, regardless of whether the server is running. The tag writes properties to the jvm.config, jrun.xml, or setOfflineProperty jndi.properties files. Attributes Attribute Description...
  • Page 80: Status

    <INPUT TYPE="Submit" VALUE="Submit"></FORM> status Indicates whether the specified server is running. Returns true if the specified server is Description running, or false if it is not, and conditionally executes the body of the tag. Attributes Attribute Description server (Required.) The name of the server. availableId Set this attribute to store the return value of the status tag.
  • Page 81: Chapter 7 Jrun Apis

    CHAPTER 7 JRun APIs This chapter describes how to use the JRun API Javadocs and provides an overview of the public JRun classes and methods. It concludes with descriptions of the command-line tools available in JRun. Contents Using the JRun API Javadocs................. 68 JRun APIs overview ....................
  • Page 82: Using The Jrun Api Javadocs

    Using the JRun API Javadocs The JRun API Javadocs are included in the standard JRun installation. The JRun SDK also includes JMC Javadocs for working with the JMC. You can access the standard JRun Javadocs from the documentation Home page (/docs/dochome.htm) or from the jrun_root/docs/jmc-javadocs directory in the retail installation.
  • Page 83: Jrun Apis Overview

    JRun APIs overview Most JRun packages contain MBean interfaces that you can programmatically access using JRun tools. This section describes the JRun packages. The following table briefly describes each of the packages in the JRun API: Package Description allaire.jrun.install Defines the GetControlPort tool. For more information on using the GetControlPort tool, see “Using the GetControlPort tool”...
  • Page 84 Package Description jrunx.axis Provides access to the AxisService, which you use to implement web services. jrunx.cluster Provides access to the JRun clustering mechanism, including the ClusterManager. jrunx.comp.sql Provides access to classes and interfaces that use the SQL Invoker Stateful Session bean, which handles all remote requests for a JRun JDBC resource.
  • Page 85 Package Description jrunx.rmi Provides classes that interact with the JMX Management interface of the RMI Broker. jrunx.scheduler Defines the SchedulerService. jrunx.server Provides classes that you can use to add and remove JRun servers; start, stop, and restart servers; get JRun server status, and get JRun server metadata.
  • Page 86: Command-Line Tools

    Command-line tools JRun includes several command-line tools that make some tasks easier to perform. This section describes the command-line tools included with JRun. Some tools are described in more depth in other books within the documentation set. These tools and references to the other documentation are noted.
  • Page 87: Using Base64 Encoder

    Using the migration tool JRun provides a migration tool for moving JRun 3.x servers and configuration settings to JRun 4. Although you can deploy JRun 3.x J2EE modules in JRun 4 without using the migration tool, the tool exports many of the settings on which modules depend. You can invoke the migration tool from the command line in the jrun_root/bin directory.
  • Page 88: Using Jrunsvc

    Using the jrun command The jrun command lets your start, stop, and restart JRun servers and get information about the version of JRun that you are currently running. You can use the JRun command-line tool with the jrun.exe (Windows) and jrun shell script (UNIX). The jrun command uses the following syntax from the jrun_root/bin directory: %>...
  • Page 89: Using Xmlscript

    Using the JSPC tool The JSPC tool compiles Java files. You can use it to precompile JSP pages, servlets, and other Java files. JSPC uses the following syntax from the jrun_root/bin directory: %> jspc [-w web_app_root] [-d output_directory] [-k] [-v] [JSP_pages] The -k option instructs JSPC to continue compilation even if it encounters errors.
  • Page 90: Using Wsdl2Java

    You can also use the following syntax from the jrun_root/bin directory: %> java2wsdl [options] For information about the Java2WSDL command-line options, see JRun Programmer’s Guide. Using WSDL2Java The WSDL2Java tool generates web service proxy and skeleton code based on information in a web service WSDL document. WSDL2Java generates proxies from WSDL documents that specify RPC encoded, document literal, and document encoded SOAP encoding styles.
  • Page 91: Jrun Executables

    JRun executables JRun includes executable files in the jrun_root/bin directory that point to executable JAR files in the jrun_root/lib directory. These executable files replace batch files and scripts that used to launch JRun processes. The JRun executables provide the following benefits: You do not have to use the jar command to launch the executable JAR Ease of use files from the command line.
  • Page 92 JAR file name Description java2wsdl.jar Generates a WSDL document for a Java interface or class that you use as the basis for a web service. For more information on using the java2wsdl utility, see “Using Java2WSDL” on page wsdl2java.jar Generates web service proxy and skeleton code based on information in a web service WSDL document.
  • Page 93: Chapter 8 Jrun Services

    CHAPTER 8 JRun Services This chapter provides an overview of the JRun service-based architecture and describes how to create a custom service. Contents Service architecture (JMX)..................80 Creating services ....................82 Accessing JRun services..................89 Adding JRun service security ................. 91 Loading MBeans through MLETs .................
  • Page 94: Service Architecture (Jmx)

    Service architecture (JMX) Services are the atomic unit of a JRun server, and all feature components must contain a service view—whether that view is a wrapper, a helper class, a factory, or the functional class itself—in order to be plugged into JRun. All JRun components, even the bootstrap components that manage the JMX spine, are services.
  • Page 95 The following figure shows the JRun service class architecture: Service architecture (JMX)
  • Page 96: Creating Services

    Creating services This section describes considerations related to creating custom services. Basic JRun services: extending ServiceMBean and ServiceAdapter In the simplest case, creating a service involves the following tasks: Write an interface that describes the manageable Code an MBean interface characteristics of the service.
  • Page 97: Creating Services Using Jrun.xml

    services to the partition’s JMX domain rather than the default global JMX domain. The has the following two methods to facilitate this behavior: ServicePartition addService(serviceMBean service) addService(ServiceMBean service, ObjectName serviceName) The JRun EJB architecture uses this behavior. Each EJB container spawned by the is a .
  • Page 98: Creating Services Programmatically

    Creating services programmatically The majority of manageable services in a running JRun server are not configured using jrun.xml. Typically, you configure a factory service or deployer service using jrun.xml, and that service creates and deploys numerous other services. You configure the other services using a deployment descriptor (for example, web.xml or ejb-jar.xml), a separate server-defined descriptor (for example, jrun-users.xml or jrun-jms.xml), or through hard coded operations inside another service (for example, the EJB deployer creates an...
  • Page 99: Custom Service Example

    // partitions must invoke the lifecycle methods of their services newservice.init(); newservice.start(); newservice.setBindToJNDI(true); newservice.bind(); Custom service example The following section describes steps and sample code to create a custom service that implements a custom log event handler. For more information on JRun logging, see JRun Administrator’s Guide.
  • Page 100 * @return The filename public String getFilename(); Coding a log event handler A log event handler is a Java class that must include the following items: statement for (to compile, you must add import jrunx.logger.* jrun_root/lib/jrun.jar to the classpath) A class definition that extends and implements jrunx.logger.LogEventHandler interface...
  • Page 101 // JRun initializes the writer at server startup public void init(Properties props) { dateFormat = new SimpleDateFormat("MM/HH hh:mm:ss"); * Sets the name of the file to be used for XML logging. * @param filename The filename public void setFilename(String filename) { if (filename == null) { this.filename = "xml.log";...
  • Page 102 finally { if (out != null) { out.close(); } // end if } // end finally return true; } // end logEvent method public void flush() // No-op Defining a service element You define the as a service within XMLLogEventHandler ThreadedLogEventHandler service in the jrun.xml file.
  • Page 103: Accessing Jrun Services

    Accessing JRun services Best practices The preferred means of accessing services is through JNDI. However, not all services are appropriate for JNDI binding. For example, they might not be remotable, might require additional security, or might not make good design sense within the context of remote naming services.
  • Page 104: Service Convenience Methods

    Service convenience methods For all services that extend (including jrunx.kernel.ServiceAdapter ), there are a series of convenience methods for jrunx.kernel.ServicePartition accessing other running services, including the following methods: use this method for performing a JNDI Object lookup(String serviceName) lookup in the JMX namespace, which has the general format of java:comp/jrun/jrun_server/domainname/servicename.
  • Page 105: Adding Jrun Service Security

    Adding JRun service security JMX does not provide a security layer of its own, but uses the Java 2 security model to protect attributes and methods. Protecting operations involves the following steps: 1 Creating the proper object to represent the permission to enforce. Permission 2 Assigning the permission to jrun.jar using the jrun.policy file that is used at server startup.
  • Page 106: Adding Jrun Service Security

    Loading MBeans through MLETs JRun uses Java Management Extensions (JMX) to drive its service-based architecture. Additionally, JRun lets you use MLETs (abbreviation for management applets) to dynamically load JMX MBeans across a network using a remote URL. You define MLETs to JRun in the SERVER-INF/jrun.mlets file, which contain one or more MLET tags that define JMX MBeans, their locations, and attributes.
  • Page 107 CHAPTER 9 Editing XML Files This chapter describes how to use the XML metadata classes in the JRun API to manipulate the JRun configuration files. Contents Editing XML files ....................94 Understanding the XML metadata classes.............. 96 Using XML metadata .................... 97 Strategies .......................
  • Page 108: Editing Xml Files

    Editing XML files OEMs often must hide the underlying application server from customers who use their applications. They want their customers to know only about the application that is running and not about the underlying server technology. As an OEM, you or your support personnel, might need a way to access the application server settings.
  • Page 109: Chapter 9 Editing Xml Files

    Tools for editing XML files JRun provides several mechanisms for programmatically editing XML files. These are useful for OEMs who hide the JRun interface from their customers and write their own applications that carry out JRun-related functions. JRun makes the following tools for programmatically editing XML files available to you: XML metadata classes provide a simple interface for you XML metadata classes to invoke methods on classes that represent the XML files and their elements.
  • Page 110: Understanding The Xml Metadata Classes

    Understanding the XML metadata classes Each XML file has an XML metadata class equivalent. When you want to add, remove, or edit the elements of a particular XML file, you find what class instantiates that XML file and then execute the available methods on that class to edit the file. For example, for the web.xml file, there is a class that contains JRunWebAppMetaData...
  • Page 111: Tools For Editing Xml Files

    Using XML metadata Follow these steps to edit the XML files. To edit XML files: 1 Find the appropriate class name. For web.xml, the class instantiates this file. JRunWebAppMetaData 2 Create a new class. If the file exists, you must execute the method on it.
  • Page 112: Understanding The Xml Metadata Classes

    Strategies This section provides some strategies to use when working with the XML metadata classes. Comments You cannot add comments to XML files using the XML metadata tools. However, the metadata methods preserve existing comments in the XML files. Finding metadata classes The metadata classes that you use to work with the XML files do not use a convention for naming.
  • Page 113: Using Xml Metadata

    XML metadata example The following example imports the web.xml file for the default server and adds a filter definition and filter mapping: import java.util.Map; import java.io.File; import jrun.servlet.metadata.WebAppMetaData; import jrun.servlet.metadata.FilterMetaData; import jrun.servlet.metadata.FilterMappingMetaData; public class AddFilter { public static void main(String[] args) throws Exception { /* Define the file to work with */ File file = new File("c:/JRun4/servers/default/default-ear/default-war/ WEB-INF/web.xml");...
  • Page 114 Chapter 9 Editing XML Files...
  • Page 115: Xml Metadata Example

    INDEX jrun command 74 Ant, building JRun 14 HTMLAgent service 92 JRun Management Console. See JMC JRun Management Extensions. See Base64 encoder 73 installation directory 15 JRun services BIN files 28 installer.properties file 29 accessing 89 build.xml file 14 installers creating 82 command line 24 finding 49...
  • Page 116 MBeans, loading 92 web applications merge modules 19 removing 35 metadata, using XML 97 samples 35 migrating from JRun 3.x 73 Web Server Configuration tool 32 migration tool 73 web servers MLETs 92 connecting external 32 JRun Web Server (JWS) 32 non-Windows, installers 18 Windows services 74 Windows, installers 18...

This manual is also suitable for:

Macromedia jrun 4

Table of Contents