Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are GlassFish 3.1.x domain initializers?

Tags:

glassfish-3

I am seeing this log message when using the create-domain command with GlassFish 3.1.1

No domain initializers found, bypassing customization step

What can be accomplished with domain initializers? Is there any documentation?

Examples of create-domain usages with logging output is shown here,

http://docs.oracle.com/cd/E18930_01/html/821-2433/create-domain-1.html

like image 736
Janek Bogucki Avatar asked Jul 26 '12 10:07

Janek Bogucki


1 Answers

The reference manual reports:

If domain customizers are found in JAR files in the as-install/modules directory when the create-domain subcommand is run, the customizers are processed. A domain customizer is a class that implements the DomainInitializer interface.

I did found no documentation about customization but based on the source I can figure out that domain initializers are used to customize domain.xml during domain creation.

package org.glassfish.api.admin.config;

import org.jvnet.hk2.annotations.Contract;
import org.glassfish.api.admin.config.Container;

/**
 * Marker interface to mark inhabitants that require some minimal initial 
 * configuration to be inserted into a newly create domain's domain.xml
 *
 * @author Nandini Ektare
 */
@Contract
public interface DomainInitializer {
    /**
     * The actual initial config that needs to be inserted into
     * the fresh domain.xml
     *
     * See {@link Attribute#value()} for how the default value is inferred.
     *
     */
    public <T extends Container> T getInitialConfig(DomainContext initialCtx);
}

You can find source here.

the getInitialConfig method returns a Container instance. Container interface extends org.jvnet.hk2.config.ConfigBeanProxy interface that appears to be a proxy to Dom class:

/**
 * Marker interface that signifies that the interface
 * is meant to be used as a strongly-typed proxy to
 * {@link Dom}. 
 *
 * <p>
 * To obtain the Dom object, use {@link Dom#unwrap(ConfigBeanProxy)}.
 * This design allows the interfaces to be implemented by other code
 * outside DOM more easily.
 *
 * @author Kohsuke Kawaguchi
 * @see Dom#unwrap(ConfigBeanProxy)
 * @see DuckTyped
 * @see Element
 * @see Attribute
 */
public interface ConfigBeanProxy {

I figure out that hk2 is the key to understand how domain customization works.

I hope someone else can give you some more useful info.

like image 185
Alf Avatar answered Oct 16 '22 22:10

Alf