Class PluginUtil

java.lang.Object
com.infoteria.asteria.flowbuilder2.plugin.PluginUtil

public class PluginUtil extends Object
プラグイン作成で使用するユーティリティメソッド
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    configureFileProperty(BaseObjectUndoableEvent e, File f, String filepathProp, String pathResolverProp)
    ファイルパスを表すプロパティと、そのベースを表すプロパティに対してFileChooserで選択したファイルのパスを設定します。 設定するファイルのパスがプロジェクトのあるディレクトリ階層とは異なる階層にある場合はベースが変更されます。
    static boolean
    deleteFile(String filepath)
    サーバーからファイルを削除します。
    downloadFile(String filepath)
    サーバーからファイルをダウンロードします。
    static JFrame
    デザイナーのメインフレームを返します。
    Dialogを表示する場合の親ウィンドウとして使用できます。
    static String[]
    現在接続中のサーバーでのコネクション一覧を返します。
    getFileChooser(String initialDir)
    サーバーのファイル選択ダイアログを取得します。
    static String
    getFilePath(BaseObject obj, String filepathPropName, String pathResolverPropName)
    ファイルパスを表すプロパティと、そのベースを表すプロパティから、 ユーザーのホームディレクトリからの相対パスを作成します。
    サーバーのフォルダ選択ダイアログを取得します。
    static org.apache.commons.httpclient.HttpClient
    Httpアクセスを行うためのHttpClientを取得します。
    取得したHttpClientにはProxy設定がされています。
    HttpClientの使用方法はcommons-httpclientのドキュメントを参照してください。
    static String
    現在編集中のプロジェクト(関数コレクション)のあるディレクトリを返します。
    現在のコンテキストでのProjectListProviderを取得します。
    http/https経由でのリソースを取得します。
    static SQLTool
    現在のコンテキストでのSQLToolを取得します。
    static com.infoteria.asteria.util.rdb.ColumnInfo[]
    getTableFields(String dsname, String tblname)
    Deprecated.
    このメソッドは現在のコンテキストに依存します。
    SQLTool#getTableFieldsをご使用ください。
    static String[]
    Deprecated.
    このメソッドは現在のコンテキストに依存します。
    SQLTool#getTableNamesをご使用ください。
    static File
    ユーザー情報等のファイルを保存するためのディレクトリを返します。
    実際に返されるディレクトリは「OSUSER_HOME/.asteria」です。
    static boolean
    現在がUndo(またはRedo)実行中かどうかを返します。
    static String
    サーバーから選択したFileオブジェクトのUSER_HOMEからの相対パスを取得します。
    サーバー側でコンポーネントのpluginCallメソッドを実行します。
    static int
    showConfirm(String msg, int optionType)
    確認メッセージのダイアログを表示します。
    引数のoptionTypeと返り値にはJOptionPaneのoptionTypeを使用します。
    static void
    エラーメッセージのダイアログを表示します。
    static void
    情報メッセージのダイアログを表示します。
    static void
    警告メッセージのダイアログを表示します。
    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 Details

    • PluginUtil

      public PluginUtil()
  • Method Details

    • 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
      現在接続中のサーバーでのコネクション一覧を返します。
      Throws:
      IOException
    • getTableNames

      @Deprecated public static String[] getTableNames(String dsname) throws IOException
      Deprecated.
      このメソッドは現在のコンテキストに依存します。
      SQLTool#getTableNamesをご使用ください。
      現在接続中のサーバーでのdsnameに対応するコネクションのテーブル一覧を返します。
      Throws:
      IOException
    • getTableFields

      @Deprecated public static com.infoteria.asteria.util.rdb.ColumnInfo[] getTableFields(String dsname, String tblname) throws IOException
      Deprecated.
      このメソッドは現在のコンテキストに依存します。
      SQLTool#getTableFieldsをご使用ください。
      現在接続中のサーバーでのdsnameとtblnameに対応するテーブルのフィールド一覧を返します。
      Throws:
      IOException
    • getSQLTool

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

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

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

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

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

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

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

      public static String normalizeFilePath(File f) throws IOException
      サーバーから選択したFileオブジェクトのUSER_HOMEからの相対パスを取得します。
      Throws:
      IOException
    • 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 - ファイルのベースを表すプロパティの名前
      Throws:
      IOException
    • 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メソッドを実行します。
      Throws:
      IOException
    • inUndoProcess

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

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

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

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