public ObjectName getObjectNameForProcessor(CamelContext context, Processor processor, ProcessorDefinition<?> definition) throws MalformedObjectNameException { StringBuilder buffer = new StringBuilder(); buffer.append(domainName).append(":"); buffer.append(KEY_CONTEXT + "=").append(getContextId(context)).append(","); buffer.append(KEY_TYPE + "=").append(TYPE_PROCESSOR).append(","); RouteDefinition route = ProcessorDefinitionHelper.getRoute(definition); if (route != null) { buffer.append(KEY_ROUTE + "=").append(route.getId()).append(","); } buffer.append(KEY_NAME + "=").append(ObjectName.quote(definition.getId())); return createObjectName(buffer); }
public String dumpStatsAsXml(String routeId) { Set<RouteDefinition> routes = new HashSet<RouteDefinition>(); for (ProcessorDefinition<?> definition : statistics.keySet()) { RouteDefinition route = ProcessorDefinitionHelper.getRoute(definition); routes.add(route); } StringBuilder sb = new StringBuilder(); sb.append("<profiling>"); for (RouteDefinition route : routes) { if (routeId == null || routeId.equals(route.getId())) { sb.append("<route"); if (route.getId() != null) { sb.append(" id=\"").append(route.getId()).append("\""); } sb.append(">"); appendStats(sb, route); sb.append("</route>"); } } sb.append("</profiling>"); return sb.toString(); }
public String dumpStatsAsXml(String routeId) { Set<RouteDefinition> routes = new HashSet<RouteDefinition>(); for (ProcessorDefinition<?> definition : statistics.keySet()) { RouteDefinition route = ProcessorDefinitionHelper.getRoute(definition); routes.add(route); } StringBuilder sb = new StringBuilder(); sb.append("<profiling>"); for (RouteDefinition route : routes) { if (routeId == null || routeId.equals(route.getId())) { sb.append("<route"); if (route.getId() != null) { sb.append(" id=\"").append(route.getId()).append("\""); } sb.append(">"); appendStats(sb, route); sb.append("</route>"); } } sb.append("</profiling>"); return sb.toString(); }
public Processor wrap(RouteContext routeContext, ProcessorDefinition<?> definition, Processor processor) { if (processor == null) { return null; } // is this the first output from a route, as we want to know this so we can do special logic in first boolean first = false; RouteDefinition route = ProcessorDefinitionHelper.getRoute(definition); if (route != null) { if (routeContext.getCamelContext().getNodeIdFactory() != null) { RouteDefinitionHelper.forceAssignIds(routeContext.getCamelContext(), route); } if (!route.getOutputs().isEmpty()) { first = route.getOutputs().get(0) == definition; } } routeContexts.add(routeContext); processors.add(definition); return new TraceProcessor(queue, processor, definition, route, first, this); }
public Processor wrap(RouteContext routeContext, ProcessorDefinition<?> definition, Processor proc) { if (proc == null) { return null; } RouteDefinition route = ProcessorDefinitionHelper.getRoute(definition); if (route != null) { if (routeContext.getCamelContext().getNodeIdFactory() != null) { RouteDefinitionHelper.forceAssignIds(routeContext.getCamelContext(), route); } } return new ProfilerProcessor(this, proc, getStats(definition), exchanges); }
public Processor wrap(RouteContext routeContext, ProcessorDefinition<?> definition, Processor processor) { if (processor == null) { return null; } // is this the first output from a route, as we want to know this so we can do special logic in first boolean first = false; RouteDefinition route = ProcessorDefinitionHelper.getRoute(definition); if (route != null) { if (routeContext.getCamelContext().getNodeIdFactory() != null) { RouteDefinitionHelper.forceAssignIds(routeContext.getCamelContext(), route); } if (!route.getOutputs().isEmpty()) { first = route.getOutputs().get(0) == definition; } } routeContexts.add(routeContext); processors.add(definition); TraceProcessor traceProcessor = new TraceProcessor(queue, processor, definition, route, first, this); traceProcessor.setCamelContext(routeContext.getCamelContext()); if (processor instanceof CamelContextAware) { ((CamelContextAware) processor).setCamelContext(routeContext.getCamelContext()); } return traceProcessor; }
public Processor wrap(RouteContext routeContext, ProcessorDefinition<?> definition, Processor processor) { if (processor == null) { return null; } if (processor instanceof FilterProcessor) { return processor; } RouteDefinition route = ProcessorDefinitionHelper.getRoute(definition); if (route != null) { if (routeContext.getCamelContext().getNodeIdFactory() != null) { RouteDefinitionHelper.forceAssignIds(routeContext.getCamelContext(), route); } } ProfilerProcessor profilerProcessor = new ProfilerProcessor(this, processor, getStats(definition), exchanges); profilerProcessor.setCamelContext(routeContext.getCamelContext()); if (processor instanceof CamelContextAware) { ((CamelContextAware) processor).setCamelContext(routeContext.getCamelContext()); } return profilerProcessor; }