/** * Process and compare all the files from the sourceFolder and compare them with the files from the targetFolder. */ public static void compareFromDifferentFolders(final File sourceFolder, final File targetFolder, final ResourcePreProcessor processor) throws IOException { compareFromDifferentFolders(sourceFolder, targetFolder, TrueFileFilter.TRUE, Transformers.noOpTransformer(), processor); }
/** * Computes absolute url of the imported resource. * * @param relativeResourceUri uri of the resource containing the import statement. * @param importUrl found import url. * @return absolute url of the resource to import. */ private String computeAbsoluteUrl(final String relativeResourceUri, final String importUrl) { final String folder = WroUtil.getFullPath(relativeResourceUri); // remove '../' & normalize the path. return StringUtils.cleanPath(folder + importUrl); }
@Override protected T initialize() { return decorator.getDecoratedObject().initialize(); }
/** * {@inheritDoc} */ public void destroy() { managerInitializer.destroy(); } }
/** * Creates default singleton instance of manager, by initializing manager dependencies with default values * (processors). */ public final WroManager create() { return managerInitializer.get(); }
/** * @return a generated {@link File} with unique name located in temp folder. */ public static File createTempFile() { return createTempFile("temp"); }
/** * The returned object will be injected (if injector is available) and will be cached, meaning that only the first * invocation of this method will instantiate a fresh strategy and any subsequent invocation will return the same * object. * * @return the strategy S whose alias is found configured in the properties. This method will never return null. If no * alias is defined the default strategy will be returned. If an invalid alias is provided - a runtime * exception will be thrown. */ public final S getConfiguredStrategy() { return lazyInitializer.get(); }
/** * @return the object which is was originally decorated and is not a decorator itself. */ public final T getOriginalDecoratedObject() { return getOriginalDecoratedObject(decorated); }
private static void compareFromDifferentFolders(final File sourceFolder, final File targetFolder, final IOFileFilter fileFilter, final Transformer<String> toTargetFileName, final ResourcePostProcessor processor) throws IOException { // TODO use ProcessorsUtils compareFromDifferentFolders(sourceFolder, targetFolder, fileFilter, toTargetFileName, new ResourcePreProcessor() { public void process(final Resource resource, final Reader reader, final Writer writer) throws IOException { processor.process(reader, writer); } }); }
@Override public String getServletPath() { return WroUtil.getServletPathFromLocation(this, location); } };
/** * Return a short description of the total running time. */ public String shortSummary() { return "StopWatch '" + this.id + "': running time (millis) = " + getTotalTimeMillis(); }
/** * Run the task concurrently 50 times. */ public static void runConcurrently(final Callable<Void> task) throws Exception { runConcurrently(task, 50); }
@Override protected ScheduledThreadPoolExecutor initialize() { return new ScheduledThreadPoolExecutor(1, WroUtil.createDaemonThreadFactory(SchedulerHelper.this.name)) { @Override public boolean getExecuteExistingDelayedTasksAfterShutdownPolicy() { return false; }; }; } };
/** * Schedules with provided period using {@link TimeUnit#SECONDS} as a default time unit. * * @param period * new period for scheduling. */ public SchedulerHelper scheduleWithPeriod(final long period) { scheduleWithPeriod(period, TimeUnit.SECONDS); return this; }
/** * Stops all jobs runned by the scheduler. It is important to call this method before application stops. */ public void destroy() { destroyScheduler(); }
/** * @return the object which is was originally decorated and is not a decorator itself. */ @SuppressWarnings("unchecked") public static <T> T getOriginalDecoratedObject(final T object) { return (object instanceof ObjectDecorator) ? ((ObjectDecorator<T>) object).getOriginalDecoratedObject() : object; }
/** * Computes absolute url of the imported resource. * * @param relativeResourceUri uri of the resource containing the import statement. * @param importUrl found import url. * @return absolute url of the resource to import. */ private String computeAbsoluteUrl(final String relativeResourceUri, final String importUrl) { final String folder = WroUtil.getFullPath(relativeResourceUri); // remove '../' & normalize the path. final String absoluteImportUrl = StringUtils.cleanPath(folder + importUrl); return absoluteImportUrl; }
/** * Process and compare all the files from the sourceFolder and compare them with the files from the targetFolder. */ public static void compareFromDifferentFolders(final File sourceFolder, final File targetFolder, final ResourcePreProcessor processor) throws IOException { compareFromDifferentFolders(sourceFolder, targetFolder, TrueFileFilter.TRUE, Transformers.noOpTransformer(), processor); }
@Override protected T initialize() { return decorator.getDecoratedObject().initialize(); }
public void destroy() throws Exception { executorServiceRef.destroy(); } }