1 /* 2 * Copyright 2007 Sebastien Brunot (sbrunot@gmail.com) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package net.sourceforge.buildmonitor; 17 18 import java.awt.Image; 19 import java.util.List; 20 21 public interface BuildMonitor 22 { 23 /////////////////////////////// 24 // Constants 25 /////////////////////////////// 26 27 static final String MESSAGEKEY_TRAYICON_INITIAL_TOOLTIP = "trayIcon.tooltip.initialMessage"; 28 29 static final String MESSAGEKEY_TRAYICON_MENU_EXIT = "trayIcon.menu.exit"; 30 31 static final String MESSAGEKEY_TRAYICON_MENU_SORT = "trayIcon.menu.sort"; 32 33 static final String MESSAGEKEY_TRAYICON_MENUITEM_EXIT = "trayIcon.menuItem.exit"; 34 35 static final String MESSAGEKEY_TRAYICON_MENUITEM_SORT_BY_NAME = "trayIcon.menuItem.sortByName"; 36 37 static final String MESSAGEKEY_TRAYICON_MENUITEM_SORT_BY_AGE = "trayIcon.menuItem.sortByAge"; 38 39 static final String MESSAGEKEY_TRAYICON_MENUITEM_UPDATE_STATUS_NOW = "trayIcon.menuItem.update"; 40 41 static final String MESSAGEKEY_TRAYICON_MENUITEM_BUILD_SERVER_HOME_PAGE_SUFFIX = "trayIcon.menuItem.buildServerHomePageSuffix"; 42 43 static final String MESSAGEKEY_TRAYICON_MENUITEM_ABOUT = "trayIcon.menuItem.about"; 44 45 static final String MESSAGEKEY_TRAYICON_MENUITEM_OPTIONS = "trayIcon.menuItem.options"; 46 47 static final String MESSAGEKEY_ERROR_DIALOG_TITLE = "errorDialog.title"; 48 49 static final String MESSAGEKEY_UNEXPECTED_ERROR_MESSAGE = "unexpectedError.message"; 50 51 static final String MESSAGEKEY_ERROR_SYSTEMTRAY_NOT_SUPPORTED = "error.systemTray.not.supported"; 52 53 /////////////////////////////// 54 // Methods 55 /////////////////////////////// 56 57 /** 58 * The method to call when an unrecoverable error occurs in the application. It displays 59 * an error message to the end user and then exit. 60 * @param theUnexpectedProblem the Throwable that was unexpected. 61 */ 62 void panic(Throwable theUnexpectedProblem); 63 64 /** 65 * The method to call when an unrecoverable error occurs in the application and you want 66 * to display your own message (instead of a generic one).It displays your error message 67 * to the end user and then exit. 68 * @param theErrorMessage the error message to display to the end user. 69 */ 70 void panic(String theErrorMessage); 71 72 /** 73 * Get a message identified by its key in the application resource bundle. 74 * The available messages key for the application all begins with prefix MESSAGEKEY_. 75 * @param theMessageKey the message key 76 * @return the message 77 */ 78 String getMessage(String theMessageKey); 79 80 /** 81 * Returns the default icon to be displayed by dialogs opened by monitors 82 * @return the default icon to be displayed by dialogs opened by monitors 83 */ 84 Image getDialogsDefaultIcon(); 85 86 /** 87 * Update the build status (this method is called by build monitors to update the GUI when 88 * the build status has changed). 89 * 90 * @param theBuildsStatus a List that contains the each build report to use to update the 91 * global status. 92 */ 93 void updateBuildStatus(List<BuildReport> theBuildsStatus); 94 95 /** 96 * Report a monitoring exception (this method is called by build monitors to notify that 97 * a monitoring exception occured) 98 * 99 * @param theMonitoringException the monitoring exception to display to the end user 100 */ 101 void reportMonitoringException(MonitoringException theMonitoringException); 102 103 /** 104 * Report an update of the monitor configuration to be taken into account immediately 105 */ 106 void reportConfigurationUpdatedToBeTakenIntoAccountImmediately(); 107 }