/* * Copyright 2004-2006 the Seasar Foundation and the Others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ package org.seasar.framework.container; /** * コンポーネントの生成、 配備、 取得および、 外部コンポーネントへの依存コンポーネントのインジェクションを行う機能を提供するインターフェースです。 * *

* このインターフェースを実装するクラスは、 {@link InstanceDef コンポーネントインスタンス定義}に応じて、 * 以下のような機能を提供します。 *

*
シングルトン({@link org.seasar.framework.container.InstanceDef#SINGLETON_NAME singleton})の場合
*
* *
*
プロトタイプ({@link org.seasar.framework.container.InstanceDef#PROTOTYPE_NAME prototype})の場合
*
* *
*
外部コンテキスト({@link org.seasar.framework.container.InstanceDef#APPLICATION_NAME application}、 * {@link org.seasar.framework.container.InstanceDef#REQUEST_NAME request}、 * {@link org.seasar.framework.container.InstanceDef#SESSION_NAME session})の場合
*
* *
*
外部コンポーネント({@link org.seasar.framework.container.InstanceDef#OUTER_NAME outer})の場合
*
*
*
*

*

* それぞれの{@link InstanceDef コンポーネントインスタンス定義}と有効なメソッドの対応表を以下に示します。 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
コンポーネントインスタンス定義と有効なメソッドとの関係 (○:有効、 ×:無効)
-メソッド
{@link InstanceDef コンポーネントインスタンス定義}{@link #deploy()}{@link #injectDependency(Object)}{@link #init()}{@link #destroy()}
シングルトン{@link org.seasar.framework.container.deployer.InstanceSingletonDef singleton}{@link org.seasar.framework.container.deployer.SingletonComponentDeployer#deploy() ○}×{@link org.seasar.framework.container.deployer.SingletonComponentDeployer#init() ○}{@link org.seasar.framework.container.deployer.SingletonComponentDeployer#destroy() ○}
プロトタイプ{@link org.seasar.framework.container.deployer.InstancePrototypeDef prototype}{@link org.seasar.framework.container.deployer.PrototypeComponentDeployer#deploy() ○}×××
外部コンテキスト{@link org.seasar.framework.container.deployer.InstanceApplicationDef application}{@link org.seasar.framework.container.deployer.ApplicationComponentDeployer#deploy() ○}×××
{@link org.seasar.framework.container.deployer.InstanceRequestDef request}{@link org.seasar.framework.container.deployer.RequestComponentDeployer#deploy() ○}×××
{@link org.seasar.framework.container.deployer.InstanceSessionDef session}{@link org.seasar.framework.container.deployer.SessionComponentDeployer#deploy() ○}×××
外部コンポーネント{@link org.seasar.framework.container.deployer.InstanceOuterDef outer}×{@link org.seasar.framework.container.deployer.OuterComponentDeployer#injectDependency(Object) ○}××
*

* * @author higa * @author belltree (Javacoc) */ public interface ComponentDeployer { /** * コンポーネントのインスタンスを返します。 * * @return コンポーネントのインスタンス * * @see org.seasar.framework.container.deployer.SingletonComponentDeployer#deploy() * @see org.seasar.framework.container.deployer.ProtorypeComponentDeployer#deploy() * @see org.seasar.framework.container.deployer.ApplicationComponentDeployer#deploy() * @see org.seasar.framework.container.deployer.RequestComponentDeployer#deploy() * @see org.seasar.framework.container.deployer.SessionComponentDeployer#deploy() */ public Object deploy(); /** * 外部コンポーネントouterComponentに対し、 この{@link ComponentDeployer}の{@link ComponentDef コンポーネント定義}に基づいて、 * S2コンテナ上のコンポーネントをインジェクションします。 * * @param outerComponent * 外部コンポーネント * * @see org.seasar.framework.container.deployer.OuterComponentDeployer#injectDependency(Object) */ public void injectDependency(Object outerComponent); /** * コンポーネントインスタンスを生成します。 *

* {@link InstanceDef コンポーネントインスタンス定義}がsingletonの場合には、 * {@AspectDef アスペクト}を適用したインスタンスの生成、 配備、 プロパティ設定の後に、 * {@link InitMethodDef initMethod}が呼ばれます。 *

* * @see org.seasar.framework.container.deployer.SingletonComponentDeployer#init() * @see org.seasar.framework.container.assembler.DefaultInitMethodAssembler#assemble(Object) */ public void init(); /** * コンポーネントインスタンスを破棄します。 *

* {@link InstanceDef コンポーネントインスタンス定義}がsingletonの場合には、 * {@link DestroyMethodDef destoryMethod}が呼ばれます。 *

* * @see org.seasar.framework.container.deployer.SingletonComponentDeployer#destroy() * @see org.seasar.framework.container.assembler.DefaultDestroyMethodAssembler#assemble(Object) */ public void destroy(); }