JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle GlassFish Server 3.1 Add-On Component Development Guide
search filter icon
search icon

Document Information


1.   Introduction to the Development Environment for GlassFish Server Add-On Components

2.  Writing HK2 Components

3.  Extending the Administration Console

4.  Extending the asadmin Utility

5.  Adding Monitoring Capabilities

6.  Adding Configuration Data for a Component

How GlassFish Server Stores Configuration Data

Defining an Element

To Define an Element

Defining an Attribute of an Element

Representing an Attribute of an Element

Specifying the Data Type of an Attribute

Identifying an Attribute of an Element

Specifying the Name of an Attribute

Specifying the Default Value of an Attribute

Specifying Whether an Attribute Is Required or Optional

Example of Defining an Attribute of an Element

Defining a Subelement

To Define a Subelement

Validating Configuration Data

Initializing a Component's Configuration Data

To Define a Component's Initial Configuration Data

To Write a Component's Initial Configuration Data to the domain.xml File

Creating a Transaction to Update Configuration Data

To Create a Transaction to Update Configuration Data

Dotted Names and REST URLs of Configuration Attributes

Examples of Adding Configuration Data for a Component

7.  Adding Container Capabilities

8.  Creating a Session Persistence Module

9.  Packaging, Integrating, and Delivering an Add-On Component

A.  Integration Point Reference


Defining an Element

An element represents an item of configuration data. For example, to represent the configuration data for a network listener, GlassFish Server defines the network-listener element.

Define an element for each item of configuration data that you are adding.

To Define an Element

  1. Define a Java language interface to represent the element.

    Define one interface for each element. Do not represent multiple elements in a single interface.

    The name that you give to the interface determines name of the element as follows:

    • A change from lowercase to uppercase in the interface name is transformed to the hyphen (-) separator character.

    • The element name is all lowercase.

    For example, to define an interface to represent the wombat-container-config element, give the name WombatContainerConfig to the interface.

  2. Specify the parent of the element.

    To specify the parent, extend the interface that identifies the parent as shown in the following table.

    Parent Element
    Interface to Extend
    Another element that you are defining
  3. Annotate the declaration of the interface with the org.jvnet.hk2.config.Configured annotation.

Example 6-1 Declaration of an Interface That Defines an Element

This example shows the declaration of the WombatContainerConfig interface that represents the wombat-container-config element. The parent of this element is the config element.

import org.jvnet.hk2.config.Configured;
import org.glassfish.api.admin.config.Container;
public interface WombatContainerConfig extends Container {
How Interfaces That Are Annotated With @Configured Are Implemented

You are not required to implement any interfaces that you annotate with the @Configured annotation. GlassFish Server implements these interfaces by using the Dom class. GlassFish Server creates a Java Platform, Standard Edition (Java SE) proxy for each Dom object to implement the interface.