/* * 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#SESSION_NAME session}、 * {@link org.seasar.framework.container.InstanceDef#REQUEST_NAME request})の場合
*
* *
*
外部コンポーネント({@link org.seasar.framework.container.InstanceDef#OUTER_NAME outer})の場合
*
*
*
*

*

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

* * @author higa * @author belltree (Javacoc) */ public interface ComponentDeployer { /** * コンポーネントインスタンス定義に応じてインスタンス生成や外部コンテキストへの配備などを行った後に、 そのコンポーネントのインスタンスを返します。 * * @return コンポーネントのインスタンス * * @see org.seasar.framework.container.deployer.SingletonComponentDeployer#deploy() * @see org.seasar.framework.container.deployer.PrototypeComponentDeployer#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の場合には、 * {@link 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(); }