Sun GlassFishTM Enterprise Server enables an external vendor such as an independent software vendor (ISV), original equipment manufacturer (OEM), or system integrator to incorporate Enterprise Server into a new product with the vendor's own brand name. External vendors can extend the functionality of Enterprise Server by developing add-on components for Enterprise Server. Enterprise Server provides interfaces to enable add-on components to be configured, managed, and monitored through existing Enterprise Server tools such as the Administration Console and the asadmin utility.
The following topics are addressed here:
Enterprise Server has a modular architecture in which the features of Enterprise Server are provided by a consistent set of components that interact with each other. Each component provides a small set of functionally related features.
The modular architecture of Enterprise Server enables users to download and install only the components that are required for the applications that are being deployed. As a result, start-up times, memory consumption, and disk space requirements are all minimized.
The modular architecture of Enterprise Server enables you to extend the basic functionality of Enterprise Server by developing add-on components. An add-on component is an encapsulated definition of reusable code that has the following characteristics:
The component provides a set of Java classes.
The component offers services and public interfaces.
The component implements the public interfaces with a set of private classes.
The component depends on other components.
Add-on components that you develop interact with Enterprise Server in the same way as components that are supplied in Enterprise Server distributions.
You can create and offer new or updated add-on components at any time. Enterprise Server administrators can install add-on components and update or remove installed components after Enterprise Server is installed. For more information, see Chapter 3, Extending Enterprise Server, in Sun GlassFish Enterprise Server v3 Prelude Administration Guide.
To enable components to be added when required, Enterprise Server provides a lightweight and extensible kernel that uses the module management subsystem from the OSGi Alliance. Any Enterprise Server component that plugs in to this kernel must be implemented as an OSGi bundle. To enable an add-on component to plug in to the Enterprise Server kernel in the same way as other components, package the component as an OSGi bundle. For more information, see Packaging an Add-On Component.
The default OSGi module management subsystem in Enterprise Server is the Apache Felix OSGi framework. However, the Enterprise Server kernel uses only the OSGi Service Platform Release 4 API. Therefore, Enterprise Server supports other OSGi module management subsystems that are compatible with the OSGi Service Platform Release 4 API.
The Hundred-Kilobyte Kernel (HK2) is the lightweight and extensible kernel of Enterprise Server. HK2 consists of the following technologies:
Module subsystem. The HK2 module subsystem provides isolation between components of the Enterprise Server. The HK2 module subsystem is compatible with existing technologies such as the OSGi framework.
Component model. The HK2 component model eases the development of components that are also services. Enterprise Server discovers these components automatically and dynamically. HK2 components use injection of dependencies to express dependencies on other components. Enterprise Server provides two-way mappings between the services of an HK2 component and OSGi services.
For more information, see Chapter 2, Writing HK2 Components.
To ensure that an add-on component behaves identically to components that are supplied in Enterprise Server distributions, the component must meet the following requirements:
If the component generates management data or monitoring data, it must provide that data to other Enterprise Server components in the same way as other Enterprise Server components.
If the component generates management data or monitoring data, it must provide that data to users through Enterprise Server administrative interfaces such as Administration Console and the asadmin utility.
The component must be packaged and delivered as an OSGi bundle.
To develop add-on components that meet these requirements, follow the development process that is described in the following sections:
The Hundred-Kilobyte Kernel (HK2) is the lightweight and extensible kernel of Enterprise Server. To interact with Enterprise Server, add-on components plug in to this kernel. In the HK2 component model, the functions of an add-on component are declared through a contract-service implementation paradigm. An HK2 contract identifies and describes the building blocks or the extension points of an application. An HK2 service implements an HK2 contract.
For more information, see Chapter 2, Writing HK2 Components.
The Administration Console is a browser-based tool for administering Enterprise Server. It features an easy-to-navigate interface and online help. Extending the Administration Console enables you to provide a graphical user interface for administering your add-on component. You can use any of the user interface features of the Administration Console, such as tree nodes, links on the Common Tasks page, tabs and sub-tabs, property sheets, and JavaServerTM Faces pages. Your add-on component implements a marker interface and provides a configuration file that describes how your customizations integrate with the Administration Console.
For more information, see Chapter 3, Extending the Administration Console.
The asadmin utility is a command-line tool for configuring and administering Enterprise Server. Extending the asadmin utility enables you to provide administrative interfaces for an add-on component that are consistent with the interfaces of other Enterprise Server components. A user can run asadmin commands either from a command prompt or from a script. For more information about the asadmin utility, see the asadmin(1M) man page.
For more information, see Chapter 4, Extending the asadmin Utility.
Monitoring is the process of reviewing the statistics of a system to improve performance or solve problems. By monitoring the state of components and services that are deployed in the Enterprise Server, system administrators can identify performance bottlenecks, predict failures, perform root cause analysis, and ensure that everything is functioning as expected. Monitoring data can also be useful in performance tuning and capacity planning.
An add-on component typically generates statistics that the Enterprise Server can gather at run time. Adding monitoring capabilities enables an add-on component to provide statistics to Enterprise Server in the same way as components that are supplied in Enterprise Server distributions. As a result, system administrators can use the same administrative interfaces to monitor statistics from any installed Enterprise Server component, regardless of the origin of the component.
For more information, see Chapter 5, Adding Monitoring Capabilities.
Applications run on Enterprise Server in containers. Enterprise Server enables you to create containers that extend or replace the existing containers of Enterprise Server. Adding container capabilities enables you to run new types of applications and to deploy new archive types in Enterprise Server.
For more information, see Chapter 6, Adding Container Capabilities.
Packaging an add-on component enables the component to interact with the Enterprise Server kernel in the same way as other components. Integrating a component with Enterprise Server enables Enterprise Server to discover the component at runtime. If an add-on component is an extension or update to existing installations of Enterprise Server, deliver the component through Update Tool.
For more information, see Chapter 7, Packaging, Integrating, and Delivering an Add-On Component.