@Override public <T> T invoke(String description, Invokable<T> operation) { return operationTracker.invoke(description, operation); }
@Override public void advise(MethodInvocation invocation) { tracker.run(description, toRunnable(invocation)); } }
@Override public <T> T perform(String description, IOOperation<T> operation) throws IOException { return operationTracker.perform(description, operation); }
@Override public <T> T invoke(String description, Invokable<T> operation) { return operationTracker.invoke(description, operation); }
@Override public void run(String description, Runnable operation) { operationTracker.run(description, operation); }
@Override public <T> T perform(String description, IOOperation<T> operation) throws IOException { return operationTracker.perform(description, operation); }
public <T> T invoke(String description, Invokable<T> operation) { return tracker.invoke(description, operation); }
@Override public void advise(MethodInvocation invocation) { tracker.run(description, toRunnable(invocation)); } }
public <T> T perform(String description, IOOperation<T> operation) throws IOException { return tracker.perform(description, operation); }
@Override public Object createObject() { Invokable<Object> operation = new Invokable<Object>() { @Override public Object invoke() { return delegate.createObject(); } }; return tracker.invoke(message, operation); } }
@Override public void run(String description, Runnable operation) { operationTracker.run(description, operation); }
private StreamableResource filter(final StreamableResource base, final Resource baseResource) throws IOException { return tracker.perform("Rewriting relative URLs in " + baseResource, new IOOperation<StreamableResource>() { public StreamableResource perform() throws IOException { String baseString = readAsString(base); String filtered = replaceURLs(baseString, baseResource); if (filtered == null) { // No URLs were replaced so no need to create a new StreamableResource return base; } BytestreamCache cache = new BytestreamCache(filtered.getBytes("UTF-8")); return new StreamableResourceImpl(base.getDescription(), CSS_CONTENT_TYPE, CompressionStatus.COMPRESSABLE, base.getLastModified(), cache, checksumGenerator, base.getResponseCustomizer()); } }); }
@Override public Object createObject() { Invokable<Object> operation = new Invokable<Object>() { @Override public Object invoke() { return delegate.createObject(); } }; return tracker.invoke(message, operation); } }
public void run(String description, Runnable operation) { tracker.run(description, operation); }
public boolean handleAssetRequest(Request request, Response response, final String extraPath) throws IOException { return tracker.perform(String.format("Streaming JavaScript asset stack %s", extraPath), new IOOperation<Boolean>() { public Boolean perform() throws IOException { return streamStackResource(extraPath); } }); }
public static <T> ObjectCreator<T> createMethodInvocationPlan(final OperationTracker tracker, final ObjectLocator locator, final InjectionResources resources, final Logger logger, final String description, final Object instance, final Method method) { return tracker.invoke("Creating plan to invoke " + method, new Invokable<ObjectCreator<T>>() { @Override public ObjectCreator<T> invoke() { ObjectCreator[] methodParameters = calculateParametersForMethod(method, locator, resources, tracker); Invokable<T> core = new MethodInvoker<T>(instance, method, methodParameters); Invokable<T> wrapped = logger == null ? core : new LoggingInvokableWrapper<T>(logger, description, core); return new ConstructionPlan(tracker, description, wrapped); } }); }
private static void extendPlanForPostInjectionMethod(final ConstructionPlan<?> plan, final OperationTracker tracker, final ObjectLocator locator, final InjectionResources resources, final Method method) tracker.run("Computing parameters for post-injection method " + method, new Runnable()
@Override public InputStream transform(final Resource source, final ResourceDependencies dependencies) throws IOException { final String description = String.format("Compiling %s from %s to %s", source, sourceName, targetName); return tracker.perform(description, new IOOperation<InputStream>() { @Override public InputStream perform() throws IOException { return delegate.transform(source, dependencies); } }); } };
private ComponentAssembler createAssembler(final String className, final ComponentResourceSelector selector) { return tracker.invoke("Creating ComponentAssembler for " + className, new Invokable<ComponentAssembler>() { public ComponentAssembler invoke() { Instantiator instantiator = instantiatorSource.getInstantiator(className); ComponentModel componentModel = instantiator.getModel(); ComponentTemplate template = templateSource.getTemplate(componentModel, selector); ComponentPageElementResources resources = resourcesSource.get(selector); ComponentAssembler assembler = new ComponentAssemblerImpl(PageLoaderImpl.this, instantiatorSource, componentClassResolver, instantiator, resources, tracker, template.usesStrictMixinParameters()); // "Program" the assembler by adding actions to it. The actions interact with a // PageAssembly object (a fresh one for each new page being created). programAssembler(assembler, template); return assembler; } }); }
private static void extendPlanForPostInjectionMethod(final ConstructionPlan<?> plan, final OperationTracker tracker, final ObjectLocator locator, final InjectionResources resources, final Method method) tracker.run("Computing parameters for post-injection method " + method, new Runnable()