public LogAdapter getLog(Class aClazzName) { try { return (LogAdapter) constructor.newInstance(new Object[]{aClazzName}); } catch (Exception e) { throw new EtmException(e); } } }
public EtmException(Throwable aT) { // todo implement late serialize at toString() or serialization super(parseNested(aT)); }
public void sendStatus(int statusCode, String description) { try { response.sendError(statusCode, description); } catch (IOException e) { throw new EtmException(e); } } }
public EtmException(Throwable aT) { // todo implement late serialize at toString() or serialization super(parseNested(aT)); }
public LogAdapter getLog(Class aClazzName) { try { return (LogAdapter) constructor.newInstance(new Object[]{aClazzName}); } catch (Exception e) { throw new EtmException(e); } } }
public void setFormatterClass(Class aFormatterClazz) { try { formatter = (LogOutputFormatter) aFormatterClazz.newInstance(); } catch (Exception e) { throw new EtmException(e); } }
public static void register(String reference, EtmMonitor aMonitor) { if (!managedMonitors.containsKey(reference)) { managedMonitors.put(reference, aMonitor); } else { throw new EtmException("Reference " + reference + " already assigned. Ensure that the same jetm-config file is not " + "reused accross multiple EtmMonitor instances."); } }
public static Object create(Class aClazz, Map properties) { try { Object obj = aClazz.newInstance(); if (properties != null) { setProperties(obj, properties); } return obj; } catch (InstantiationException e) { throw new EtmException(e.getMessage()); } catch (IllegalAccessException e) { throw new EtmException(e.getMessage()); } }
public static Object create(Class aClazz, Map properties) { try { Object obj = aClazz.newInstance(); if (properties != null) { setProperties(obj, properties); } return obj; } catch (InstantiationException e) { throw new EtmException(e.getMessage()); } catch (IllegalAccessException e) { throw new EtmException(e.getMessage()); } }
public static Object create(String aClassName, Map properties) { try { return create(Class.forName(aClassName), properties); } catch (ClassNotFoundException e) { throw new EtmException(e.getMessage()); } }
private OpenMBeanOperationInfo[] getOperations() { try { return new OpenMBeanOperationInfo[]{ new OpenMBeanOperationInfoSupport("reset", "Resets etm point.", null, SimpleType.VOID, MBeanOperationInfo.ACTION) }; } catch (Exception e) { // this should be save throw new EtmException(e.getMessage()); } }
protected boolean validateDataSource(RrdDb aDb, String name) { try { return aDb.getDatasource(name) != null; } catch (IOException e) { throw new EtmException(e); } }
public static Object create(String aClassName, Map properties) { try { return create(Class.forName(aClassName), properties); } catch (ClassNotFoundException e) { throw new EtmException(e.getMessage()); } }
private static long extractLastTimestamp(RrdDb aDb) { try { return aDb.getLastUpdateTime(); } catch (IOException e) { throw new EtmException(e); } }
private OpenMBeanOperationInfo[] getOperations() { try { return new OpenMBeanOperationInfo[]{ new OpenMBeanOperationInfoSupport("reset", "Resets etm point.", null, SimpleType.VOID, MBeanOperationInfo.ACTION) }; } catch (Exception e) { // this should be save throw new EtmException(e.getMessage()); } }
public void sendRedirect(String target, Map parameters) { try { response.sendRedirect(ConsoleUtil.appendParameters(target, parameters)); } catch (IOException e) { throw new EtmException(e); } }
/** * * Enables performance monitoring using [@link etm.core.configuration.XmlEtmConfigurator}. * * @param url The url to the xml file in the classpath. May be a file URL too. */ public void enableXmlConfigByUrl(String url) { try { enable(new URL(url)); } catch (MalformedURLException e) { throw new EtmException(e); } }
/** * * Enables performance monitoring using [@link etm.core.configuration.XmlEtmConfigurator}. * * @param classpathResource The name of the xml file in the classpath. */ public void enableXmlConfigByClasspathResource(String classpathResource) { URL resource = Thread.currentThread().getContextClassLoader().getResource(classpathResource); if (resource != null) { enable(resource); } else { throw new EtmException("Unable to locate default resource " + classpathResource + " in classpath."); } }
constructor = adapterClazz.getConstructor(new Class[]{Class.class}); } catch (NoSuchMethodException e) { throw new EtmException(e);
/** * Locates a given template and returns a URL to the template. Translates pre defined * templates to their url within the classpat. * * @param aTemplate A template name, might be predefined template, a classpath resource or file. * @return The URL to the resource * @throws EtmException Thrown to indicate that the given template could not be found. */ public URL locateTemplate(String aTemplate) { if (templates.containsKey(aTemplate)) { aTemplate = (String) templates.get(aTemplate); LOG.debug("Using template " + aTemplate + " from classpath."); } ClassLoader loader = EtmMonitor.class.getClassLoader(); URL resource = loader.getResource(aTemplate); if (resource != null) { return resource; } File file = new File(aTemplate); if (file.exists()) { try { return file.toURL(); } catch (MalformedURLException e) { throw new EtmException(e); } } throw new EtmException("Unable to locate template " + aTemplate + " in ClassPath or Filesystem."); }