Die folgenden Schnittstellen werden bereitgestellt:
Die Schnittstellen werden mit Beispielen in den folgenden Abschnitten beschrieben.
Mit der CCExtension-Schnittstelle können Sie die Benutzerschnittstelle der Steuerzentrale erweitern, um neue Druckknöpfe und Menüpunkte hinzufügen und vorhandene Menüaktionen außer Kraft setzen.
Die externe Schnittstelle ist wie folgt definiert:
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(); }
Zur Verwendung von CCExtension erstellen Sie eine Java-Klasse, die das Paket "com.ibm.db2.tools.cc.navigator" importiert und diese Schnittstelle implementiert. Die neue Klasse muß die Implementierung der Methoden getObjects() und getToolbarActions() bieten.
Die Methode getObjects() liefert ein CCObject-Feld, das die vorhandenen Objekte definiert, zu denen der Benutzer neue Menüpunkte hinzufügen oder aus denen er eine Reihe von vordefinierten Menüpunkten entfernen möchte.
Die Methode getToolbarActions() liefert ein CCToolbarAction-Feld, die zur Hauptmenüleiste der Steuerzentrale hinzugefügt wird.
Eine oder mehrere CCExtension-Unterklassendateien können verwendet werden, um die Erweiterungen der Steuerzentrale zu definieren. Damit die Steuerzentrale diese Erweiterungen verwenden kann, verwenden Sie die folgende Prozedur:
zip -r0 db2plug.zip plugin\*.class
Dieser Befehl setzt alle Klassendateien des Plug-In-Pakets in die Datei "db2plug.zip" und behält die relativen Pfade bei.
Für Browser, die mehrere Archive unterstützen, fügen Sie einfach "db2plug.zip" zur Archivliste der HTML-Seite der Steuerzentrale hinzu. Andernfalls müssen sich alle CCExtension-, CCObject-, CCToolbarAction- und CCMenuAction-Unterklassendateien in Abhängigkeit vom Paket, zu dem sie gehören, in ihren relativen Verzeichnissen befinden.
Mit der CCObject-Schnittstelle können Sie das Verhalten der Menüaktionen eines vorhandenen Objekts ändern.
Die externe Schnittstelle ist wie folgt definiert:
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(); }
Anmerkung: | Zur Zeit sollten die beiden letzten Methoden in CCObject: isEditable() und isConfigurable() immer den Wert wahr (True) liefern. |
Mit der CCMenuAction-Schnittstelle können Sie eine neue Aktion definieren, die von einem Objekt der Steuerzentrale verwendet werden soll.
Die externe Schnittstelle ist wie folgt definiert:
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); }
Mit der CCToolbarAction-Schnittstelle können Sie eine neue Aktion in der Menüleiste der Steuerzentrale definieren.
Die externe Schnittstelle ist wie folgt definiert:
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); }