Exemplo n.º 1
0
 private static void validateInstrument(final Extension.Instrumentation instrument)
     throws XmlException {
   if (instrument == null) {
     throw new XmlException(
         "In order to provide instrumentation, there must be an instrument tag.\n");
   }
   final List<Extension.Instrumentation.Pointcut> pcs = instrument.getPointcut();
   if (pcs == null || pcs.isEmpty()) {
     throw new XmlException("A point cut tag is required to instrument a method.\n");
   }
 }
Exemplo n.º 2
0
 private static String createDefaultMetricPrefix(
     final Extension.Instrumentation instrument, final boolean custom) {
   String metricPrefix = custom ? "Custom" : "Java";
   if (instrument != null) {
     final String prefix = instrument.getMetricPrefix();
     if (prefix != null && prefix.length() != 0) {
       metricPrefix = prefix;
     }
   }
   return metricPrefix;
 }
Exemplo n.º 3
0
 public static List<ExtensionClassAndMethodMatcher> convertToPointCutsForValidation(
     final Extension ext) throws XmlException {
   final List<ExtensionClassAndMethodMatcher> pointCutsOut =
       new ArrayList<ExtensionClassAndMethodMatcher>();
   final Extension.Instrumentation inst = ext.getInstrumentation();
   validateExtensionAttributes(ext);
   validateInstrument(inst);
   final List<Extension.Instrumentation.Pointcut> pcs = inst.getPointcut();
   final String defaultMetricPrefix = createDefaultMetricPrefix(inst, true);
   final Map<String, MethodMapper> classesToMethods = new HashMap<String, MethodMapper>();
   for (final Extension.Instrumentation.Pointcut pc : pcs) {
     pointCutsOut.add(
         createPointCut(
             ext,
             pc,
             defaultMetricPrefix,
             ext.getName(),
             classesToMethods,
             true,
             InstrumentationType.LocalCustomXml,
             false));
   }
   return pointCutsOut;
 }