Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
© 2015 IBM Corporation
IBM MobileFirst Platform FoundationV7.1 アップデート・セミナー
開発 CLIツール機能拡張と利用方法
2015年 9月 29日日本IBM(株)
日本IBMシステムズ・エンジニアリング(株)
© 2015 IBM Corporation 2
© Copyright IBM Corporation 2012. All rights reserved. The information contained in these materials is provided for informational purposes only, and is provided AS IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, these materials. Nothing contained in these materials is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software. References in these materials to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in these materials may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. IBM, the IBM logo, Rational, the Rational logo, Telelogic, the Telelogic logo, and other IBM products and services are trademarks of the International Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others.
ワークショップ、セッション、および資料は、IBMまたはセッション発表者によって準備され、それぞれ独自の見解を反映したものです。それらは情報提供の目的のみで提供されており、いかなる参加者に対しても法律的またはその他の指導や助言を意図したものではなく、またそのような結果を生むものでもありません。本講演資料に含まれている情報については、完全性と正確性を期するよう努力しましたが、「現状のまま」提供され、明示または暗示にかかわらずいかなる保証も伴わないものとします。本講演資料またはその他の資料の使用によって、あるいはその他の関連によって、いかなる損害が生じた場合も、IBMは責任を負わないものとします。本講演資料に含まれている内容は、IBMまたはそのサプライヤーやライセンス交付者からいかなる保証または表明を引きだすことを意図したものでも、IBMソフトウェアの使用を規定する適用ライセンス契約の条項を変更することを意図したものでもなく、またそのような結果を生むものでもありません。
本講演資料でIBM製品、プログラム、またはサービスに言及していても、IBMが営業活動を行っているすべての国でそれらが使用可能であることを暗示するものではありません。本講演資料で言及している製品リリース日付や製品機能は、市場機会またはその他の要因に基づいてIBM独自の決定権をもっていつでも変更できるものとし、いかなる方法においても将来の製品または機能が使用可能になると確約することを意図したものではありません。本講演資料に含まれている内容は、参加者が開始する活動によって特定の販売、売上高の向上、またはその他の結果が生じると述べる、または暗示することを意図したものでも、またそのような結果を生むものでもありません。パフォーマンスは、管理された環境において標準的なIBMベンチマークを使用した測定と予測に基づいています。ユーザーが経験する実際のスループットやパフォーマンスは、ユーザーのジョブ・ストリームにおけるマルチプログラミングの量、入出力構成、ストレージ構成、および処理されるワークロードなどの考慮事項を含む、数多くの要因に応じて変化します。したがって、個々のユーザーがここで述べられているものと同様の結果を得られると確約するものではありません。
記述されているすべてのお客様事例は、それらのお客様がどのようにIBM製品を使用したか、またそれらのお客様が達成した結果の実例として示されたものです。実際の環境コストおよびパフォーマンス特性は、お客様ごとに異なる場合があります。
IBM、IBM ロゴ、ibm.com、CICS、Tivoli、WebSphere、Zseriesは、世界の多くの国で登録されたInternational Business Machines Corporationの商標です。他の製品名およびサービス名等は、それぞれIBMまたは各社の商標である場合があります。現時点での IBM の商標リストについては、www.ibm.com/legal/copytrade.shtmlをご覧ください。
Linuxは、Linus Torvaldsの米国およびその他の国における登録商標です。Microsoft, Windows, Windows NT および WindowsロゴはMicrosoft Corporationの米国およびその他の国における商標です。UNIXはThe Open Groupの米国およびその他の国における登録商標です。JavaおよびすべてのJava関連の商標およびロゴは Oracleやその関連会社の米国およびその他の国における商標または登録商標です。
© 2015 IBM Corporation 3
Agenda
MFPF コマンドライン・インタフェース (CLI)
MFPF CLIとは
CLIのインストール
MFPF CLIの使い方
MobileFirstハイブリッドアプリケーションの開発と管理
ネイティブアプリケーションの開発と管理
Androidアプリケーション
iOSアプリケーション
Cordovaアプリケーションの開発と管理
MFPFとUrbanCode Deploy連携
参考情報
© 2015 IBM Corporation 4
MFPF コマンドライン・インタフェース (CLI)
© 2015 IBM Corporation 5
MobileFirstでの開発方法
ネイティブ開発ツール &
コマンドライン・インタフェース(CLI)
•Xcode や Android Studioのようなネイティブ開発ツール
•コマンド・ライン・インタフェース(CLI)でMFPFの開発機能や管理機能を呼び出し
MobileFirst Studio
•クロスプラットフォームのハイブリッドアプリ開発
•リッチページ・エディター•複数の JavaScript フレームワーク
をサポート
© 2015 IBM Corporation 6
コマンドラインで実行できる主な操作–MobileFirstハイブリッドアプリケーションの開発と管理–ネイティブアプリケーションの開発と管理
– iOS, Android, Windows Universal, Windows Phone Silverlight–Cordovaベースアプリケーションの開発と管理
– iOSとAndroidのみ–MobileFirstサーバーインスタンスの管理–アダプターの作成とテスト–コマンドのヘルプなど
CLIをインストール時にパスが設定されるので、
どのディレクトリからでも実施可能
(成果物は実行したディレクトリ下に配置)
MFPFコマンドラインインタフェース(CLI)
Windowsで”mfp”コマンドを実行した時の画面
© 2015 IBM Corporation 7
MFPF CLIのメリット
ネイティブアプリケーション開発者
•MobileFirst Studioを使用しない開発が可能
• CLIでMFPFライブラリ(SDK)の追加やビルドが可能
• GradleやCocoaPodsでの追加
Cordova開発者
•既存のCordovaアプリにMFPFライブラリ(SDK)の追加可能
• CLIでCordovaアプリやプラグインの管理が可能
© 2015 IBM Corporation 8
「Get the Developer Edition」サイトから入手可能
https://developer.ibm.com/mobilefirstplatform/install/#clui
CLIパッケージ名
mobilefirst_cli_installer_7.1.0.zip
CLIはJDKのインストールが必要
CLIの入手方法
(画像は2015/9/23時点のもの)
© 2015 IBM Corporation 9
CLIパッケージを解凍し、コマンドラインからインストーラーを起動しインストール
Windows : install_windows.exe
Mac OS : install_mac.app
Linux : install_linux.bin
CLIのインストール
Windowsのインストール画面
© 2015 IBM Corporation 10
MFPF CLIの使い方
MobileFirstハイブリッドアプリケーションの開発と管理
ネイティブアプリケーションの開発と管理
Androidアプリケーション
iOSアプリケーション
Cordovaアプリケーションの開発と管理
© 2015 IBM Corporation 11
MobileFirstプロジェクトは、ハイブリッドアプリケーション、アダプターなどサーバーサイドで使われる。
プロジェクトの作成 : mfp create <project-name>
MobileFirstプロジェクトの作成
C:¥workspace¥MFP71WK¥clitest01>mfp create MyProject
A MobileFirst Project was successfully created at C:¥workspace¥MFP71WK¥clitest01¥MyProject
Windowsでの実行例
作成されたプロジェクト
© 2015 IBM Corporation 12
MobileFirst開発サーバー(Liberty)の操作コマンドの一例
MobileFirstサーバーインスタンスの管理
mfp server create ローカルの開発サーバーの作成、再作成
mfp start | stop | restart |status | logs
ローカルの開発サーバーの管理。MobileFirstプロジェクトでローカル開発サーバーを起動する
mfp server add | edit | remove
サーバープロファイルの管理。名前、URL、管理クリデンシャル、デフォルトサーバーなど
mfp server info [<server>] 定義済みのサーバープロファイルの情報を表示
mfp push [<server>] ビルドやMFPサーバーへのMobileFirstやクライアントアプリリソースのデプロイを実施mfp push --nosend コマンドを実行するとビルドのみを行う(デプロイは行わない)
mfp console [<server>] 指定したMFPサーバーのオペレーショナルコンソールの起動
mfp config グローバルやアプリレベルの構成設定を行う。application-descriptor.xmlを更新する
© 2015 IBM Corporation 13
MobileFirst開発サーバー(Liberty)の操作コマンドの一例
MobileFirstサーバーインスタンスの管理
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp start
Initializing MobileFirst Console.
サーバー worklight を始動中です。サーバー worklight が始動しました。The server is listening on port 10080.
Server Directory: C:/Users/<ユーザー名>/.ibm/mobilefirst/7.1.0.00.20150907-
1904/server/
URL: http://localhost:10080/
No apps or adapters were available to process.
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp status
サーバー worklight は稼働中です。The server is listening on port 10080.
Server Directory: C:/Users/<ユーザー名>/.ibm/mobilefirst/7.1.0.00.20150907-
1904/server/
URL: http://localhost:10080/
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp console
Opening console for runtime 'MyProject‘
Windowsでの実行例
© 2015 IBM Corporation 14
ハイブリッドアプリの作成 : mfp add hybrid <name>
環境の追加 : mfp add environment
Direct ModeとInteractive Modeの2つがある
ハイブリッドアプリと環境の作成
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp add hybrid MyHybridApp
A new Hybrid App was added at C:¥workspace¥MFP71WK¥clitest01¥MyProject¥apps¥MyHy
bridApp
Windowsでの実行例
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp add environment iphone,android --ap
p MyHybridApp
A new Android phone and tablets Environment was added at C:¥workspace¥MFP71WK¥cl
itest01¥MyProject¥apps¥MyHybridApp¥android
A new iPhone Environment was added at C:¥workspace¥MFP71WK¥clitest01¥MyProject¥a
pps¥MyHybridApp¥iphone
Windowsでの実行例 : Direct Mode
© 2015 IBM Corporation 15
ハイブリッドアプリと環境の作成
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp add environment
[?] What environments you want to add to the hybrid app? (Press <space> to select)
[X] iPhone
[ ] iPad
>[X] Android phone and tablets
[ ] BlackBerry 6 and 7 (deprecated)
[ ] BlackBerry 10
[ ] WindowsPhone8 - Silverlight
[ ] Windows8 - Universal
(Move up and down to reveal more choices)
<Enter>
[?] What environments you want to add to the hybrid app? iPhone, Android phone a
nd tablets
A new Android phone and tablets Environment was added at C:¥workspace¥MFP71WK¥cl
itest01¥MyProject¥apps¥MyHybridApp¥android
A new iPhone Environment was added at C:¥workspace¥MFP71WK¥clitest01¥MyProject¥a
pps¥MyHybridApp¥iphone
Windowsでの実行例 : Interactive Mode
© 2015 IBM Corporation 16
アプリケーションスキンの追加 : mfp add skin
Direct ModeとInteractive Modeの2つがある
オプショナル機能の追加/削除 : mfp add feature / mfp remove feature
Direct ModeとInteractive Modeの2つがある
ハイブリッドアプリと環境の作成
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥apps¥MyHybridApp>mfp add skin -e androi
d Modified
A new android Skin was added at C:¥workspace¥MFP71WK¥clitest01¥MyProject¥apps¥My
HybridApp
Windowsでの実行例 : Direct Mode
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥apps¥MyHybridApp>mfp add feature jsonst
ore
A new jsonstore Feature was added at C:¥workspace¥MFP71WK¥clitest01¥MyProject¥ap
ps¥MyHybridApp
Windowsでの実行例 : Direct Mode
© 2015 IBM Corporation 17
アダプターの作成 : mfp adapter add
Cast Iron, HTTP, Java, JMS, SAP JCo, SAP Netweaver Gateway, SQLアダプターを作成可能
Direct ModeとInteractive Modeの2つがある
アダプターの作成とテスト
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp adapter add
[?] What do you want to name your MobileFirst Adapter? MyAdapter
[?] What type of adapter would you like?
Cast Iron
> HTTP
Java
JMS
SAP JCo
SAP Netweaver Gateway
SQL
[?] Create procedures for offline JSONStore? No
[?] Create procedures for USSD enablement? No
A new http Adapter was added at C:¥workspace¥MFP71WK¥clitest01¥MyProject¥adapter
s¥MyAdapter
Windowsでの実行例 : Interactive Mode
© 2015 IBM Corporation 18
アダプターのテスト : mfp adapter call
Direct ModeとInteractive Modeの2つがある
アダプターの作成とテスト
C:¥workspace¥MFP71WK¥clitest_cordova2¥RSSAdapter>mfp adapter call
[?] Which endpoint do you want to use? RSSAdapter/getFeed
[?] Enter the comma-separated parameters: "world"
[?] How should the procedure be called? GET
Calling GET '/RSSAdapter/adapters/RSSAdapter/getFeed?params=["world"]'
Response:
{
"rss": {
"sy": "http://purl.org/rss/1.0/modules/syndication/",
"channel": {
"lastBuildDate": "Fri, 25 Sep 2015 17:47:20 +0000",
"link": [
~ 以下省略 ~
Windowsでの実行例 : Interactive Mode
© 2015 IBM Corporation 19
ビルドとデプロイ: mfp push
MobileFirstプロジェクトやCordovaプロジェクト、クライアントやサーバーの成果物(.wlapps, .adapters, .warファイル)をビルドし、対象サーバーにデプロイする
ビルドとデプロイ
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp push
Preparing for push...
Verifying Server Configuration...
Runtime 'MyProject' will be used to push the project into.
Pushing to Server...
Deploying C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-iphone-1.0.wlapp...
Deploy complete for C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-iphone-1.0.wlapp.
Deploying C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-android-1.0.wlapp...
Deploy complete for C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-android-1.0.wlapp.
Deploying C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-common.wlapp.
..
Deploy complete for C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-common.wlapp.
Deploying C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥TestAdapter.adapter...
Deploy complete for C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥TestAdapter.adapter.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-iphone-1.0.wlapp has been deployed.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-android-1.0.wlapp has been deployed.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-common.wlapp has been deployed.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥TestAdapter.adapter has been deployed.
Push Completed Successfully.
Windowsでの実行例
© 2015 IBM Corporation 20
ビルドのみ : mfp push --nosend
デプロイはせず、ビルドのみ行う
ビルドとデプロイ
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp push --nosend
Preparing for push...
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-iphone-1.0.wlapp has be
en built.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-android-1.0.wlapp has b
een built.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-common.wlapp has been b
uilt.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥TestAdapter.adapter has been built.
Push Completed Successfully.
Windowsでの実行例
© 2015 IBM Corporation 21
ビルドとデプロイ
C:¥workspace¥MFP71WK¥clitest01¥MyProject>mfp push
Preparing for push...
Verifying Server Configuration...
Runtime 'MyProject' will be used to push the project into.
Pushing to Server...
Deploying C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-iphone-1.0.wlapp...
Deploy complete for C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-iphone-1.0.wlapp.
Deploying C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-android-1.0.wlapp...
Deploy complete for C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-android-1.0.wlapp.
Deploying C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-common.wlapp.
..
Deploy complete for C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-common.wlapp.
Deploying C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥TestAdapter.adapter...
Deploy complete for C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥TestAdapter.adapter.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-iphone-1.0.wlapp has been deployed.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-android-1.0.wlapp has been deployed.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥MyHybridApp-common.wlapp has been deployed.
C:¥workspace¥MFP71WK¥clitest01¥MyProject¥bin¥TestAdapter.adapter has been deployed.
Push Completed Successfully.
Windowsでの実行例
© 2015 IBM Corporation 22
CLIを使用する時に発生する「要求タイムアウト・エラー(Request timeout)は、デフォルトのタイムアウト値を増やすことによって解決することがある
このエラーは、 CLIがMobileFirstサーバーからの応答を 30 秒内に受信しない場合に発生。この通信エラーは、次のいずれかの状況で起こる。
MobileFirstサーバーでのトラフィック負荷が大きい
開発システムと MobileFirstサーバーの間にネットワーク待ち時間がある
MobileFirstサーバーで障害が発生
デフォルト値は 30000 ミリ秒 (30 秒)
組み込みデフォルト・タイムアウト値を指定変更するには、環境変数「MFP_HTTP_DEFAULT_TIMEOUT」の値を設定するか増やす
この変数がまだない場合、変数を作成し、デフォルト値 30000 より大きい値に設定する
この環境変数の値を増やした後、失敗したCLIコマンドを再実行する
要求タイムアウト・エラーの対処法
http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.dev.doc/dev/c_wl_cli_req_tim_error.html
© 2015 IBM Corporation 23
MobileFirstサーバーへのアプリケーションまたはアダプターのプッシュ時にエラー
MobileFirstサーバーにアプリケーションまたはアダプターをプッシュすると、「ランタイム ‘<YourRuntime>’ はこのサーバー上で使用可能ではありません」というエラーが発生
発生したエラーは、 関連付けられたランタイムを CLI がターゲット MobileFirstサーバー上で見つけられないことを示す
CLI が MobileFirstサーバー上で特定のランタイムを検出できないのは、以下のうちの 1 つ以上が原因
MobileFirstサーバーが稼働していない
CLI を実行しているシステムと MobileFirstサーバーとの間にネットワーク接続がない。
ランタイムが MobileFirstサーバーにデプロイされていない
対処方法はオンラインマニュアルに記載あり
Push時の注意点
http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.getstart.doc/start/c_known_limitations.html
© 2015 IBM Corporation 24
MFPF CLIの使い方
MobileFirstハイブリッドアプリケーションの開発と管理
ネイティブアプリケーションの開発と管理
Androidアプリケーション
iOSアプリケーション
Cordovaアプリケーションの開発と管理
© 2015 IBM Corporation 25
MobileFirst Native SDKをアプリケーションに追加
1. リモートのMavenCentralリポジトリーを参照
常に最新のSDKを使用できるので推奨
2. MobileFirst StudioやMFPF CLIツールに含まれるSDKを使用 (クラシック)
MobileFirstサーバーの準備
SDKが含まれていることの確認
(参考)以下のGetting Startedのページ
https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/hello-world/configuring-a-native-android-application-with-the-mfp-sdk/
開発手順
© 2015 IBM Corporation 26
既存のAndroid Studioプロジェクトを開き、build.gradle(Module:app)に追加
MobileFirst Native SDKをアプリケーションに追加- 1.リモートのMavenCentralリポジトリーを参照 -
repositories{
jcenter()
}
packagingOptions {
pickFirst 'META-INF/ASL2.0'
pickFirst 'META-INF/LICENSE'
pickFirst 'META-INF/NOTICE'
}
compile group: 'com.ibm.mobile.foundation',
name: 'ibmmobilefirstplatformfoundation',
version: '7.1.0.0',
ext: 'aar',
transitive: true
© 2015 IBM Corporation 27
AndroidManifest.xmlに追加
MobileFirst Native SDKをアプリケーションに追加- 1.リモートのMavenCentralリポジトリーを参照 -
<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.ACCESS_WIFI_S
TATE"/>
<uses-permission
android:name="android.permission.GET_TASKS" />
<activity
android:name="com.worklight.wlclient.ui.UIActivity" />
© 2015 IBM Corporation 28
MobileFirstプロジェクトの作成
プロジェクトの作成 : mfp create <project-name>
プロジェクトに移動して、開発サーバーの起動: mfp start
Android Studioプロジェクトのビルドとデプロイ
コマンドプロンプトでAndroid Studioプロジェクトのルートに移動
プッシュ: mfp push
MobileFirstサーバーの準備
© 2015 IBM Corporation 29
MobileFirstサーバーの準備
C:¥workspace¥MFP71WK¥clitest_android>mfp create TestApp
A MobileFirst Project was successfully created at C:¥workspace¥MFP71WK¥clitest_a
ndroid¥TestApp
C:¥workspace¥MFP71WK¥clitest_android¥TestApp>mfp start
Initializing MobileFirst Console.
サーバー worklight を始動中です。サーバー worklight が始動しました。The server is listening on port 10080.
Server Directory: C:/Users/<ユーザー名>/.ibm/mobilefirst/7.1.0.00.20150913-
2345/server/
URL: http://localhost:10080/
No apps or adapters were available to process.
C:¥AndroidStudioProjects¥TestApp>mfp push
Preparing for push...
Verifying Server Configuration...
Runtime 'TestApp' will be used to push the project into.
MFP App settings not found, configuring..
Pushing to Server...
Deploying C:¥AndroidStudioProjects¥TestApp¥mobilefirst¥com_example_testapp-Andro
idnative-1.0.wlapp...
Deploy complete for C:¥AndroidStudioProjects¥TestApp¥mobilefirst¥com_example_tes
tapp-Androidnative-1.0.wlapp.
C:¥AndroidStudioProjects¥TestApp¥mobilefirst¥com_example_testapp-Androidnative-1
.0.wlapp has been deployed.
Push Completed Successfully.
Windowsでの実行例
© 2015 IBM Corporation 30
SDKが含まれていることの確認
Android Studioプロジェクトの構造
.wlappファイルが生成。MobileFirst
Serverにデプロイされる
MFPFアプリケーションの定義(メタデータファイル)
「app」-「src」-「main」-「assets」フォルダに「wlclient.properities」ファイルが生成
© 2015 IBM Corporation 31
(参考)MobileFirst Native SDKをアプリケーションに追加- 2. MobileFirst StudioやMFPF CLIツールに含まれるSDKを使用 (クラシック)
(1)MobileFirst Studio
MFPプロジェクトを作成し、MobileFirst Native APIを追加
アプリケーション名とAndroid環境を選択
NativeAPIフォルダを選択し、「Run As > Deploy Native API」を実行
(2)MFPF CLIツール
MobileFirstプロジェクトの作成
プロジェクトの作成 : mfp create <project-name>
Native APIの追加: mfp add api <NativeAPI-name> -e android
プロジェクトに移動して、開発サーバーの起動: mfp start
コマンドプロンプトでAndroid Studioプロジェクトのルートに移動
プッシュ: mfp push
© 2015 IBM Corporation 32
(参考)MobileFirst Native SDKをアプリケーションに追加- 2. MobileFirst StudioやMFPF CLIツールに含まれるSDKを使用 (クラシック)
以下の4つのファイルをMobileFirst Native APIフォルダから、Andoid Studioプロジェクトの「/app/lib/」ディレクトリにコピー
worklight-android.jar, uicandroid.jar, bcprov.jar, android-async-http.jar
コピーしたjarファイルを選択し、
「Add as library」をクリックして、
ライブラリを追加する
© 2015 IBM Corporation 33
(参考)MobileFirst Native SDKをアプリケーションに追加- 2. MobileFirst StudioやMFPF CLIツールに含まれるSDKを使用 (クラシック)
AndroidManifest.xmlに追加<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.ACCESS_WIFI_S
TATE"/>
<uses-permission
android:name="android.permission.GET_TASKS" />
<activity
android:name="com.worklight.wlclient.ui.UIActivity" />
© 2015 IBM Corporation 34
MFPF CLIの使い方
MobileFirstハイブリッドアプリケーションの開発と管理
ネイティブアプリケーションの開発と管理
Androidアプリケーション
iOSアプリケーション
Cordovaアプリケーションの開発と管理
© 2015 IBM Corporation 35
MobileFirst Native SDKをアプリケーションに追加
1. リモートのCocoaPodsリポジトリーを参照
常に最新のSDKを使用できるので推奨
2. MobileFirst StudioやMFPF CLIツールに含まれるSDKを使用 (クラシック)
MobileFirstサーバーの準備
SDKが含まれていることの確認
(参考)以下のGetting Startedのページ
https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/hello-world/configuring-a-native-ios-application-with-the-mfp-sdk/
開発手順
© 2015 IBM Corporation 36
CocoaPodsがインストールされていない場合はインストールする
ターミナルの起動
コマンド実行
sudo gem install cocoapods
pod setup
Xcodeプロジェクトに移動
Podfileの作成
コマンド実行 : pod init
MobileFirst Native SDKをアプリケーションに追加- 1.リモートのCocoaPodsリポジトリーを参照
© 2015 IBM Corporation 37
エディタでPodfileを編集する
既に記載されている内容をコメントアウト(#)
赤字部分を追加
MobileFirst Native SDKをアプリケーションに追加- 1.リモートのCocoaPodsリポジトリーを参照
$ vi Podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0‘
#target 'TestMFP' do
#end
#target 'TestMFPTests' do
#end
source 'https://github.com/CocoaPods/Specs.git‘
pod 'IBMMobileFirstPlatformFoundation‘
iOSでの実行例
© 2015 IBM Corporation 38
MobileFirst Native SDKのインストール
コマンド実行 : pod install
MobileFirst Native SDKをアプリケーションに追加- 1.リモートのCocoaPodsリポジトリーを参照
$ pod install
Updating local specs repositories
CocoaPods 0.39.0.beta.4 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Analyzing dependencies
Downloading dependencies
Installing IBMMobileFirstPlatformFoundation (7.1.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `TestMFP.xcworkspace` for this project
from now on.
Sending stats
iOSでの実行例
© 2015 IBM Corporation 39
MobileFirstプロジェクトの作成
プロジェクトの作成 : mfp create <project-name>
プロジェクトに移動して、開発サーバーの起動: mfp start
Xcodeプロジェクトのビルドとデプロイ
コマンドプロンプトでXcodeプロジェクトに移動
プッシュ: mfp push
途中でアプリケーション名、バンドルIDの入力を行う
MobileFirst Serverサーバーの準備
© 2015 IBM Corporation 40
$ mfp push
Preparing for push...
Verifying Server Configuration...
Runtime 'TestMFP' will be used to push the project into.
MFP App settings not found, configuring..
[?] Enter App name: TestMFP
[?] Enter App Bundle ID: HelloWorldNative
Pushing to Server...
Deploying /Users/<ユーザー名>/Desktop/TestMFP/mobilefirst/HelloWorldNative-iOSnative-
1.0.wlapp...
Deploy complete for /Users/<ユーザー名>//Desktop/TestMFP/mobilefirst/HelloWorldNative-
iOSnative-1.0.wlapp.
/Users/<ユーザー名>//Desktop/TestMFP/mobilefirst/HelloWorldNative-iOSnative-1.0.wlapp
has been deployed.
Push Completed Successfully.
MobileFirst Serverサーバーの準備
iOSでの実行例
アプリケーション名とバンドルIDの入力を行う
プログラムでMobileFirst Native SDKを使う際には、MFPFのフレームワークをインポートする
#import <IBMMobileFirstPlatformFoundation/IBMMobileFirstPlatformFoundation.h>
© 2015 IBM Corporation 41
SDKが含まれていることの確認
XCodeプロジェクトの構造 .wlappファイルが生成。MobileFirst
Serverにデプロイされる
MFPFアプリケーションの定義(メタデータファイル)
サーバーの構成情報
© 2015 IBM Corporation 42
MFPF CLIの使い方
MobileFirstハイブリッドアプリケーションの開発と管理
ネイティブアプリケーションの開発と管理
Androidアプリケーション
iOSアプリケーション
Cordovaアプリケーションの開発と管理
© 2015 IBM Corporation 43
MFP ハイブリッド・アプリと Cordova アプリの比較
MobileFirst Hybrid Client App
MFP Studio
および CLI
サードパーティ・ツール
MBS
MFP SDK
Proprietary / Fixed Build
Proprietary Features
Proprietary Components
Cordova
旧タイプ・プラグイン 固定ランタイム
Cordova Client App
MFP と
Cordova CLI
サードパー
ティ・ツール
MBS
Cordova ランタイム
MFPプラグイン (SDK など)サードパーティ・
プラグイン拡張ビルド
スワップ可能
なランタイム*
スワップ可能
なWebView*
交換可能なCordova ランタイム
付加価値を提供しつつ開発者へ自由を与えるオープンな環境
* 将来的な拡張
従来
V7
.1 C
LI 対応後
拡張可能なビルド
V7.0までと、V7.1のMFP Studioの制約Cordova Plugin を利用する場合は、公開されているままのPluginでは利用できないため、MFPで利用できるように考慮する必要がある・ファイルの配置・プラグインファイル(js)の読込み・プラグイン実行に必要な設定 (Framework,
permission, *.pinfo, AndroidManifest.xml など)
© 2015 IBM Corporation 44
V7.1に含まれているCordovaのバージョン
プラットフォーム
cordova-android: 3.6.4
cordova-blackberry10: 3.6.3
cordova-ios: 3.7.0
cordova-windows: 3.7.1
cordova-wp8: 3.7.0
© 2015 IBM Corporation 45
V7.1に含まれているCordovaのバージョン
プラグイン
org.apache.cordova.battery-status: 0.2.12
org.apache.cordova.camera: 0.3.4
org.apache.cordova.console: 0.2.12
org.apache.cordova.contacts: 0.2.15
org.apache.cordova.device-motion: 0.2.11
org.apache.cordova.device-orientation: 0.3.10
org.apache.cordova.device: 0.2.13
org.apache.cordova.dialogs: 0.2.11
org.apache.cordova.file: 1.3.2
org.apache.cordova.file-transfer: 0.4.8
org.apache.cordova.geolocation: 0.3.11
org.apache.cordova.globalization: 0.3.3
org.apache.cordova.globalization: 0.3.3
org.apache.cordova.inappbrowser: 0.5.4
org.apache.cordova.media-capture: 0.3.5
org.apache.cordova.media: 0.2.15
org.apache.cordova.network-information: 0.2.14
org.apache.cordova.splashscreen: 0.3.5
org.apache.cordova.statusbar: 0.1.9
org.apache.cordova.vibration: 0.3.12
© 2015 IBM Corporation 46
mfp cordovaコマンドの一例
mfp cordova コマンド
mfp cordova create 新しいCordovaアプリケーションの作成
mfp cordova platformadd | remove | list | update
Cordovaアプリケーションの管理
mfp cordova pluginsearch | add | remove | list
プラグイン(MFPF, Cordova core, 3rd party)の管理
mfp cordova previewmfp preview
モバイル・ブラウザ・シミュレータやブラウザを使用したアプリケーションのプレビュー
mfp cordova emulatemfp cordova run
ネイティブのエミュレーターもしくはデバイスでのアプリケーションでの実行
mfp cordova preparemfp cordova compile
アプリケーションのビルド
mfp cordova * 他のCordovaコマンドも直接呼ぶことが可能
© 2015 IBM Corporation 47
Cordovaプロジェクトの作成 : mfp cordova create
Direct ModeとInteractive Modeの2つがある
Android プラットフォーム用のアプリケーションを作成している場合、ANDROID_HOME 環境変数を Android SDK に設定する
Cordovaアプリケーションの作成
C:¥workspace¥MFP71WK¥clitest_cordova>mfp cordova create
[?] Enter name of app: MyCordovaApp
[?] Enter the package ID: com.ibm.MyCordovaApp
[?] Enter the app version: 1.0.0
[?] Select platforms to be supported by your app: (Press <space> to select)
>[X] android
[X] ios
The following plugins will be automatically added to your app:
cordova-plugin-mfp
org.apache.cordova.device
org.apache.cordova.dialogs
org.apache.cordova.geolocation
org.apache.cordova.globalization
org.apache.cordova.inappbrowser
org.apache.cordova.network-information
Windowsでの実行例 Interactive Mode
© 2015 IBM Corporation 48
Cordovaアプリケーションの作成
Select additional plugins you would like to add:
[ ] cordova-plugin-mfp-jsonstore 7.1.0 "IBM MobileFirst Platform Foundation -
JSONStore"
[ ] cordova-plugin-mfp-push 7.1.0 "IBM MobileFirst Platform Foundation - Push
Notifications"
[ ] org.apache.cordova.battery-status 0.2.12 "Battery"
>[ ] org.apache.cordova.camera 0.3.4 "Camera"
[ ] org.apache.cordova.console 0.2.12 "Console"
[ ] org.apache.cordova.contacts 0.2.15 "Contacts"
[ ] org.apache.cordova.device-motion 0.2.11 "Device Motion"
[ ] org.apache.cordova.device-orientation 0.3.10 "Device Orientation"
[ ] org.apache.cordova.file 1.3.2 "File"
[ ] org.apache.cordova.file-transfer 0.4.8 "File Transfer"
[ ] org.apache.cordova.media 0.2.15 "Media"
[ ] org.apache.cordova.media-capture 0.3.5 "Capture"
[ ] org.apache.cordova.splashscreen 0.3.5 "Splashscreen"
[ ] org.apache.cordova.statusbar 0.1.9 "StatusBar"
[ ] org.apache.cordova.vibration 0.3.12 "Vibration“
Enter a path to an app template to be added: (cordova-hello-world-mfp)
Windowsでの実行例 Interactive Mode (続き1)
© 2015 IBM Corporation 49
Cordovaアプリケーションの作成
Embedded Cordova Command: cordova create "MyCordovaApp" "com.ibm.MyCordovaApp" "
MyCordovaApp" --copy-from="C:¥Program Files¥ibm¥MobileFirst-CLI¥mobilefirst-cli¥
node_modules¥cordovacmd¥cordova¥templates¥cordova-hello-world-mfp"
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms¥android
Package: com.ibm.MyCordovaApp
Name: MyCordovaApp
Android target: android-22
Copying template files...
Project successfully created.
~ 途中省略 ~
MFP App settings not found, configuring..
Embedded Cordova Command: cordova prepare android
Embedded Cordova Command: cordova prepare ios
C:¥workspace¥MFP71WK¥clitest_cordova¥MyCordovaApp¥mobilefirst¥com_ibm_MyCordovaA
pp-android-1.0.0.wlapp has been built.
C:¥workspace¥MFP71WK¥clitest_cordova¥MyCordovaApp¥mobilefirst¥com_ibm_MyCordovaA
pp-iphone-1.0.0.wlapp has been built.
Push Completed Successfully.
MFP Cordova project created successfully.
Windowsでの実行例 Interactive Mode (続き2)
現時点のMFP CLIでは、Android target
がandroid-22となっており、API22が必要
© 2015 IBM Corporation 50
Cordovaプロジェクトの構造
mfp cordova plugin addで追加したプラグインガ配置される
.wlappファイルが生成。MobileFirst
Serverにデプロイされる
MFPFアプリケーションの定義(メタデータファイル)
© 2015 IBM Corporation 51
Cordovaプロジェクトのプレビュー
MobileFirstプロジェクトの作成
プロジェクトの作成 : mfp create <project-name>
プロジェクトに移動して、開発サーバーの起動:mfp start
Cordovaアプリのフォルダに移動
アプリケーションのプレビュー:mfp cordova preview
C:¥workspace¥MFP71WK¥clitest_cordova¥MyCordovaApp>mfp cordova preview
[?] Select how to preview your app: browser: Simple browser rendering
[?] Select platform(s) to be previewed: android
Preparing for push...
Verifying Server Configuration...
Runtime 'MyMFPProject' will be used to push the project into.
Embedded Cordova Command: cordova prepare android
Pushing to Server...
Deploying C:¥workspace¥MFP71WK¥clitest_cordova¥MyCordovaApp¥mobilefirst¥com_ibm_
MyCordovaApp-android-1.0.0.wlapp...
Deploy complete for C:¥workspace¥MFP71WK¥clitest_cordova¥MyCordovaApp¥mobilefirs
t¥com_ibm_MyCordovaApp-android-1.0.0.wlapp.
C:¥workspace¥MFP71WK¥clitest_cordova¥MyCordovaApp¥mobilefirst¥com_ibm_MyCordovaA
pp-android-1.0.0.wlapp has been deployed.
Push Completed Successfully.
Windowsでの実行例 Interactive Mode
© 2015 IBM Corporation 52
既存のCordovaユーザーに対するCLI開発
MobileFirstプロジェクトの作成
プロジェクトの作成 : mfp create <project-name>
プロジェクトに移動して、 開発サーバーの起動:mfp start
Cordovaアプリのフォルダに移動
プラットフォームの追加:mfp cordova platform add
プラグインの追加:mfp cordova plugin add
ビルドとデプロイ:mfp push
アプリケーションのプレビュー:mfp cordova preview など
(参考)以下のGetting Startedのページ
https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/hello-world/integrating-mfpf-sdk-in-cordova-applications/#sampleApplication
© 2015 IBM Corporation 53
MFPFとUrbanCode Deploy連携
© 2015 IBM Corporation 54
開発スピードが向上してもボトルネックが発生
ユーザーの要求を、開発側がスピードアップしてこなせるようになったとしても、
機能テスト
アクセプタンス・テスト
実展開オペレーター
セットアップ(数週間)
運用側で対応できないと、企業全体のビジネススピードは上がらない
従来よりも高頻度、短期間でのリリースが必要になり、
品質を落とさない仕組みが必要
© 2015 IBM Corporation 55
構成管理ツールなど
テスト環境~本番環境までのアプリケーション・デプロイの自動化をサポート
デプロイ自動化プラットフォーム (IBM UrbanCode Deploy)
ガバナンス強化工数削減オペレーション・ミスの削減
開発チーム ~ 運用チームまで共通のプラットフォーム (DevOps)
IBM UrbanCode Deployサーバー
テスト環境
ステージング環境
本番環境
アプリケーション(モジュール)取り込み
自動デプロイ(配布)
開発担当 デプロイ担当(運用)
V1.0
V1.1
モジュールのバージョン管理
ツール起動
テストツールなど
© 2015 IBM Corporation 56
UrbanCode Deploy活用イメージ
構成管理
ビルドツール*
(Ant, MFPF CLI)
MFPF
テスト環境MFPF
本番環境
MFPF
開発環境
IBM UrbanCode Deploy
ビルド成果物の登録
自動ビルド
開発担当
運用担当
開発ソースのコミット
各環境へのデプロイ(認証・認可・承認の利用)
ビルドツールからの自動デプロイ
バックエンド開発環境
MFPF成果物だけでなく、バックエンドサーバー(例 WASアプリケーション)を同時にデプロイすることや、並行して複数のリリースを各環境へのデプロイを効率的かつ自動的に行う
ビルドは大きく2パターンあります
①RTCやJenkinsなどのビルド機能でAntやMFPF CLIを呼び出しビルド。生成した成果物をUrbanCode Deployでデプロイ
②構成管理ツールから開発ソースをUrbanCode Deployにインポートし、AntやMFPF CLIを呼び出しビルド、その後デプロイ
バックエンド
テスト環境
バックエンド本番環境
アプリケーション・デプロイ自動化
© 2015 IBM Corporation 57
Webサーバー WebSphere Application Server
Oracle WebLogic Server
Tomcat, JBoss
Apache HTTP Server
IIS
データベース SQL-JDBC
Oracle SQL*Plus
Microsoft SQL Server SQLCmd
Apache Hadoop
インフラ シェル(Shell)
WebSphere MQ
IBM Integration Bus
z/OS Utility (z/OSへのデプロイ)
Docker
Chef, Puppet
IBM Cloud Orchestrator
テストツール InfoSphere Optim Test Data Management
Rational Quality Manager
Rational Test Workbench
JUnit, Selenium
構成管理ツール Rational Team Concert
Subversion, Git
ビルドツール Jenkins
Ant, Maven
モバイル IBM MobileFirst Platform
Apple Xcode, Android SDK
多くのデプロイ先のプラットフォームや、開発ツールとの連携が強みです
連携機能はプラグイン(部品)としてUrbanCodeが提供。独自のカスタムプラグインも開発可能https://developer.ibm.com/urbancode/plugins/ibm-urbancode-deploy/
(参考)UrbanCode Deployのプラグイン
© 2015 IBM Corporation 58
構成管理ツールとUrbanCode Deployの連携
様々な構成管理ツールから成果物の取り込みが可能
© 2015 IBM Corporation 59
MobileFirst Platformプラグイン
コマンドの種類
Worklight Server での Worklight アプリケーションのアクセス規則を変更する
アダプターを Worklight サーバーにデプロイする
Worklight アプリケーションを Worklight サーバーにデプロイする
Worklight サーバーからアダプターを削除
アプリケーション・センターからのアプリケーションの削除
Worklight サーバーから Worklight アプリケーションを削除
アプリケーション・センターへのアプリケーションのアップロード
※MobileFirst Platformプラグインに含まれていない操作を行いたい
場合は、シェルプラグインやAntプラグインなどを使用する
https://developer.ibm.com/urbancode/plugin/ibm-worklight-ibmucd-2/
© 2015 IBM Corporation 60
MFPFとUrbanCode Deployの連携
MobileFirst Platform
Foundation
Application
Center
サーバー
.wlapp
.adapter
Binary
(IPA/APK)UrbanCode Deployのデプロイ設計エディタ
デプロイプロセスをビジュアルに設計することが可能
(ステップ・パレットからコマンドをドラッグ&ドロップで配置)
© 2015 IBM Corporation 61
MFPFとUrbanCode Deployの連携
各コマンドのパラメーターは変数でき、実行時に変換することが可能
(例)${environment}をテスト環境/本番環境で変え、デプロイプロセス自体を共有
© 2015 IBM Corporation 62
参考情報
© 2015 IBM Corporation 63
参考情報
MFPF Getting Started 7.1 All Tutorials
https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/all-tutorials/
MobileFirst Platform Foundation V7.1.0 ドキュメンテーション
http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/wl_welcome.html
IBM UrbanCode Deploy V6.1.1 ドキュメンテーション
http://www-01.ibm.com/support/knowledgecenter/SS4GSP_6.1.1/com.ibm.udeploy.doc/ucd61_welcome.html
IBM UrbanCode Deploy Plugins
https://developer.ibm.com/urbancode/plugins/ibm-urbancode-deploy/
From manual to continuous automated deployment of IBM MobileFirst mobile applications
http://www.ibm.com/developerworks/rational/library/worklight-mobile-devops/
© 2015 IBM Corporation 64
© Copyright IBM Corporation 2012. All rights reserved. The information contained in these materials is provided for informational purposes only, and is provided AS IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, these materials. Nothing contained in these materials is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software. References in these materials to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in these materials may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. IBM, the IBM logo, Rational, the Rational logo, Telelogic, the Telelogic logo, and other IBM products and services are trademarks of the International Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others.