TIBCO Data Virtualization で Jira Service Management のデータ にリアルタイムアクセスする方法
TIBCO Data Virtualization(TDV)は、複数の多様なデータソースへのアクセスを一元管理するエンタープライズデータ仮想化ソリューションです。CData TIBCO DV Adapter for Jira Service Management と組み合わせることで、TIBCO Data Virtualization 内からJira Service Management のデータに直接フェデレーテッドアクセスが可能になります。この記事では、アダプターのデプロイと Jira Service Management に基づく新しいデータソースの作成手順を解説します。
CData TIBCO DV Adapter は、最適化されたデータ処理機能が組み込まれており、Jira Service Management のデータ とのインタラクションにおいて比類のないパフォーマンスを発揮します。Jira Service Management に対して複雑な SQL クエリを発行すると、アダプターはフィルタや集計などサポートされている SQL 操作を直接 Jira Service Management にプッシュします。組み込みの動的メタデータクエリにより、ネイティブのデータ型を使用してJira Service Management のデータを操作・分析できます。
Jira Service Management TIBCO DV Adapter のデプロイ
コンソールで、TDV Server のインストールディレクトリ内の bin フォルダに移動します。現在のバージョンのアダプターがインストールされている場合は、先にアンデプロイする必要があります。
.\server_util.bat -server localhost -user admin -password ******** -undeploy -version 1 -name JiraServiceDesk
CData TIBCO DV Adapter をローカルフォルダに解凍し、解凍した場所から JAR ファイル(tdv.jiraservicedesk.jar)をサーバーにデプロイします。
.\server_util.bat -server localhost -user admin -password ******** -deploy -package /PATH/TO/tdv.jiraservicedesk.jar
新しい JAR ファイルが正しくロードされるように、サーバーの再起動が必要な場合があります。再起動は、C:\Program Files\TIBCO\TDV Server <version>\bin にある composite.bat スクリプトを実行して行えます。サーバーを再起動した後は、TDV Studio への再認証が必要です。
再起動コマンドの例
.\composite.bat monitor restart
OAuth を使用して Jira Service Management で認証する
Jira Service Management は OAuth プロトコルを使用して認証を行いますが、TDV Studio は内部でブラウザベースの認証をサポートしていないため、OAuth トークンを取得するための簡単な Java アプリケーションを作成して実行する必要があります。取得したトークンは、アダプターから直接 Jira Service Management に接続するために使用されます。
Create the Java Application
- Create a new Java file with preferred name for example GenOAuthSettings.java. This Java file leverages the JiraServiceDeskOAuth class contained within the TDV Adapter JAR to initiate a test connection and perform the required OAuth authentication flow
- Copy and insert the following code into the .java file:
- Place the .java file in the same directory as the tdv.jiraservicedesk.jar file. This is required to prevent classpath resolution errors during compilation and execution
public class GenOAuthSettings {
public static void main(String[] args) {
try {
if (args.length != 2) {
throw new Exception("Input must have two arguments: 'data source', 'connection string'");
}
String source = args[0].replace(" ", "").toLowerCase();
String connectionString = args[1];
String prefix;
if (source.equals("jiraservicedesk")) {
prefix = "jdbc:jiraservicedesk:";
com.cdata.cis.jiraservicedesk.JiraServiceDeskOAuth oauth = new com.cdata.cis.jiraservicedesk.JiraServiceDeskOAuth();
if (!connectionString.startsWith(prefix)) connectionString = prefix + connectionString;
oauth.generateOAuthSettingsFile(connectionString);
}
// More sources can be added below using the same format. You must add the import statement and ensure the jar file resides in the classpath
// else if (source.equals("googlebigquery") || source.equals("bigquery")) {
// prefix = "jdbc:googlebigquery:";
//
// com.cdata.cis.googlebigquery.GoogleBigQueryOAuth oauth = new com.cdata.cis.googlebigquery.GoogleBigQueryOAuth();
//
// if (!connectionString.startsWith(prefix)) connectionString = prefix + connectionString;
// oauth.generateOAuthSettingsFile(connectionString);
// }
else {
throw new Exception("Data Source not supported. Available Data Sources: Jira Service Management");
}
System.out.println("Test Connection Successful!");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Build and run the Java Application
- Open Console and navigate to the directory containing the .java file and adapter jar
- Compile the Java file using the following command:
- Execute the application using one of the following commands:
javac -cp .;tdv.jiraservicedesk.jar GenOAuthSettings.java
java -cp .;tdv.jiraservicedesk.jar GenOAuthSettings "JiraServiceDesk" "connection string"
This command initiates the OAuth authentication flow and generates the OAuth settings file at the location specified in the OAuthSettingsLocation parameter. Once you deploy the adapter and authenticate, you can create a new data source for Jira Service Management in TDV Studio.
TDV Studio で Jira Service Management データソースを作成する
CData TIBCO DV Adapter for Jira Service Management を使用すると、Jira Service Management 用のデータソースを簡単に作成し、データソースをイントロスペクトしてリソースを TDV に追加できます。
データソースの作成
- データソースを追加するフォルダを右クリックし、New -> New Data Source を選択します。
- アダプター(例:Jira Service Management)が表示されるまでスクロールし、Next をクリックします。
- データソースに名前を付けます(例:CData Jira Service Management Source)。
必要な接続プロパティを入力します。
Jira Service Management 接続プロパティの取得・設定方法
任意のJira Service Management Cloud またはJira Service Management Server インスタンスへの接続を確立できます。接続するにはURL プロパティを設定します。
- URL(例:https://yoursitename.atlassian.net)
カスタムフィールドへのアクセス
デフォルトでは、CData 製品はシステムフィールドのみを表示します。Issues のカスタムフィールドにアクセスするには、IncludeCustomFields を設定します。
Jira Service Management への認証
ベーシック認証
ローカルサーバーアカウントで認証するためには、次の接続プロパティを指定します。
- AuthScheme:Basic に設定。
- User:認証ユーザーのユーザー名に設定。
- Password:認証ユーザーのパスワードに設定。
API トークン
Cloud アカウントに接続するには、APIToken を取得する必要があります。API トークンを生成するには、Atlassian アカウントにログインして「API トークン」 -> 「API トークンの作成」をクリックします。生成されたトークンが表示されます。
データに接続するには以下を設定します。
- AuthScheme:APIToken に設定。
- User:認証ユーザーのユーザー名に設定。
- APIToken:作成したAPI トークンに設定。
ちなみに、Cloud アカウントへの接続でパスワード認証を使うことも可能ですが、非推奨となっています。
OAuth 2.0
Jira Service Management のOAuth 2.0 サポート(3LO)を活用して、ログインクレデンシャルなしでデータに接続することもできます。この場合、AuthSchemeをすべてのOAuth フローでOAuth に設定する必要があります。また、すべてのシナリオでカスタムOAuth アプリケーションを作成して構成する必要があります。詳しくは、ヘルプドキュメントの「OAuth」セクションを参照してください。
NOTE:DV Adapter の OAuthSettingsLocation プロパティには、OAuth 認証(上記参照)を実行したときと同じ値を設定してください。
- Create & Close をクリックします。
データソースのイントロスペクト
データソースを作成したら、右クリックして Open を選択することでデータソースをイントロスペクトできます。ダッシュボードで Add/Remove Resources をクリックし、データソースの一部として含めるテーブル、ビュー、ストアドプロシージャを選択します。Next をクリックし、Finish をクリックして、選択した Jira Service Management のテーブル、ビュー、ストアドプロシージャをリソースとして追加します。
After creating and introspecting the data source, you are ready to work with Jira Service Management のデータ in TIBCO Data Virtualization just like you would any other relational data source. You can create views, query using SQL, publish the data source, and more.
データソースを作成してイントロスペクトしたら、他のリレーショナルデータソースと同様に TIBCO Data Virtualization でJira Service Management のデータを操作できるようになります。ビューの作成、SQL によるクエリ、データソースの公開など、さまざまな操作が可能です。