2012-07-26 45 views

回答

4

参考手册报告:

如果在JAR文件中找到的作为安装域自订/ modules 目录当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接口扩展,似乎是一个代理Domorg.jvnet.hk2.config.ConfigBeanProxy接口:

/** 
* 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是了解域定制是如何工作的关键。

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

相关问题