src/org/objectweb/cjdbc/console/gui/CjdbcGuiListener.java

説明を見る。
00001 00025 package org.objectweb.cjdbc.console.gui; 00026 00027 import java.awt.event.ActionEvent; 00028 import java.awt.event.ActionListener; 00029 import java.awt.event.MouseEvent; 00030 import java.awt.event.MouseListener; 00031 00032 import javax.management.Notification; 00033 import javax.management.NotificationListener; 00034 import javax.swing.JButton; 00035 00036 import org.objectweb.cjdbc.common.jmx.notifications.CjdbcNotificationList; 00037 import org.objectweb.cjdbc.common.jmx.notifications.JmxNotification; 00038 import org.objectweb.cjdbc.console.gui.constants.GuiCommands; 00039 import org.objectweb.cjdbc.console.gui.objects.DatabaseObject; 00040 00047 public class CjdbcGuiListener implements MouseListener, ActionListener,NotificationListener 00048 { 00049 private CjdbcGui gui; 00050 00056 public CjdbcGuiListener(CjdbcGui gui) 00057 { 00058 this.gui = gui; 00059 } 00060 00061 00062 00068 public void handleNotification(Notification notification,Object handback) 00069 { 00070 String xml = (String)notification.getUserData(); 00071 // If the content of the notification is null, just debug it 00072 if(xml==null) 00073 { 00074 gui.appendDebugText("Got notification with null string"); 00075 return; 00076 } 00077 try 00078 { 00079 JmxNotification notif = JmxNotification.createNotificationFromXmlString(xml); 00080 gui.appendDebugText("----- Jmx Notification -------"); 00081 gui.appendDebugText(notif.toString()); 00082 gui.appendDebugText("-----------------------------------"); 00083 handleNotification(notif.getType(),notif); 00084 } 00085 catch (Exception e) 00086 { 00087 gui.appendDebugText("Exception while handling notification",e); 00088 } 00089 } 00090 00091 private void handleNotification(String type,JmxNotification notification) 00092 { 00093 if(type.equals(CjdbcNotificationList.VIRTUALDATABASE_BACKEND_ADDED)) 00094 { 00095 String backendName = notification.getDataValue(CjdbcNotificationList.DATA_NAME); 00096 String databaseName = notification.getDataValue(CjdbcNotificationList.DATA_DATABASE); 00097 String controller = notification.getControllerJmxName(); 00098 gui.actionLoadBackend(databaseName,backendName,controller,true); 00099 } 00100 else if(type.equals(CjdbcNotificationList.VIRTUALDATABASE_BACKEND_ENABLED)) 00101 { 00102 String backendName = notification.getDataValue(CjdbcNotificationList.DATA_NAME); 00103 gui.actionSetBackendState(backendName); 00104 } 00105 else if(type.equals(CjdbcNotificationList.VIRTUALDATABASE_BACKEND_DISABLED)) 00106 { 00107 String backendName = notification.getDataValue(CjdbcNotificationList.DATA_NAME); 00108 gui.actionSetBackendState(backendName); 00109 } 00110 else if(type.equals(CjdbcNotificationList.VIRTUALDATABASE_BACKEND_RECOVERING)) 00111 { 00112 String backendName = notification.getDataValue(CjdbcNotificationList.DATA_NAME); 00113 gui.actionSetBackendState(backendName); 00114 } 00115 else if(type.equals(CjdbcNotificationList.VIRTUALDATABASE_BACKEND_BACKINGUP)) 00116 { 00117 String backendName = notification.getDataValue(CjdbcNotificationList.DATA_NAME); 00118 gui.actionSetBackendState(backendName); 00119 } 00120 else if(type.equals(CjdbcNotificationList.VIRTUALDATABASE_BACKEND_DISABLING)) 00121 { 00122 String backendName = notification.getDataValue(CjdbcNotificationList.DATA_NAME); 00123 gui.actionSetBackendState(backendName); 00124 } 00125 else if(type.equals(CjdbcNotificationList.CONTROLLER_VIRTUALDATABASE_NEW_DUMP_LIST)) 00126 { 00127 String controller = notification.getControllerJmxName(); 00128 gui.publicActionLoadDumpList(controller); 00129 } 00130 else if(type.equals(CjdbcNotificationList.VIRTUALDATABASE_BACKEND_REMOVED)) 00131 { 00132 String backendName = notification.getDataValue(CjdbcNotificationList.DATA_NAME); 00133 String controller = notification.getControllerJmxName(); 00134 gui.publicActionRemoveBackendFromGui(backendName,controller); 00135 } 00136 00137 } 00138 00142 public void mouseClicked(MouseEvent e) 00143 { 00144 00145 00146 } 00147 00151 public void mousePressed(MouseEvent e) 00152 { 00153 00154 00155 } 00156 00160 public void mouseReleased(MouseEvent e) 00161 { 00162 00163 00164 } 00165 00169 public void mouseEntered(MouseEvent e) 00170 { 00171 00172 } 00173 00177 public void mouseExited(MouseEvent e) 00178 { 00179 00180 00181 } 00182 00186 public void actionPerformed(ActionEvent e) 00187 { 00188 String action = e.getActionCommand(); 00189 gui.appendDebugText("Got action:" + action); 00190 if (action.equals(GuiCommands.COMMAND_QUIT)) 00191 { 00192 gui.publicActionQuit(); 00193 } 00194 else if (action.equals(GuiCommands.COMMAND_ADD_CONTROLLER)) 00195 { 00196 gui.publicActionAddControllerView(); 00197 } 00198 else if (action.equals(GuiCommands.COMMAND_SAVE_CONFIGURATION_FILE)) 00199 { 00200 gui.publicActionSaveConfigurationFile(); 00201 } 00202 if (action.equals(GuiCommands.COMMAND_CLEAN_LOGGING_PANEL)) 00203 { 00204 gui.publicActioncleanLoggingPane(); 00205 } 00206 else if (action.equals(GuiCommands.COMMAND_ADD_CONFIG_FILE)) 00207 { 00208 gui.publicActionAddXmlFile(); 00209 } 00210 else if (action.equals(GuiCommands.COMMAND_SELECT_CONTROLLER)) 00211 { 00212 String controllerName = ((JButton) e.getSource()).getName(); 00213 gui.appendDebugText("Changed controller selection to:" + controllerName); 00214 gui.publicActionSelectNewController(controllerName); 00215 } 00216 else if (action.equals(GuiCommands.COMMAND_SELECT_DATABASE)) 00217 { 00218 DatabaseObject source = (DatabaseObject) e.getSource(); 00219 String databaseName = source.getName(); 00220 gui.appendDebugText("Changed database selection to:" + databaseName); 00221 gui.publicActionSelectNewDatabase(databaseName); 00222 } 00223 else if (action.equals(GuiCommands.COMMAND_ADD_CONTROLLER_CANCEL)) 00224 { 00225 gui.newControllerFrame.setVisible(false); 00226 } 00227 else if (action.equals(GuiCommands.COMMAND_ADD_CONTROLLER_APPROVE)) 00228 { 00229 gui.publicActionAddController(); 00230 } 00231 else if (action.equals(GuiCommands.COMMAND_SAVE_CONFIGURATION_FILE)) 00232 { 00233 gui.publicActionSaveConfigurationFile(); 00234 } 00235 else if (action.equals(GuiCommands.COMMAND_CLEAN_DEBUG_BUFFER)) 00236 { 00237 gui.publicActionCleanDebugBuffer(); 00238 } 00239 else if (action.equals(GuiCommands.COMMAND_DATABASE_AUTHENTICATE)) 00240 { 00241 gui.publicActionLoadAuthenticatedDatabase(); 00242 } 00243 else if (action.equals(GuiCommands.COMMAND_CREATE_BACKEND_APPROVE)) 00244 { 00245 gui.publicActionCreateBackendExecute(); 00246 } 00247 else if (action.equals(GuiCommands.COMMAND_CREATE_BACKEND_CANCEL)) 00248 { 00249 gui.newBackendFrame.setVisible(false); 00250 } 00251 else if (action.equals(GuiCommands.COMMAND_HIDE_CHECKPOINT_FRAME)) 00252 { 00253 gui.selectCheckpointFrame.hide(); 00254 } 00255 else if (action.equals(GuiCommands.COMMAND_HIDE_SHUTDOWN_FRAME)) 00256 { 00257 gui.selectShutdownFrame.hide(); 00258 } 00259 } 00260 00261 }

CJDBCversion1.0.4に対してTue Oct 12 15:15:58 2004に生成されました。 doxygen 1.3.8