public LogAdapter getLog(Class aClazzName) { try { return (LogAdapter) constructor.newInstance(new Object[]{aClazzName}); } catch (Exception e) { throw new EtmException(e); } } }
public void sendStatus(int statusCode, String description) { try { response.sendError(statusCode, description); } catch (IOException e) { throw new EtmException(e); } } }
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(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()); } }
public static Object create(String aClassName, Map properties) { try { return create(Class.forName(aClassName), properties); } catch (ClassNotFoundException e) { 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); } }
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); } }
public void stop() { writer.onFinish(); try { if (rrdDb != null) { rrdDb.close(); } } catch (IOException e) { throw new EtmException(e); } }
private static long extractStep(RrdDb aDb) { try { return aDb.getRrdDef().getStep(); } catch (IOException e) { throw new EtmException(e); } }
private OpenMBeanOperationInfo[] getInactiveMonitorOperation() { try { return new OpenMBeanOperationInfoSupport[]{ new OpenMBeanOperationInfoSupport("enableCollection", "Enables performance monitoring.", null, SimpleType.VOID, MBeanOperationInfo.ACTION), new OpenMBeanOperationInfoSupport("reset", "Resets current performance data.", null, SimpleType.VOID, MBeanOperationInfo.ACTION), new OpenMBeanOperationInfoSupport("renderResultsAsText", "Renders aggregated performance statistics in text format", null, SimpleType.STRING, MBeanOperationInfo.ACTION), new OpenMBeanOperationInfoSupport("results", "Current top level performance results.", null, tabularType, MBeanOperationInfo.INFO) }; } catch (Exception e) { // this should be save throw new EtmException(e.getMessage()); } }
private OpenMBeanAttributeInfo[] getAttributeInfos() { try { return new OpenMBeanAttributeInfoSupport[]{ new OpenMBeanAttributeInfoSupport("started", "Whether the monitor is started or not.", SimpleType.BOOLEAN, true, false, true), new OpenMBeanAttributeInfoSupport("collecting", "Whether the monitor is collecting or not.", SimpleType.BOOLEAN, true, false, true), new OpenMBeanAttributeInfoSupport("startDate", "The date the application was started.", SimpleType.DATE, true, false, false), new OpenMBeanAttributeInfoSupport("lastResetDate", "The date the monitor was resetted.", SimpleType.DATE, true, false, false) }; } catch (Exception e) { // this should be save throw new EtmException(e.getMessage()); } }
private OpenMBeanOperationInfo[] getActiveMonitorOperation() { try { return new OpenMBeanOperationInfoSupport[]{ new OpenMBeanOperationInfoSupport("disableCollection", "Disables performance monitoring.", null, SimpleType.VOID, MBeanOperationInfo.ACTION), new OpenMBeanOperationInfoSupport("reset", "Resets current performance data.", null, SimpleType.VOID, MBeanOperationInfo.ACTION), new OpenMBeanOperationInfoSupport("renderResultsAsText", "Renders aggregated performance statistics in text format", null, SimpleType.STRING, MBeanOperationInfo.ACTION), new OpenMBeanOperationInfoSupport("results", "Current top level performance results.", null, tabularType, MBeanOperationInfo.INFO) }; } catch (Exception e) { // this should be save throw new EtmException(e.getMessage()); } }
private OpenMBeanAttributeInfo[] getAttributeInfos() { try { return new OpenMBeanAttributeInfoSupport[]{ new OpenMBeanAttributeInfoSupport("started", "Whether the monitor is started or not.", SimpleType.BOOLEAN, true, false, true), new OpenMBeanAttributeInfoSupport("collecting", "Whether the monitor is collecting or not.", SimpleType.BOOLEAN, true, false, true), new OpenMBeanAttributeInfoSupport("startDate", "The date the application was started.", SimpleType.DATE, true, false, false), new OpenMBeanAttributeInfoSupport("lastResetDate", "The date the monitor was resetted.", SimpleType.DATE, true, false, false) }; } catch (Exception e) { // this should be save throw new EtmException(e.getMessage()); } }
protected void doValidateChain() { AggregatorMetaData metaData = ctx.getEtmMonitor().getMetaData().getAggregatorMetaData(); while (metaData != null) { if (metaData.getImplementationClass().isAssignableFrom(NotifyingAggregator.class)) { return; } metaData = metaData.getNestedMetaData(); } throw new EtmException("Missing NotifyingAggregator. There has to be a " + "NotifyingAggregator in your aggregation chain. Rrd support disabled."); }