static PatchingTask createBundleTask(final PatchingTaskDescription description) { return new BundlePatchingTask(description); }
@Override byte[] apply(PatchingTaskContext context, PatchContentLoader loader) throws IOException { if (context.getCurrentMode() == PatchingTaskContext.Mode.ROLLBACK) { return getContentItem().getContentHash(); } // Copy the new bundle resources to the patching directory final File targetDir = context.getTargetFile(contentItem); final File sourceDir = loader.getFile(contentItem); final File[] moduleResources = sourceDir.listFiles(); if(! targetDir.mkdirs() && ! targetDir.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(targetDir.getAbsolutePath()); } if(moduleResources == null || moduleResources.length == 0) { return NO_CONTENT; } for(final File file : moduleResources) { final File target = new File(targetDir, file.getName()); IoUtils.copy(file, target); } return contentItem.getContentHash(); }
@Override byte[] apply(PatchingTaskContext context, PatchContentLoader loader) throws IOException { if (context.getCurrentMode() == PatchingTaskContext.Mode.ROLLBACK) { return getContentItem().getContentHash(); } // Copy the new bundle resources to the patching directory final File targetDir = context.getTargetFile(contentItem); final File sourceDir = loader.getFile(contentItem); final File[] moduleResources = sourceDir.listFiles(); if(! targetDir.mkdirs() && ! targetDir.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(targetDir.getAbsolutePath()); } if(moduleResources == null || moduleResources.length == 0) { return NO_CONTENT; } for(final File file : moduleResources) { final File target = new File(targetDir, file.getName()); IoUtils.copy(file, target); } return contentItem.getContentHash(); }
static PatchingTask createBundleTask(final PatchingTaskDescription description) { return new BundlePatchingTask(description); }