javafx enterprise

Post on 24-Jun-2015

4.715 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1 | © 2011 Oracle Corporation – Proprietary and Confidential

エンタープライズ JavaFX アプリケーション 寺田 佳央

2 | © 2011 Oracle Corporation – Proprietary and Confidential

バックエンドリソース

JavaFX エンタープライズ・アプリケーションの作成 アプリケーション中から直接呼び出し

DB View

モデル コントローラ

DB連携 Messaging

FXML JavaFX JPA JMS

メッセージ サービス

3 | © 2011 Oracle Corporation – Proprietary and Confidential

http://yoshio3.com

DB

http://tinyurl.com/873nrpy

JavaFX アプリケーションから JPA で直接 DB へ接続するサンプル

アプリケーション中から直接呼び出しサンプル

4 | © 2011 Oracle Corporation – Proprietary and Confidential

この方法には課題が

5 | © 2011 Oracle Corporation – Proprietary and Confidential

アプリケーションから直接 DB 接続の問題

DB

クライアント毎にコネクションが必要

DB に高負荷の可能性

6 | © 2011 Oracle Corporation – Proprietary and Confidential

クライアント数に比例し DB に対して高負荷

7 | © 2011 Oracle Corporation – Proprietary and Confidential

Application Client Container を使ってみよう

8 | © 2011 Oracle Corporation – Proprietary and Confidential

デスクトップ PC

Java Web Start & Application Client Container

•  Java Web Start – ワンクリックで、アプリケーションの自動ダウンロード、インストール

•  Application Client Container (ACC) – アプリケーションから Java EE が提供するサービス(EJB,JMS等)を呼び出し可能

EJB 呼び出し可能なリッチクライアントの作成が可能

クリックでアプリの入手

配布とインストール HTTP

RMI IIOP

EJB 呼び出し

App Server

9 | © 2011 Oracle Corporation – Proprietary and Confidential

バックエンドリソース

JavaFX エンタープライズ・アプリケーションの作成

DB

FXML JavaFX

App Server

JPA

Remote EJB

EJB Stub

Application Client Container

10 | © 2011 Oracle Corporation – Proprietary and Confidential

クライアント側の実装 ‒ 使用しない場合

11 | © 2011 Oracle Corporation – Proprietary and Confidential

クライアント側の実装 ‒ 使用した場合

Java EE Specification EE.5.2.5 : For all classes except application client main classes, the fields or methods must not be static. Because application clients use the same lifecycle as Java SE applications, no instance of the application client main class is created by the application client container. Instead, the static main method is invoked. To support injection for the application client main class, the fields or methods annotated for injection must be static.

12 | © 2011 Oracle Corporation – Proprietary and Confidential

クライアント側の実装 ‒ 使用した場合

DB サーバが何かをクライアント側は意識せず アノテーションを利用して EJB 経由で DB の情報を取得

13 | © 2011 Oracle Corporation – Proprietary and Confidential

メリットは?

14 | © 2011 Oracle Corporation – Proprietary and Confidential

既存のビジネスロジックを再利用可能

•  クライアント側の実装コード行数を軽減 •  DB のコネクション・プールの実装が利用可能

–  DB の負荷軽減 •  View テクノロジーを切り替え可能

–  JavaFX, JavaServer Faces など異なるテクノロジーに対して同一ビジネス・ロジックを適用可能

•  ロードバランサの設定により負荷分散可能 •  Java Web Start の組み合わせで、パッケージ配布も容易に App Server

JPA

Remote EJB

15 | © 2011 Oracle Corporation – Proprietary and Confidential

パッケージングは正直面倒、 でもできればそれを上回る成果が!!

top related