管理の手引き


インターフェースについての説明

以下のインターフェースが付属しています。

インターフェースについては次の節で説明され、その後に例が続きます。

CCExtension

CCExtension インターフェースを使うと、新しいツールバー・ボタン、 新しいメニュー項目を追加し、 さらに既存のメニュー・アクションをオーバーライドすることにより、 コントロール・センターのユーザー・インターフェースを拡張できます。

外部インターフェースは次のように定義されます。

   public interface CCExtension
   {
      /**
       * Get an array of CCObject subclass objects which define
       * a list of objects to be inserted or overridden in the
       * Control Center
       * @return CCObject[] CCObject subclass objects array
       */
      public CCObject[] getObjects();
 
      /**
       * Get an array of CCToolbarAction subclass objects which represent
       * a list of buttons to be added to the Control Center
       * main toolbar.
       * @return CCToolbarAction[] CCToolbarAction subclass objects array
       */
      public CCToolbarAction[] getToolbarActions();
   }

CCExtension を使用するには、"com.ibm.db2.tools.cc.navigator" パッケージをインポートし、 このインターフェースを実装する Java クラスを作成します。 この新しいクラスには、 getObjects() および getToolbarActions() メソッドを実装する必要があります。

getObjects() メソッドは CCObject の配列を戻します。 この配列では、ユーザーが新しいメニュー・アクションを追加するとき、 あるいは事前定義された一連のメニュー・アクションを削除するときの、 既存のオブジェクトが定義されます。

getToolbarActions() メソッドは CCToolbarAction の配列を戻します。 この配列は、コントロール・センターのメイン・ツールバーに追加されます。

コントロール・センターの拡張機能を定義するときには、 1 つの CCExtension サブクラス・ファイルを使うこともできますし、 複数の CCExtension サブクラス・ファイルを使用することも可能です。 これらの拡張機能を使うコントロール・センターでは、以下のセットアップ手順を使います。

  1. すべての CCExtension サブクラス・ファイルを含む、 "db2plug.zip" ファイルを作成します。 このファイルは圧縮しないようにします。 たとえば、CCExtension ファイルがプラグイン・パッケージに含まれていて、 そのプラグインのディレクトリーにある場合、次のように入力します。
       zip -r0 db2plug.zip plugin\*.class
    

    このコマンドを発行すると、 プラグイン・パッケージの全クラス・ファイルが db2plug.zip ファイルに入れられ、 その相対パス情報が保存されます。

  2. コントロール・センターをアプレットとして実行するには、db2plug.zip ファイルを、 コントロール・センターの HTML ファイルで <codebase> タグが示す位置に置きます。 コントロール・センターをアプリケーションとして実行するには、db2plug.zip を、 CLASSPATH 環境変数で示されたディレクトリーに入れておきます。

複数のアーカイブをサポートしているブラウザーでは、 「コントロール・センター」の HTML ページのアーカイブ・リストに、 "db2plug.zip" と追加するだけで済みます。 それ以外のブラウザーでは、CCExtension、CCObject、 CCToolbarAction、および CCMenuAction サブクラス・ファイルはすべて、 それぞれが属するパッケージに応じてその相対ディレクトリーに入れておく必要があります。

CCObject

CCObject インターフェースを使用すると、 既存オブジェクトのメニュー・アクションの動作を変更できます。

外部インターフェースは次のように定義されます。

public interface CCObject
{
   /**
    * The following static constants defines a list of object type
    * available to be added to the Control Center tree.
    */
   public static final int UDB_SYSTEMS_FOLDER                          = 0;
   public static final int UDB_SYSTEM                                  = 1;
   public static final int UDB_INSTANCES_FOLDER                        = 2;
   public static final int UDB_INSTANCE                                = 3;
   public static final int UDB_DATABASES_FOLDER                        = 4;
   public static final int UDB_DATABASE                                = 5;
   public static final int UDB_TABLES_FOLDER                           = 6;
   public static final int UDB_TABLE                                   = 7;
   public static final int UDB_TABLESPACES_FOLDER                      = 8;
   public static final int UDB_TABLESPACE                              = 9;
   public static final int UDB_VIEWS_FOLDER                            = 10;
   public static final int UDB_VIEW                                    = 11;
   public static final int UDB_ALIASES_FOLDER                          = 12;
   public static final int UDB_ALIAS                                   = 13;
   public static final int UDB_TRIGGERS_FOLDER                         = 14;
   public static final int UDB_TRIGGER                                 = 15;
   public static final int UDB_SCHEMAS_FOLDER                          = 16;
   public static final int UDB_SCHEMA                                  = 17;
   public static final int UDB_INDEXES_FOLDER                          = 18;
   public static final int UDB_INDEX                                   = 19;
   public static final int UDB_CONNECTIONS_FOLDER                      = 20;
   public static final int UDB_CONNECTION                              = 21;
   public static final int UDB_REPLICATION_SOURCES_FOLDER              = 22;
   public static final int UDB_REPLICATION_SOURCE                      = 23;
   public static final int UDB_REPLICATION_SUBSCRIPTIONS_FOLDER        = 24;
   public static final int UDB_REPLICATION_SUBSCRIPTION                = 25;
   public static final int UDB_BUFFERPOOLS_FOLDER                      = 26;
   public static final int UDB_BUFFERPOOL                              = 27;
   public static final int UDB_APPLICATION_OBJECTS_FOLDER              = 28;
   public static final int UDB_USER_DEFINED_DISTINCT_DATATYPES_FOLDER  = 29;
   public static final int UDB_USER_DEFINED_DISTINCT_DATATYPE          = 30;
   public static final int UDB_USER_DEFINED_DISTINCT_FUNCTIONS_FOLDER  = 31;
   public static final int UDB_USER_DEFINED_DISTINCT_FUNCTION          = 32;
   public static final int UDB_PACKAGES_FOLDER                         = 33;
   public static final int UDB_PACKAGE                                 = 34;
   public static final int UDB_STORE_PROCEDURES_FOLDER                 = 35;
   public static final int UDB_STORE_PROCEDURE                         = 36;
   public static final int UDB_USER_AND_GROUP_OBJECTS_FOLDER           = 37;
   public static final int UDB_DB_USERS_FOLDER                         = 38;
   public static final int UDB_DB_USER                                 = 39;
   public static final int UDB_DB_GROUPS_FOLDER                        = 40;
   public static final int UDB_DB_GROUP                                = 41;
   public static final int UDB_DRDA_TABLE                              = 42;
 
   public static final int S390_SUBSYSTEMS_FOLDER                      = 43;
   public static final int S390_SUBSYSTEM                              = 44;
   public static final int S390_BUFFERPOOLS_FOLDER                     = 45;
   public static final int S390_BUFFERPOOL                             = 46;
   public static final int S390_VIEWS_FOLDER                           = 47;
   public static final int S390_VIEW                                   = 48;
   public static final int S390_DATABASES_FOLDER                       = 49;
   public static final int S390_DATABASE                               = 50;
   public static final int S390_TABLESPACES_FOLDER                     = 51;
   public static final int S390_TABLESPACE                             = 52;
   public static final int S390_TABLES_FOLDER                          = 53;
   public static final int S390_TABLE                                  = 54;
   public static final int S390_INDEXS_FOLDER                          = 55;
   public static final int S390_INDEX                                  = 56;
   public static final int S390_STORAGE_GROUPS_FOLDER                  = 57;
   public static final int S390_STORAGE_GROUP                          = 58;
   public static final int S390_ALIASES_FOLDER                         = 59;
   public static final int S390_ALIAS                                  = 60;
   public static final int S390_SYNONYMS_FOLDER                        = 61;
   public static final int S390_SYNONYM                                = 62;
   public static final int S390_APPLICATION_OBJECTS_FOLDER             = 63;
   public static final int S390_COLLECTIONS_FOLDER                     = 64;
   public static final int S390_COLLECTION                             = 65;
   public static final int S390_PACKAGES_FOLDER                        = 66;
   public static final int S390_PACKAGE                                = 67;
   public static final int S390_PLANS_FOLDER                           = 68;
   public static final int S390_PLAN                                   = 69;
   public static final int S390_PROCEDURES_FOLDER                      = 70;
   public static final int S390_PROCEDURE                              = 71;
   public static final int S390_DB_USERS_FOLDER                        = 72;
   public static final int S390_DB_USER                                = 73;
   public static final int S390_LOCATIONS_FOLDER                       = 74;
   public static final int S390_LOCATION                               = 75;
   public static final int S390_DISTINCT_TYPES_FOLDER                  = 76;
   public static final int S390_DISTINCT_TYPE                          = 77;
   public static final int S390_USER_DEFINED_FUNCTIONS_FOLDER          = 78;
   public static final int S390_USER_DEFINED_FUNCTION                  = 79;
   public static final int S390_TRIGGERS_FOLDER                        = 80;
   public static final int S390_TRIGGER                                = 81;
   public static final int S390_SCHEMAS_FOLDER                         = 82;
   public static final int S390_SCHEMA                                 = 83;
   public static final int S390_CATALOG_TABLES_FOLDER                  = 84;
   public static final int S390_CATALOG_TABLE                          = 85;
   public static final int DCS_GATEWAY_CONNECTIONS_FOLDER              = 86;
   public static final int DCS_GATEWAY_CONNECTION                      = 87;
 
   /**
    * Total number of object types
    */
   public static final int NUM_OBJECT_TYPES                            = 88;
 
   /**
    * Get the name of these object
    * The function returns the name of this object. This name
    * can be of three types:
    * (1) Fully qualified name
    *     Syntax: xxxxx-yyyyy-zzzzz
    *             where xxxxx-yyyyy is the fully quality name of the
    *             parent object and zzzzz is the name of the new object.
    *     Note: Parent and child object name is separated by '-' character.
    *     If a schema name is required to identify object, the fully
    *     qualified name is represented by xxxxx-yyyyy-wwwww.zzzzz
    *     where wwwww is the schema name.
    *     Only the behavior of the object that matches this fully
    *     qualified name will be affected.
    * (2) Parent fully qualified name
    *     Syntax: xxxxx-yyyyy
    *             where xxxxx-yyyyy is the fully qualified name of the
    *             parent object.
    *     When the object type is folder (ie. DATABASES_FOLDER), the
    *     getName() should only return the fully qualified name of the
    *     folder's parent.
    *     Only the behavior of the object that match this name
    *     and the specific type return by the getType() function will be
    *     affected.
    * (3) null
    *     Syntax: null
    *     If null is return, the CCActions returns by the getActions()
    *     call will be applied to all objects of type returns by the
    *     getType() call.
    * @return String object name
    */
   public String getName();
 
   /**
    * Get the type of this object
    * @return int return one of the static type constants defined
    * in this interface
    */
   public int getType();
 
   /**
    * Get the CCMenu Action array which defines the list of menu actions
    * to be created for the selected object
    * return CCMenuAction[] CCMenuAction array
    */
   public CCMenuAction[] getMenuActions();
 
   /**
    * Check if this object is editable.
    * If not, the Alter related menu items will be removed from
    * the object's popup menu return boolean If false, the Alter
    * menu item will be removed from the object's popup menu
    */
   public boolean isEditable();
 
   /**
    * Check if this object is configurable.
    * If not, the configuration related menu items will be
    * removed from the object's popup menu return boolean If
    * false, the Configuration related menu item will be removed
    * from the object's popup menu
    */
   public boolean isConfigurable();
}

注:現時点で、 CCObject における最後の 2 つのメソッド isEditable()isConfigurable() は、 常に true を戻すはずです。

CCMenuAction

CCMenuAction インターフェースを使うと、 コントロール・センター・オブジェクトで使用する新しいアクションを定義できます。

外部インターフェースは次のように定義されます。

public interface CCMenuAction
{
   /**
    * Get the name of this action
    * @return String Name text on the menu item
    */
   public String getMenuText();
   /**
    * Invoked when an action occurs. Use the getActionCommand()
    * method of the ActionEvent to get the fully qualified name of
    * the invoked Control Center object.
    * @param e Action event
    */
   public void actionPerformed(ActionEvent e);
}

CCToolBarAction

CCToolbarAction インターフェースを使用すると、 コントロール・センターのツールバーに新しいアクションを定義できます。

外部インターフェースは次のように定義されます。

public interface CCToolbarAction
{
   /**
    * Get the name of this action
    * @return String Name text on the menu item, or toolbar
    * button hover help
    */
   public String getHoverHelpText();
 
   /**
    * Get the icon for the toolbar button
    * Any toolbar CCAction should implement this function and return
    * a valid ImageIcon object. Otherwise, the button will have no icon.
    * @return ImageIcon Icon to be displayed
    */
   public ImageIcon getIcon();
 
   /**
    * Invoked when an action occurs.
    * @param e Action event
    */
   public void actionPerformed(ActionEvent e);
}


[ ページのトップ | 前ページ | 次ページ | 目次 | 索引 ]