jp.co.fujitsu.reffi.client.swing.model
クラス EJBProxyCore

java.lang.Object
  上位を拡張 jp.co.fujitsu.reffi.client.swing.model.BaseModel
      上位を拡張 jp.co.fujitsu.reffi.client.swing.model.EJBProxyCore
すべての実装されたインタフェース:
Callable<Object>, Model

public class EJBProxyCore
extends BaseModel

[概 要]

サーバとEJB通信を行う機能モデルクラスです。

[詳 細]

EJBリモートオブジェクトを取得してRPCを行います。

必須設定メソッド

[備 考]

使用例)
EJBを使用してログイン認証を行う。
        package demo.login.action;

        import java.util.EventListener;
        import java.util.List;
        
        import javax.swing.JPasswordField;
        import javax.swing.JTextField;
        
        import jp.co.fujitsu.reffi.client.swing.action.BaseAction;
        import jp.co.fujitsu.reffi.client.swing.event.ModelProcessEvent;
        import jp.co.fujitsu.reffi.client.swing.model.EJBProxyCore;
        import jp.co.fujitsu.reffi.client.swing.model.Model;
        
        public class LoginAction extends BaseAction {
        
                @Override
                protected void reserveModels(List> models) {
                        models.add(EJBProxyCore.class);
                }
        
                @Override
                public boolean nextModel(int index, ModelProcessEvent prev, Model next) throws Exception {
                        if(index == 0) {
                                // 使用するEJBオブジェクトのJNDI名を設定。
                                ((EJBProxyCore)next).setLookupName("ReffiFunctionalDemoForSwingServer/LoginBean/remote");
                                // 呼び出すメソッド名を設定。
                                ((EJBProxyCore)next).setMethodName("login");
                                // パラメータ設定
                                ((EJBProxyCore)next).addParameter(getComponentValueAsString("loginFrame.jtfUserId"));
                                ((EJBProxyCore)next).addParameter(String.valueOf((char[])getComponentValue("loginFrame.jpwPassword")));
                        }
                        
                        return true;
                }
        
                @Override
                public void successForward(int index, Model model, Object result)       throws Exception {
                        showMessageDialog("ログインしました", "成功", MessageDialogUtil.INFORMATION_MESSAGE, MessageDialogUtil.DEFAULT_OPTION);                   }
                
                @Override
                public Exception failureForward(int index, Model model, Exception e) {
                        showMessageDialog("ログインに失敗しました", "エラー", MessageDialogUtil.ERROR_MESSAGE, MessageDialogUtil.DEFAULT_OPTION);
                        return null;
                }
        }
 

[環 境] JDK 6.0 Update 11

Copyright (c) 2008-2009 FUJITSU Japan All rights reserved.

作成者:
Project Reffi

コンストラクタの概要
EJBProxyCore()
          [概 要] コンストラクタです。
 
メソッドの概要
 void addParameter(boolean parameter)
          [概 要] EJBメソッドパラメータを追加します。
 void addParameter(char parameter)
          [概 要] EJBメソッドパラメータを追加します。
 void addParameter(double parameter)
          [概 要] EJBメソッドパラメータを追加します。
 void addParameter(float parameter)
          [概 要] EJBメソッドパラメータを追加します。
 void addParameter(int parameter)
          [概 要] EJBメソッドパラメータを追加します。
 void addParameter(long parameter)
          [概 要] EJBメソッドパラメータを追加します。
 void addParameter(Object parameter)
          [概 要] EJBメソッドパラメータを追加します。
 void addParameter(short parameter)
          [概 要] EJBメソッドパラメータを追加します。
 Hashtable<String,String> getEnvironment()
          [概 要] 接続先環境設定プロパティを返却します。
 String getLookupName()
          [概 要] 使用するEJBコンポーネントのJNDI名を返却します。
 String getMethodName()
          [概 要] 呼び出すEJBメソッド名を返却します。
 TypeMaintainList getParameters()
          [概 要] EJBメソッドパラメータを返却します。
protected  void mainproc()
          [概 要] EJBオブジェクトをルックアップしてサーバと通信を行います。
protected  void postproc()
          [概 要] モデル処理成功イベント、モデル処理終了イベントを発行します。
 void setEnvironment(Hashtable<String,String> environment)
          [概 要] 接続先環境設定プロパティを設定します。
 void setLookupName(String lookupName)
          [概 要] 使用するEJBコンポーネントのJNDI名を返却します。
 void setMethodName(String methodName)
          [概 要] 呼び出すEJBメソッド名を設定します。
 void setParameters(TypeMaintainList parameters)
          [概 要] EJBメソッドパラメータを設定します。
 
クラス jp.co.fujitsu.reffi.client.swing.model.BaseModel から継承されたメソッド
addModelProcessListener, call, done, finalproc, fireModelFailure, fireModelFinished, fireModelSuccess, getController, getExecuteIndex, getListenerList, getParameterMapping, getResult, getSuccessCount, incrementSuccessCount, init, isAsync, isSkip, preproc, removeModelProcessListener, run, setAsync, setController, setExecuteIndex, setListenerList, setParameterMapping, setResult, setSkip, trap
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

EJBProxyCore

public EJBProxyCore()

[概 要]

コンストラクタです。

[詳 細]

フィールドの初期化を行います。

[備 考]

メソッドの詳細

getEnvironment

public Hashtable<String,String> getEnvironment()

[概 要]

接続先環境設定プロパティを返却します。

[詳 細]

environmentフィールドを返却します。

[備 考]

戻り値:
接続先環境設定プロパティ

setEnvironment

public void setEnvironment(Hashtable<String,String> environment)

[概 要]

接続先環境設定プロパティを設定します。

[詳 細]

environmentフィールドに引数environmentを設定します。

[備 考]

パラメータ:
environment - 接続先環境設定プロパティ

getLookupName

public String getLookupName()

[概 要]

使用するEJBコンポーネントのJNDI名を返却します。

[詳 細]

lookupNameフィールドを返却します。

[備 考]

戻り値:
使用するEJBコンポーネントのJNDI名

setLookupName

public void setLookupName(String lookupName)

[概 要]

使用するEJBコンポーネントのJNDI名を返却します。

[詳 細]

lookupNameフィールドを返却します。

[備 考]

パラメータ:
lookupName - 使用するEJBコンポーネントのJNDI名

getMethodName

public String getMethodName()

[概 要]

呼び出すEJBメソッド名を返却します。

[詳 細]

methodNameフィールドを返却します。

[備 考]

戻り値:
呼び出すEJBメソッド名

setMethodName

public void setMethodName(String methodName)

[概 要]

呼び出すEJBメソッド名を設定します。

[詳 細]

methodNameフィールドを設定します。

[備 考]

パラメータ:
methodName - 呼び出すEJBメソッド名

getParameters

public TypeMaintainList getParameters()

[概 要]

EJBメソッドパラメータを返却します。

[詳 細]

parametersフィールドを返却します。

[備 考]

戻り値:
EJBメソッドパラメータ

setParameters

public void setParameters(TypeMaintainList parameters)

[概 要]

EJBメソッドパラメータを設定します。

[詳 細]

parametersフィールドを設定します。

[備 考]

パラメータ:
parameters - EJBメソッドパラメータ

addParameter

public void addParameter(Object parameter)

[概 要]

EJBメソッドパラメータを追加します。

[詳 細]

parametersフィールドに引数parameterを追加します。

[備 考]

パラメータ:
parameter - EJBメソッドパラメータ

addParameter

public void addParameter(char parameter)

[概 要]

EJBメソッドパラメータを追加します。

[詳 細]

parametersフィールドに引数parameterを追加します。

[備 考]

パラメータ:
parameter - EJBメソッドパラメータ

addParameter

public void addParameter(short parameter)

[概 要]

EJBメソッドパラメータを追加します。

[詳 細]

parametersフィールドに引数parameterを追加します。

[備 考]

パラメータ:
parameter - EJBメソッドパラメータ

addParameter

public void addParameter(int parameter)

[概 要]

EJBメソッドパラメータを追加します。

[詳 細]

parametersフィールドに引数parameterを追加します。

[備 考]

パラメータ:
parameter - EJBメソッドパラメータ

addParameter

public void addParameter(long parameter)

[概 要]

EJBメソッドパラメータを追加します。

[詳 細]

parametersフィールドに引数parameterを追加します。

[備 考]

パラメータ:
parameter - EJBメソッドパラメータ

addParameter

public void addParameter(float parameter)

[概 要]

EJBメソッドパラメータを追加します。

[詳 細]

parametersフィールドに引数parameterを追加します。

[備 考]

パラメータ:
parameter - EJBメソッドパラメータ

addParameter

public void addParameter(double parameter)

[概 要]

EJBメソッドパラメータを追加します。

[詳 細]

parametersフィールドに引数parameterを追加します。

[備 考]

パラメータ:
parameter - EJBメソッドパラメータ

addParameter

public void addParameter(boolean parameter)

[概 要]

EJBメソッドパラメータを追加します。

[詳 細]

parametersフィールドに引数parameterを追加します。

[備 考]

パラメータ:
parameter - EJBメソッドパラメータ

mainproc

protected void mainproc()
                 throws NamingException,
                        SecurityException,
                        NoSuchMethodException,
                        IllegalArgumentException,
                        IllegalAccessException,
                        InvocationTargetException

[概 要]

EJBオブジェクトをルックアップしてサーバと通信を行います。

[詳 細]

以下の処理を行います。
  1. environmentフィールド値を元にInitialContextを生成
  2. lookupNameのルックアップ
  3. 呼び出すメソッドのリフレクション
  4. EJBメソッド実行

[備 考]

オーバーライド:
クラス BaseModel 内の mainproc
例外:
NamingException
SecurityException
NoSuchMethodException
IllegalArgumentException
IllegalAccessException
InvocationTargetException

postproc

protected void postproc()
                 throws Exception

[概 要]

モデル処理成功イベント、モデル処理終了イベントを発行します。

[詳 細]

fireModelSuccess、fireModelFinishedメソッドをコールします。

[備 考]

オーバーライド:
クラス BaseModel 内の postproc
例外:
Exception - オーバーライド先で発生する可能性が有る例外


Copyright(C) Fujitsu All Rights Reserved.