【问题标题】:What are GlassFish 3.1.x domain initializers?什么是 GlassFish 3.1.x 域初始值设定项?
【发布时间】:2012-08-11 20:36:40
【问题描述】:

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

No domain initializers found, bypassing customization step

使用域初始化器可以完成什么?有文件吗?

此处显示了带有日志记录输出的创建域用法示例,

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

【问题讨论】:

    标签: glassfish-3


    【解决方案1】:

    参考手册报告:

    如果在 as-install/modules 的 JAR 文件中找到域定制器 运行 create-domain 子命令时的目录,定制器 被处理。域定制器是一个实现 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);
    }
    

    您可以找到来源here

    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 {
    

    我发现hk2 是了解域自定义如何工作的关键。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-16
      • 2012-04-21
      • 1970-01-01
      • 1970-01-01
      • 2021-10-29
      • 2019-12-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多