1 21 22 package org.continuent.sequoia.controller.management; 23 24 import java.io.IOException ; 25 import java.rmi.RemoteException ; 26 import java.util.List ; 27 28 import javax.management.NotCompliantMBeanException ; 29 30 import org.continuent.sequoia.common.exceptions.ControllerException; 31 import org.continuent.sequoia.common.i18n.Translate; 32 import org.continuent.sequoia.common.jmx.mbeans.ControllerMBean; 33 import org.continuent.sequoia.common.log.Trace; 34 import org.continuent.sequoia.controller.jmx.AbstractStandardMBean; 35 36 42 public class Controller extends AbstractStandardMBean 43 implements 44 ControllerMBean 45 { 46 47 private org.continuent.sequoia.controller.core.Controller controller; 48 static Trace endUserLogger = Trace 49 .getLogger("org.continuent.sequoia.enduser"); 50 51 59 public Controller( 60 org.continuent.sequoia.controller.core.Controller managedController) 61 throws NotCompliantMBeanException 62 { 63 super(ControllerMBean.class); 64 this.controller = managedController; 65 } 66 67 70 public String getAssociatedString() 71 { 72 return "controller"; } 74 75 78 public void addVirtualDatabases(String xml) throws ControllerException 79 { 80 try 81 { 82 endUserLogger.info(Translate.get("controller.add.virtualdatabases")); 83 controller.addVirtualDatabases(xml); 84 endUserLogger.info(Translate.get("controller.virtualdatabases.added")); 85 } 86 catch (ControllerException ex) 87 { 88 endUserLogger.error(ex.getMessage()); 89 throw ex; 90 } 91 } 92 93 96 public List getVirtualDatabaseNames() 97 { 98 return controller.getVirtualDatabaseNames(); 99 } 100 101 104 public void addDriver(byte[] bytes) throws Exception 105 { 106 try 107 { 108 controller.addDriver(bytes); 109 } 110 catch (ControllerException e) 111 { 112 throw e; 113 } 114 } 115 116 119 public String saveConfiguration() throws Exception 120 { 121 String msg = controller.saveConfiguration(); 122 endUserLogger.info(msg); 123 return msg; 124 } 125 126 129 public void shutdown() throws ControllerException 130 { 131 try 132 { 133 endUserLogger.info(Translate.get("controller.shutdown", this 134 .getControllerName())); 135 controller.shutdown(); 136 endUserLogger.info(Translate.get("controller.shutdown.completed", this 137 .getControllerName())); 138 } 139 catch (ControllerException ex) 140 { 141 endUserLogger.error(ex.getMessage()); 142 throw ex; 143 } 144 } 145 146 149 public int getBacklogSize() 150 { 151 return controller.getBacklogSize(); 152 } 153 154 157 public String getControllerName() 158 { 159 return controller.getControllerName(); 160 } 161 162 165 public String getJmxName() 166 { 167 return controller.getJmxName(); 168 } 169 170 173 public int getPortNumber() 174 { 175 return controller.getJdbcPortNumber(); 176 } 177 178 181 public String getVersionNumber() throws RemoteException 182 { 183 return controller.getVersionNumber(); 184 } 185 186 189 public String getXml() 190 { 191 return controller.getXml(); 192 } 193 194 197 public boolean isShuttingDown() 198 { 199 return controller.isShuttingDown(); 200 } 201 202 205 public void setBacklogSize(int size) 206 { 207 controller.setBacklogSize(size); 208 } 209 210 213 public void refreshLogConfiguration() throws ControllerException 214 { 215 try 216 { 217 controller.refreshLogConfiguration(); 218 endUserLogger.info(Translate.get("controller.refresh.log.success")); 219 } 220 catch (ControllerException ex) 221 { 222 endUserLogger.error(ex.getMessage()); 223 throw ex; 224 } 225 } 226 227 230 public void updateLogConfigurationFile(String newConfiguration) 231 throws IOException , ControllerException 232 { 233 try 234 { 235 controller.updateLogConfigurationFile(newConfiguration); 236 endUserLogger.info(Translate.get("controller.update.log.success")); 237 } 238 catch (ControllerException ex) 239 { 240 endUserLogger.error(ex.getMessage()); 241 throw ex; 242 } 243 catch (IOException ioex) 244 { 245 endUserLogger.error(ioex.getMessage()); 246 throw ioex; 247 } 248 } 249 250 253 public String viewLogConfigurationFile() throws IOException 254 { 255 return controller.viewLogConfigurationFile(); 256 } 257 } 258 | Popular Tags |