@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(); }
} else { // bundle final BundleItem bundle = (BundleItem) cp2Item; elementBuilder.addBundle(bundle.getName(), bundle.getSlot(), bundle.getContentHash()); final BundleItem bundle = (BundleItem) cp2Mod.getItem(); elementBuilder.modifyBundle(bundle.getName(), bundle.getSlot(), cp1Mod.getTargetHash(), bundle.getContentHash());
} else { // bundle final BundleItem bundle = (BundleItem) cp2Item; elementBuilder.addBundle(bundle.getName(), bundle.getSlot(), bundle.getContentHash()); final BundleItem bundle = (BundleItem) cp2Mod.getItem(); elementBuilder.modifyBundle(bundle.getName(), bundle.getSlot(), cp1Mod.getTargetHash(), bundle.getContentHash());