8

GlassFish 3.1.1 で create-domain コマンドを使用すると、このログ メッセージが表示されます。

No domain initializers found, bypassing customization step

ドメイン初期化子を使用して何が実現できますか? ドキュメントはありますか?

ログ出力を使用した create-domain の使用例を次に示します。

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

4

1 に答える 1

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);
}

ここでソースを見つけることができます。

getInitialConfigメソッドはインスタンスを返しますContainerContainerインターフェイスは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は、ドメインのカスタマイズがどのように機能するかを理解するための鍵であることがわかりました

他の誰かがあなたにもっと有益な情報を提供できることを願っています。

于 2012-08-11T12:36:40.580 に答える