什么是GlassFish 3.1.x域名初始化程序?

Jan*_*cki 8 glassfish-3

我在使用带有GlassFish 3.1.1的create-domain命令时看到此日志消息

No domain initializers found, bypassing customization step
Run Code Online (Sandbox Code Playgroud)

使用域初始化程序可以实现什么?有文件吗?

此处显示了具有日志记录输出的create-domain用法示例,

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

Alf*_*Alf 4

参考手册报告:

如果运行 create-domain 子命令时在 as-install/modules 目录中的 JAR 文件中找到域定制器,则会处理定制器。域定制器是一个实现 DomainInitializer 接口的类。

我确实没有找到有关自定义的文档,但根据源代码,我可以发现域初始值设定项用于在域创建过程中自定义domain.xml。

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);
}
Run Code Online (Sandbox Code Playgroud)

您可以在这里找到来源。

getInitialConfig方法返回一个Container实例。Container接口扩展了org.jvnet.hk2.config.ConfigBeanProxy似乎是Dom类代理的接口:

/**
 * 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 {
Run Code Online (Sandbox Code Playgroud)

我发现hk2是理解域定制如何工作的关键。

我希望其他人能给你一些更有用的信息。