org.seasar.remoting.common.interceptor
クラス RemotingInterceptor

java.lang.Object
  拡張org.seasar.framework.aop.interceptors.AbstractInterceptor
      拡張org.seasar.remoting.common.interceptor.RemotingInterceptor
すべての実装インタフェース:
Advice, Interceptor, MethodInterceptor, Serializable

public class RemotingInterceptor
extends org.seasar.framework.aop.interceptors.AbstractInterceptor

リモートオブジェクトのメソッド呼び出しを行うためのインターセプタです。

このインターセプタはJavaインタフェースまたは抽象クラスに適用され、呼び出されたメソッドがターゲットによって実装されていない場合(抽象メソッド)に Connectorに委譲することによりリモートオブジェクトのメソッド呼び出しを行います。

インターセプタはターゲットのコンポーネント定義から名前( <component> 要素の name 属性の値)を取得し、その名前をリモートオブジェクトの名前として Connector.invoke(java.lang.String, java.lang.reflect.Method, java.lang.Object[]) を呼び出します。コンポーネント定義に名前が定義されていない場合は、コンポーネントの型名( <component> 要素の class 属性の値)からパッケージ名を除いた名前をリモートオブジェクトの名前とします。 コンポーネントの型名が定義されていない場合は、ターゲットオブジェクトのクラス名からパッケージ名を除いた名前をリモートオブジェクトの名前とします。 もしプロパティ remoteName (オプション)が設定されていれば、その値が常にリモートオブジェクトの名前として使用されます。

作成者:
koichik
関連項目:
Connector, 直列化された形式

フィールドの概要
protected  Connector connector
           
protected  String remoteName
           
 
コンストラクタの概要
RemotingInterceptor()
           
 
メソッドの概要
protected  String getRemoteName(MethodInvocation invocation)
          リモートオブジェクトの名前を返します。
 Object invoke(MethodInvocation invocation)
          ターゲットのメソッドが起動された時に呼び出されます。
 void setConnector(Connector connector)
          リモート呼び出しを実行する Connectorを設定します。
 void setRemoteName(String remoteName)
          リモートオブジェクトの名前を設定します。
 
クラス org.seasar.framework.aop.interceptors.AbstractInterceptor から継承したメソッド
createProxy, getComponentDef, getTargetClass
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

connector

protected Connector connector

remoteName

protected String remoteName
コンストラクタの詳細

RemotingInterceptor

public RemotingInterceptor()
メソッドの詳細

setConnector

public void setConnector(Connector connector)
リモート呼び出しを実行する Connectorを設定します。このプロパティは必須です。

パラメータ:
connector - リモート呼び出しを実行する Connector

setRemoteName

public void setRemoteName(String remoteName)
リモートオブジェクトの名前を設定します。このプロパティはオプションです。 コンポーネント定義から取得できる名前を使うことが出来ない場合にのみ設定してください。

パラメータ:
remoteName - リモートオブジェクトの名前

invoke

public Object invoke(MethodInvocation invocation)
              throws Throwable
ターゲットのメソッドが起動された時に呼び出されます。起動されたメソッドが抽象メソッドなら Connectorに委譲します。 具象メソッドならターゲットのメソッドを呼び出します。

パラメータ:
invocation - メソッドの起動情報
例外:
Throwable

getRemoteName

protected String getRemoteName(MethodInvocation invocation)
リモートオブジェクトの名前を返します。リモートオブジェクトの名前は次の順で解決します。

パラメータ:
invocation - メソッドの起動情報
戻り値:
リモートオブジェクトの名前


Copyright © 2005-2006 The Seasar Foundation. All Rights Reserved.