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"); } }
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; }