• 検索結果がありません。

OC4J Standalone/J2EE & Web Cache EJBクライアント側

ドキュメント内 PowerPoint プレゼンテーション (ページ 36-47)

Copyright © Oracle Corporation, 2005. All rights reserved.

37

OC4J Standalone/J2EE & Web Cache

EJB側

ローカル EJB の呼び出し (OC4J 固有 )

y EJB

の論理な

JNDI

名と実際の

JNDI

名のマッピング

y Web

モジュール:

orion-web.xml

EJB

モジュール:

orion-ejb-jar.xml

orion-web.xml

の例

<orion-web-app>

...

<ejb-ref-mapping name="ejb/EmployeeMappledBean"

location="employee/EmployeeBean" />

...

</orion-web-app>

orion-ejb-jar.xml

の例

<orion-ejb-jar>

...

<ejb-ref-mapping name="ejb/EmployeeMappledBean"

location="employee/EmployeeBean" />

...

</orion-ejb-jar>

OC4J Standalone/J2EE & Web Cache

EJB側

ローカル EJB の呼び出し (OC4J 固有 )

y

実際の

JNDI

名の定義

orion-ejb-jar.xml

ejb-jar.xml

ejb-name

属性と実際の

JNDI

名のマッピング

orion-ejb-jar.xml

の例

<orion-ejb-jar>

...

<enterprise-beans>

<session-deployment name="EmployeeBean"

location="employee/EmployeeBean" />

</enterprise-beans>

...

</orion-ejb-jar>

Copyright © Oracle Corporation, 2005. All rights reserved.

39

OC4J Standalone/J2EE & Web Cache

EJB側

ローカル EJB の呼び出し (J2EE 標準 )

y Enterprise Bean

の基本的な定義

ejb-jar.xml

ejb-name

要素により、

Enterprise Bean

を一意に識別

ejb-jar.xml

の例

<enterprise-beans>

<session>

<description>Comment</description>

<display-name>EmployeeBean</display-name>

<ejb-name>EmployeeBean</ejb-name>

<local-home>employee.EmployeeLocalHome</local-home>

<local>employee.EmployeeLocal</local>

<ejb-class>employee.EmployeeBean</ejb-class>

<session-type>Stateless</session-type>

<transaction-type>Container</transaction-type>

</session>

</enterprise-beans>

AP サーバ固有 API

Copyright © Oracle Corporation, 2005. All rights reserved.

41

OC4J Standalone/J2EE & Web Cache

他社 AP サーバ固有 API

y

例えば:

WebLogic

固有の

API

を利用していた場合、移行時に コードの修正が必要

– 起動・停止クラス

y weblogic.common.T3StartupDef y weblogic.common.T3ShutdownDef

– ログクラス

y weblogic.loggin.NonCatalogLogger

– セキュリティクラス

y weblogic.sercurity

XML

関連

y weblogic.apache.*

– システム情報取得

y weblogic.management.configuration.*

HTML

関連

y weblogic.html.*

DB

関連

y weblogic.db.*

y WebLogic

での起動・停止クラス

WebLogic

では以下のインタフェースを実装したクラスを作成し、起動・停止クラス

を開発

y weblogic.common.T3StartupDef y weblogic.common.T3ShutdownDef

import weblogic.common.T3ServicesDef;

import weblogic.common.T3StartupDef;

public class AppStartup

implements T3StartupDef, CommonDefineIf { // 起動時の処理を処理を記述

・・・

WebLogic

固有

API

での起動クラスコード例

OC4J Standalone/J2EE & Web Cache

例: WebLogic 固有 API 移行

Copyright © Oracle Corporation, 2005. All rights reserved.

43

OC4J Standalone/J2EE & Web Cache

例 1 : OC4J 固有 API への移行

y

前述の

OC4J(10.1.2)

の起動・停止クラスを利用し移行可能

OC4J

では以下のインタフェースを実装したクラスを作成し、起動・停止クラスを 開発

y weblogic.common.T3StartupDef

インタフェースを実装したクラスを

→ 

com.evermind.server.OC4JStart

インタフェースを実装したクラスに移行

y weblogic.common.T3ShutdownDef

インタフェースを実装したクラスを

→ 

com.evermind.server.OC4JShutdown

インタフェースを実装したクラスに移行

OC4J Standalone/J2EE & Web Cache

例 2 : J2EE 汎用 API の移行

y Oracle Application Server10g(10.1.2)

で、

J2EE

汎用的な

ServletContextListener

を利用 を利用した場合

Oracle Application Server10g

コード例 import javax.servlet.ServletContextListener;

import javax.servlet.ServletContextEvent;

import javax.servlet.ServletContext;

public class SampleListner implements ServletContextListener { private ServletContext context = null;

public void contextInitialized(ServletContextEvent event) { context = event.getServletContext();

System.out.println("Webアプリケーション起動時に呼び出し");

}

public void contextDestroyed(ServletContextEvent event) { context = event.getServletContext();

System.out.println("Webアプリケーション停止時に呼び出し");

} }

Copyright © Oracle Corporation, 2005. All rights reserved.

45

OC4J Standalone/J2EE & Web Cache

例 2 : J2EE 汎用 API の移行

y ServletContextListener

web.xml

への登録

– 登録した

Web

アプリケーション起動・停止時に

ServletContextListener

が呼び出さ れ、結果的に起動・停止クラスと同等の振る舞いになる

web.xml

の記述例

<web-app>

...

<listener>

<listener-class>sample.SampleListner</listener-class>

</listener>

...

</web-app>

OC4J Standalone/J2EE & Web Cache

例 2 : J2EE 汎用 API の移行

y OC4J

起動時に

Web

アプリケーション起動

ORACLE_HOME/j2ee/home/config/http-web-site.xml

load-on-startup

属性

http-web-site.xml

の記述例

<web-app application=“sampapp" name=“sampapp-war“

root=“sampapp“ load-on-startup="true"/>

ドキュメント内 PowerPoint プレゼンテーション (ページ 36-47)

関連したドキュメント