|The example shown in the Extending the Control Center appendix is not correct |and will not work. Use the following information to work with the Java example |instead:
|The sample program PluginEx.java is located in the samples/java subdirectory. PluginEx.java is installed with the DB2 Application |Development client. To compile PluginEx.java, the following must be included |in your classpath: |
|Create the db2plug.zip to include all the classes generated from compiling |PluginEx.java. The file should not be compressed. For example, issue the following:
| zip -r0 db2plug.zip PluginEx*.class
|This command places all the class files into the db2plug.zip file and preserves |the relative path information.
|Follow the instructions in the PluginEx.java file to compile and run the |example.
|The CCObject interface includes more static constants than are listed in |the Extending the Control Center appendix of the Administration Guide. Below |are the Java interfaces for extending the Control Center (CCExtension, |CCObject, CCM enuAction, CCToolBarAction). These interfaces are listed here |for reference only.
|CCExtension:
|// Licensed Materials -- Property of IBM |// |// (c) Copyright International Business Machines Corporation, 1999. |// All Rights Reserved. |// |// US Government Users Restricted Rights - |// Use, duplication or disclosure restricted by |// GSA ADP Schedule Contract with IBM Corp. |// | |package com.ibm.db2.tools.cc.navigator; | |/** | * The CCExtension interface allows users to extend the Control Center user | * interface by adding new toolbar buttons, new menu items and | * remove some predefined set of existing menu actions. | * | * To do so, create a java file which imports the | * com.ibm.db2.tools.cc.navigator package and implements this interface. | * The new file provides the implementation of the getObjects() and | * getToolbarActions() function. | * | * The getObjects() function returns an array of CCObjects which defines | * the existing | * objects which the user would like to add new menu actions or remove | * the alter or configure menu actions. | * | * The getToolbarActions() function returns an array of CCToolbarActions | * which is added to the Control Center main toolbar. | * | * A single CCExtension subclass file or multiple CCExtension subclass | * files can be used to define the Control Center extensions. In order | * for the Control Center to make use of these extensions, use the | * following setup procedures: | * (1) Create a "db2plug.zip" file which contains all the CCExtension | * subclass files. The files should not be compressed. For example, | * if the CCExtension files are in the plugin package and they are | * located in the plugin directory, issue | * zip -r0 db2plug.zip plugin\*.class | * This command will put all the plugin package class files into the | * db2plug.zip file and preserve their relative path information. | * (2) To run WEBCC as an applet, put the db2plug.zip file in where the | * <codebase> tag points to in the WEBCC html file. | * To run the Control Center as an application, put | * the db2plug.zip in a directory pointed to by the CLASSPATH | * envirnoment variable and where the Control Center is run. | * | * For browsers that support multiple archives, just add "db2plug.zip" | * to the archive list of the WEBCC html page. Otherwise, all the | * CCExtension, CCObject, CCToolbarAction, CCMenuAction subclass files | * will have to be in their relative path depending on which package | * they belong to. | */ | |public interface CCExtension |{ | /** | * Get an array of CCObject subclass objects which define | * a list of objects to be overrided 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(); |} | |
|CCObject
|CCObject: |// |// Licensed Materials -- Property of IBM |// |// (c) Copyright International Business Machines Corporation, 1999. |// All Rights Reserved. |// |// US Government Users Restricted Rights - |// Use, duplication or disclosure restricted by |// GSA ADP Schedule Contract with IBM Corp. |// | |package com.ibm.db2.tools.cc.navigator; | |/** | * The CCObject interface allows users to define a new object to be | * inserted into the Control Center tree or changing the behavior of the | * menu actions of an existing object. | */ |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_TABLES_FOLDER = 42; | public static final int UDB_DRDA_TABLE = 43; | public static final int UDB_NODEGROUPS_FOLDER = 44; | public static final int UDB_NODEGROUP = 45; | | public static final int S390_SUBSYSTEMS_FOLDER = 46; | public static final int S390_SUBSYSTEM = 47; | public static final int S390_BUFFERPOOLS_FOLDER = 48; | public static final int S390_BUFFERPOOL = 49; | public static final int S390_VIEWS_FOLDER = 50; | public static final int S390_VIEW = 51; | public static final int S390_DATABASES_FOLDER = 52; | public static final int S390_DATABASE = 53; | public static final int S390_TABLESPACES_FOLDER = 54; | public static final int S390_TABLESPACE = 55; | public static final int S390_TABLES_FOLDER = 56; | public static final int S390_TABLE = 57; | public static final int S390_INDEXS_FOLDER = 58; | public static final int S390_INDEX = 59; | public static final int S390_STORAGE_GROUPS_FOLDER = 60; | public static final int S390_STORAGE_GROUP = 61; | public static final int S390_ALIASES_FOLDER = 62; | public static final int S390_ALIAS = 63; | public static final int S390_SYNONYMS_FOLDER = 64; | public static final int S390_SYNONYM = 65; | public static final int S390_APPLICATION_OBJECTS_FOLDER = 66; | public static final int S390_COLLECTIONS_FOLDER = 67; | public static final int S390_COLLECTION = 68; | public static final int S390_PACKAGES_FOLDER = 69; | public static final int S390_PACKAGE = 70; | public static final int S390_PLANS_FOLDER = 71; | public static final int S390_PLAN = 72; | public static final int S390_PROCEDURES_FOLDER = 73; | public static final int S390_PROCEDURE = 74; | public static final int S390_DB_USERS_FOLDER = 75; | public static final int S390_DB_USER = 76; | public static final int S390_LOCATIONS_FOLDER = 77; | public static final int S390_LOCATION = 78; | public static final int S390_DISTINCT_TYPES_FOLDER = 79; | public static final int S390_DISTINCT_TYPE = 80; | public static final int S390_USER_DEFINED_FUNCTIONS_FOLDER = 81; | public static final int S390_USER_DEFINED_FUNCTION = 82; | public static final int S390_TRIGGERS_FOLDER = 83; | public static final int S390_TRIGGER = 84; | public static final int S390_SCHEMAS_FOLDER = 85; | public static final int S390_SCHEMA = 86; | public static final int S390_CATALOG_TABLES_FOLDER = 87; | public static final int S390_CATALOG_TABLE = 88; | public static final int DCS_GATEWAY_CONNECTIONS_FOLDER = 89; | public static final int DCS_GATEWAY_CONNECTION = 90; | public static final int S390_UTILITY_OBJECTS_FOLDER = 91; | public static final int S390_DATASET_TEMPLATES_FOLDER = 92; | public static final int S390_DATASET_TEMPLATE = 93; | public static final int S390_UTILITY_LISTS_FOLDER = 94; | public static final int S390_UTILITY_LIST = 95; | public static final int S390_UTILITY_PROCEDURES_FOLDER = 96; | public static final int S390_UTILITY_PROCEDURE = 97; | /** | * Total number of object types | */ | public static final int NUM_OBJECT_TYPES = 98; | | /** | * 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 match this fully | * quality 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 CCMenuActions returns by the | * getMenuActions() 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 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 remove from the | * object's popup menu. | * Return true if you do not wish to modify current Alter menu item | * behaviour. | */ | 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. | * Return true if you do not wish to modify current Configuration | * behaviour. | */ | public boolean isConfigurable(); |} | | |
|CCMenuAction:
|// |// Licensed Materials -- Property of IBM |// |// (c) Copyright International Business Machines Corporation, 1999. |// All Rights Reserved. |// |// US Government Users Restricted Rights - |// Use, duplication or disclosure restricted by |// GSA ADP Schedule Contract with IBM Corp. |// | |package com.ibm.db2.tools.cc.navigator; |import java.awt.event.*; |import javax.swing.*; | |/** | * The CCMenuAction class allows users to define a new menu item to be added | * to a Control Center object. The new menu item will be added at the end of | * an object's popup menu. | * | * Note: If the object has a Control Center Refresh and/or | * Filter menu item, the new menu item will be inserted before the Refresh | * and Filter menu. The Control Center Refresh and Filter menu items are | * always at the end of the popup menu. | */ |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. | * @param e Action event | */ | public void actionPerformed(ActionEvent e); |} | | |
|CCToolBarAction
|// Licensed Materials -- Property of IBM |// |// (c) Copyright International Business Machines Corporation, 1999. |// All Rights Reserved. |// |// US Government Users Restricted Rights - |// Use, duplication or disclosure restricted by |// GSA ADP Schedule Contract with IBM Corp. |// | |package com.ibm.db2.tools.cc.navigator; |import java.awt.event.*; |import javax.swing.*; | |/** | * The CCToolbarAction interface class allows users to define a new action | * to be added to the Control Center toolbar. | */ |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 override 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); |} |