BackPrevious Page Next PageNext

Tour of the Java API

Using JReport Server with an existing application

Java Application Programming Interface (API)

This document is a high level survey of the JReport Server API. The intent is to show boundaries of interest so that a developer can narrow down the set of APIs to look at when needing to use JReport Server for a particular task.

Using JReport Server with an existing application

There are three ways to use JReport Server with an application:

The JReport Server Java API classes provide thousands of methods, each having a Javadoc entry describing the method and parameters. It is this library of classes and methods that is explained below, showing the relationship of classes to particular functional areas.

This tour section categorizes the Java API classes by functionality making it easier to find specific methods to use for particular situations.

Java Application Programming Interface (API)

JReport Server provides a library of classes and methods called the Java API.

The major functional areas in the library are categorized below into sections.

Each functional area will show the class or interface name and have a general description. Below that will be a list of common methods, and other information as needed.

Initializing and connecting to JReport Server

Every program that uses JReport Server Java API must start with calls to ensure an instance of the server is running, and then obtain a handle to the server for use in later API calls.

Class: jet.server.api.http.HttpUtil - This class provides a variety of utilities for programs running within a Java Servlet container.

Additionally, the two most commonly used methods of the Java API are in this class. These two methods must be called by any program that wants to use JReport Server in order to initialize and connect to JReport Server. These will still be used by programs that run outside a servlet container.

Security

Every web application must manage access control, identity of a visitor, permissions for a visitor, and maintain this across multiple HTTP Requests that define the web session for the user.

JReport Server provides built-in methods for doing this based on a protocol using HTTP Authentication and query parameters to pass in log-in credentials. The security mechanism includes a framework system that allows application developers to write code to co-operate with JReport Server's built-in system so that existing applications can provide the security functionality.

Event framework - Task Listener

JReport Server uses an event framework model that allows the application to provide methods that are called at various points in the processing of requests in JReport Server. These include calls to methods before a report is run, after the parameters are entered by the user to validate the parameters or generate new derived parameters, and after a report is run to log information. By using these methods you can keep detailed logs of information about the report in addition to the logging information that JReport provides.

This Java interface defines a class that applications developers can implement and deploy to provide actions tied to processing events happening.

Engine API

The JReport Engine allows you to run reports directly in your application without connecting to a JReport Server instance. As long as you don't need the JReport Server features such as Page Report Studio, security and scheduling then this is an efficient way to embed reporting into your application.

NLS

This Java interface defines an implementation you can build to provide your own methods to do data mapping and text replacement. The implementation that is provided by JReport Server works out of the box, but can be changed easily.

Resource management

The ResourceManager class provides methods to control all aspects of deploying resources to the server and managing resources that are already deployed. Resources include folders, catalogs, reports, and library components.

It does not include publishing results to the version system which are handled by jet.server.api.RptServer.

When resources are deployed, the application can set the permissions at the same time. Folder permissions are automatically applied to all contents deployed into the folder unless explicitly overridden.

Trigger Manager API

The TriggerManager class allows the application code to fire a trigger that will start running all of the scheduled tasks waiting on the trigger.

Run report - RptServer API

This RptServer class is at the core of JReport Server. Although it is documented as a Java interface, it is not intended to be replaced by a custom implementation built by developers. This section will talk about it as a Java class. The class provides methods to start and stop JReport Server, to get information about deployed resources and to run and schedule reports. Report results can also be saved as resources using these methods.

See the section above about initialization and connecting to the Report Server to see that an instance of this class, or the subclass HttpRptServer, is needed by an application program before any other API methods may be called.

E-mail

This class is used by programs that want to interface to an SMTP server to export results to e-mail as attachments or as embedded reports in the e-mail body.

Remote file service

This class is used by client programs that run a report on a remote JReport Server but then want the generated exported result such as PDF or Excel file to be available to open locally on the client computer.

Remote Method Invocation - RMI

This class is used by programs that need to request reports to run on a remote server and to copy the results to the local system. The report can be run asynchronously when using the timeout option. Programs written to access RptServer or RemoteRptServer are identical except for initialization so it is easy to write an application that tries to connect remotely before starting a local RptServer.

Schedule report using RptServer

This class allows programs to add, modify and delete schedules based on time or triggers.

Remote cluster dispatcher

The RemoteDispatcher class allows the user's remote application to determine the load balance algorithm, and remotely dispatch reports to be run on specified servers.

Clustering

The Cluster class provides methods to allow the user to build their own algorithm for balancing server loads by assigning new reports to run onto the desired server.

Server configuration

This class allows applications to configure the server similar to the JReport Administration console. For programming examples use the actual JSP pages under public_html\admin.

- jet.server.api.admin.cfg

Server Monitor

JReport Server Monitor is a client application that can be downloaded for free from the JReport downloads page. It allows you to monitor activity on a single server or on an entire group of servers in a cluster. The API can be used to start and stop servers as well as configure properties on them remotely.

- jet.server.api.monitor

Server profiling

This is the class used by JReport Server to implement Server Monitor. It allows your application to catch the same types of resource use as Server Monitor using JMX technology.

- jet.server.api.profiling

Server cached reusable data (CRD)

This class is similar to scheduling of reports. The application can schedule just the cached result data and have it available for any number of reports to use it. Often it is for datasets that many reports might need such as month end sales reports.

- jet.server.api.crd

BackPrevious Page Next PageNext