com.infoteria.asteria.flowbuilder2.plugin
Class PluginUtil

java.lang.Object
  |
  +--com.infoteria.asteria.flowbuilder2.plugin.PluginUtil

public class PluginUtil
extends Object

プラグイン作成で使用するユーティリティメソッド


Constructor Summary
PluginUtil()
           
 
Method Summary
static void configureFileProperty(BaseObjectUndoableEvent e, File f, String filepathProp, String pathResolverProp)
          ファイルパスを表すプロパティと、そのベースを表すプロパティに対してFileChooserで選択したファイルのパスを設定します。 設定するファイルのパスがプロジェクトのあるディレクトリ階層とは異なる階層にある場合はベースが変更されます。
static boolean deleteFile(String filepath)
          サーバーからファイルを削除します。
static InputStream downloadFile(String filepath)
          サーバーからファイルをダウンロードします。
static JFrame getApplicationFrame()
          デザイナーのメインフレームを返します。
Dialogを表示する場合の親ウィンドウとして使用できます。
static String[] getConnectionNames(String type)
          現在接続中のサーバーでのコネクション一覧を返します。
static JFileChooser getFileChooser(String initialDir)
          サーバーのファイル選択ダイアログを取得します。
static String getFilePath(BaseObject obj, String filepathPropName, String pathResolverPropName)
          ファイルパスを表すプロパティと、そのベースを表すプロパティから、 ユーザーのホームディレクトリからの相対パスを作成します。
static JFileChooser getFolderChooser(String initialDir)
          サーバーのフォルダ選択ダイアログを取得します。
static HttpClient getHttpClient()
          Httpアクセスを行うためのHttpClientを取得します。
取得したHttpClientにはProxy設定がされています。
HttpClientの使用方法はcommons-httpclientのドキュメントを参照してください。
static String getProjectDir()
          現在編集中のプロジェクト(関数コレクション)のあるディレクトリを返します。
static ProjectListProvider getProjectListProvider()
          現在のコンテキストでのProjectListProviderを取得します。
static InputStream getResourceStream(URL url)
          http/https経由でのリソースを取得します。
static SQLTool getSQLTool()
          現在のコンテキストでのSQLToolを取得します。
static com.infoteria.asteria.util.rdb.ColumnInfo[] getTableFields(String dsname, String tblname)
          Deprecated. このメソッドは現在のコンテキストに依存します。
SQLTool#getTableFieldsをご使用ください。
static String[] getTableNames(String dsname)
          Deprecated. このメソッドは現在のコンテキストに依存します。
SQLTool#getTableNamesをご使用ください。
static File getUserDir()
          ユーザー情報等のファイルを保存するためのディレクトリを返します。
実際に返されるディレクトリは「OSUSER_HOME/.asteria」です。
static boolean inUndoProcess()
          現在がUndo(またはRedo)実行中かどうかを返します。
static String normalizeFilePath(File f)
          サーバーから選択したFileオブジェクトのUSER_HOMEからの相対パスを取得します。
static PluginResponse pluginCall(PluginRequest request)
          サーバー側でコンポーネントのpluginCallメソッドを実行します。
static int showConfirm(String msg, int optionType)
          確認メッセージのダイアログを表示します。
引数のoptionTypeと返り値にはJOptionPaneのoptionTypeを使用します。
static void showError(String msg)
          エラーメッセージのダイアログを表示します。
static void showMessage(String msg)
          情報メッセージのダイアログを表示します。
static void showWarning(String msg)
          警告メッセージのダイアログを表示します。
static UndoableEdit updateCategoryProperty(CategoryProperty dest, CategoryProperty src)
          destのCategoryPropertyにsrcの内容を反映してそのUndo情報を返します。
destとsrcの内容が同一である場合はnullを返します。
static void uploadFile(String filepath, File f)
          ローカルにあるファイルをサーバーにアップロードします。
static void uploadTextFile(String filepath, String text, String enc)
          文字列を指定のエンコーディングでサーバーにテキストファイルとしてアップロードします。
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginUtil

public PluginUtil()
Method Detail

getUserDir

public static File getUserDir()
ユーザー情報等のファイルを保存するためのディレクトリを返します。
実際に返されるディレクトリは「OSUSER_HOME/.asteria」です。

getApplicationFrame

public static JFrame getApplicationFrame()
デザイナーのメインフレームを返します。
Dialogを表示する場合の親ウィンドウとして使用できます。

showError

public static void showError(String msg)
エラーメッセージのダイアログを表示します。

showWarning

public static void showWarning(String msg)
警告メッセージのダイアログを表示します。

showMessage

public static void showMessage(String msg)
情報メッセージのダイアログを表示します。

showConfirm

public static int showConfirm(String msg,
                              int optionType)
確認メッセージのダイアログを表示します。
引数のoptionTypeと返り値にはJOptionPaneのoptionTypeを使用します。

updateCategoryProperty

public static UndoableEdit updateCategoryProperty(CategoryProperty dest,
                                                  CategoryProperty src)
destのCategoryPropertyにsrcの内容を反映してそのUndo情報を返します。
destとsrcの内容が同一である場合はnullを返します。

getConnectionNames

public static String[] getConnectionNames(String type)
                                   throws IOException
現在接続中のサーバーでのコネクション一覧を返します。

getTableNames

public static String[] getTableNames(String dsname)
                              throws IOException
Deprecated. このメソッドは現在のコンテキストに依存します。
SQLTool#getTableNamesをご使用ください。

現在接続中のサーバーでのdsnameに対応するコネクションのテーブル一覧を返します。

getTableFields

public static com.infoteria.asteria.util.rdb.ColumnInfo[] getTableFields(String dsname,
                                                                         String tblname)
                                                                  throws IOException
Deprecated. このメソッドは現在のコンテキストに依存します。
SQLTool#getTableFieldsをご使用ください。

現在接続中のサーバーでのdsnameとtblnameに対応するテーブルのフィールド一覧を返します。

getSQLTool

public static SQLTool getSQLTool()
現在のコンテキストでのSQLToolを取得します。

uploadFile

public static void uploadFile(String filepath,
                              File f)
                       throws IOException
ローカルにあるファイルをサーバーにアップロードします。

uploadTextFile

public static void uploadTextFile(String filepath,
                                  String text,
                                  String enc)
                           throws IOException
文字列を指定のエンコーディングでサーバーにテキストファイルとしてアップロードします。
Parameters:
filepath - アップロードするファイルパス。(USER_HOMEからの相対)
text - 文字列
enc - エンコーディング

downloadFile

public static InputStream downloadFile(String filepath)
                                throws IOException
サーバーからファイルをダウンロードします。
Parameters:
filepath - ダウンロードするファイルパス。(USER_HOMEからの相対)

deleteFile

public static boolean deleteFile(String filepath)
                          throws IOException
サーバーからファイルを削除します。
Parameters:
filepath - 削除するファイルパス。(USER_HOMEからの相対)

getFileChooser

public static JFileChooser getFileChooser(String initialDir)
                                   throws IOException
サーバーのファイル選択ダイアログを取得します。
Parameters:
initialDir - 初期ディレクトリ(USER_HOMEからの相対)

getFolderChooser

public static JFileChooser getFolderChooser(String initialDir)
                                     throws IOException
サーバーのフォルダ選択ダイアログを取得します。
Parameters:
initialDir - 初期ディレクトリ(USER_HOMEからの相対)

normalizeFilePath

public static String normalizeFilePath(File f)
                                throws IOException
サーバーから選択したFileオブジェクトのUSER_HOMEからの相対パスを取得します。

getProjectDir

public static String getProjectDir()
現在編集中のプロジェクト(関数コレクション)のあるディレクトリを返します。

configureFileProperty

public static void configureFileProperty(BaseObjectUndoableEvent e,
                                         File f,
                                         String filepathProp,
                                         String pathResolverProp)
                                  throws IOException
ファイルパスを表すプロパティと、そのベースを表すプロパティに対してFileChooserで選択したファイルのパスを設定します。 設定するファイルのパスがプロジェクトのあるディレクトリ階層とは異なる階層にある場合はベースが変更されます。
Parameters:
e - プロパティ設定が行われるされるイベント
f - プロパティ値として設定されるファイル
filepathProp - ファイルパスを表すプロパティの名前
pathResolverProp - ファイルのベースを表すプロパティの名前

getFilePath

public static String getFilePath(BaseObject obj,
                                 String filepathPropName,
                                 String pathResolverPropName)
ファイルパスを表すプロパティと、そのベースを表すプロパティから、 ユーザーのホームディレクトリからの相対パスを作成します。
Parameters:
obj - コンポーネントまたはマッパー関数
filepathPropName - ファイルパスを表すプロパティの名前
pathResolverPropName - ファイルのベースを表すプロパティの名前

pluginCall

public static PluginResponse pluginCall(PluginRequest request)
                                 throws IOException
サーバー側でコンポーネントのpluginCallメソッドを実行します。

inUndoProcess

public static boolean inUndoProcess()
現在がUndo(またはRedo)実行中かどうかを返します。

getProjectListProvider

public static ProjectListProvider getProjectListProvider()
現在のコンテキストでのProjectListProviderを取得します。

getResourceStream

public static InputStream getResourceStream(URL url)
                                     throws IOException
http/https経由でのリソースを取得します。

getHttpClient

public static HttpClient getHttpClient()
Httpアクセスを行うためのHttpClientを取得します。
取得したHttpClientにはProxy設定がされています。
HttpClientの使用方法はcommons-httpclientのドキュメントを参照してください。