2. Agenda
21世紀の最初の10年に起きたこと
今後の展望とエンタープライズ・クラウドの課題
JavaEE 7
Play 2.0
資料
A) GlassfishのService Deploy
B) GlassfishのAmazon EC2へのdeploy
C) Play 2.0 Template Overview
D) Play 2.0 routesファイル サンプル
57. Modelの定義
app/models/Computer.java
@Entity
public class Computer extends Model {
@Id
public Long id;
@Constraints.Required
public String name;
@Formats.DateTime(pattern="yyyy-MM-dd")
public Date introduced;
@Formats.DateTime(pattern="yyyy-MM-dd")
public Date discontinued;
@ManyToOne
public Company company;
58. # Home page
GET / controllers.Application.index
# Hello action
GET /hello controllers.Application.
sayHello
public class
Router Application
extends
Controller {
@(message: String) Controller public static
<h1>@message</h1> Result index() {
……
@Entity
Views Model public class Company
extends Model {
@Id
public Long id;
Play 2.0のMVC @Constraints.
Required
public String name;
64. 2. Virtual Cluster Creation
Application Virtual Cluster Association
Introspection Creation
Virtual Nodeを作成し、
Load Balancerを置き
Virtual Virtual ます。
Machines Machines 必要に応じてDatabase
with Load with やMQ等の外部リソー
Balancer Database スを置きます。
Service
これで、次の段階の
Virtual
Machines Associationの準備が
With 出来ました。
JavaEE
サービスのdeployまでの流れ
65. 3. Association
Application Virtual Cluster Association Deployment
Introspection Creation
Load Balancer,
JavaEEサーバー
Virtual Virtual
Databaseを関連
Machines Machines
with 付けます。
with Load
Balancer Database これで、アプリケ
Service ーションのdeploy
Virtual の準備が出来ま
Machines した。
With
JavaEE
サービスのdeployまでの流れ
66. 4. Deployment
Application Virtual Cluster Association Deployment
Introspection Creation
JavaEEサーバー
に、アプリケーシ
Virtual
Virtual ョンをdeployします。
Machines Machines
with Load with
Balancer Database
Service
Virtual
Machines
With
JavaEE
サービスのdeployまでの流れ
67. クラウド・サービス開始
Application Virtual Cluster Association Deployment
Introspection Creation
Virtual Virtual
Machines Machines
with Load with
Balancer Database
Service
Virtual
Machines
With
JavaEE
91. Play 2.0
routesファイル サンプル
Playのrouteファイルは、Playのコンセプトを
よく表している。
Play 2.0と一緒に配布されている、プログラ
ム・サンプルから、routesファイルを抜き出し
てみた。参考までサンプルの実行のスクリー
ン・ショットを添付した。
92.
93.
94. conf/routes
# Routes
# This file defines all application routes (Higher priority routes
first)
# ~~~~
# Home page
GET / controllers.Application.index
# Hello action
GET /hello controllers.Application.sayHello
# Map static resources from the /public folder to the /assets URL
path
GET /assets/*file controllers.Assets.at(path="/public", file)
95.
96.
97. # Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Default path will just redirect to the computer list
GET / controllers.Application.index
# Computers list (look at the default values for pagination parameters)
GET /computers controllers.Application.list(p:Int ?= 0, s:Int ?= 2,
f ?= "")
# Add computer
GET /computers/new controllers.Application.create
POST /computers controllers.Application.save
# Edit existing computer
GET /computers/:id controllers.Application.edit(id:Long)
POST /computers/:id controllers.Application.update(id:Long)
# Delete a computer
POST /computers/:id/delete controllers.Application.delete(id:Long)
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
98.
99.
100. # Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# The home page
GET / controllers.Projects.index
# Authentication
GET /login controllers.Application.login
POST /login controllers.Application.authenticate
GET /logout controllers.Application.logout
# Projects
POST /projects controllers.Projects.add
POST /projects/groups controllers.Projects.addGroup()
DELETE /projects/groups controllers.Projects.deleteGroup(group: String)
PUT /projects/groups controllers.Projects.renameGroup(group: String)
DELETE /projects/:project controllers.Projects.delete(project: Long)
PUT /projects/:project controllers.Projects.rename(project: Long)
101. POST /projects/:project/team controllers.Projects.addUser(project: Long)
DELETE /projects/:project/team controllers.Projects.removeUser(project: Long)
# Tasks
GET /projects/:project/tasks controllers.Tasks.index(project: Long)
POST /projects/:project/tasks controllers.Tasks.add(project: Long, folder: String)
PUT /tasks/:task controllers.Tasks.update(task: Long)
DELETE /tasks/:task controllers.Tasks.delete(task: Long)
POST /tasks/folder controllers.Tasks.addFolder
DELETE /projects/:project/tasks/folder
controllers.Tasks.deleteFolder(project: Long, folder: String)
PUT /project/:project/tasks/folder
controllers.Tasks.renameFolder(project: Long, folder: String)
# Javascript routing
GET /assets/javascripts/routes controllers.Application.javascriptRoutes
# Map static resources from the /public folder to the /public path
GET /assets/*file controllers.Assets.at(path="/public", file)