@Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append(BundleItem.class.getSimpleName()).append("{"); builder.append(getName()).append(":").append(getSlot()).append("}"); return builder.toString(); } }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append(BundleItem.class.getSimpleName()).append("{"); builder.append(getName()).append(":").append(getSlot()).append("}"); return builder.toString(); } }
File getBundlePath(final BundleItem item) { return getModulePath(bundlesRoot, item.getName(), item.getSlot()); } }
File getBundlePath(final BundleItem item) { return getModulePath(bundlesRoot, item.getName(), item.getSlot()); } }
@Override byte[] backup(PatchingTaskContext context) throws IOException { // Check the bundle dir hash final File[] repoRoots = context.getTargetBundlePath(); final String bundleName = contentItem.getName(); final String slot = contentItem.getSlot(); for(final File path : repoRoots) { // Check the bundle path final File bundlePath = PatchContentLoader.getModulePath(path, bundleName, slot); if(bundlePath.exists()) { PatchLogger.ROOT_LOGGER.debugf("found in path (%s)", bundlePath.getAbsolutePath()); // Bundles don't contain a modules.xml final File[] children = bundlePath.listFiles(); if(children == null || children.length == 0) { return NO_CONTENT; } context.invalidateRoot(bundlePath); return HashUtils.hashFile(bundlePath); } } return NO_CONTENT; }
@Override byte[] backup(PatchingTaskContext context) throws IOException { // Check the bundle dir hash final File[] repoRoots = context.getTargetBundlePath(); final String bundleName = contentItem.getName(); final String slot = contentItem.getSlot(); for(final File path : repoRoots) { // Check the bundle path final File bundlePath = PatchContentLoader.getModulePath(path, bundleName, slot); if(bundlePath.exists()) { PatchLogger.ROOT_LOGGER.debugf("found in path (%s)", bundlePath.getAbsolutePath()); // Bundles don't contain a modules.xml final File[] children = bundlePath.listFiles(); if(children == null || children.length == 0) { return NO_CONTENT; } context.invalidateRoot(bundlePath); return HashUtils.hashFile(bundlePath); } } return NO_CONTENT; }
modSrcDir = new File(modSrcDir, Constants.BUNDLES); modTrgDir = new File(modTrgDir, Constants.BUNDLES); slot = ((BundleItem)mod.getItem()).getSlot(); } else { throw new PatchingException("Unexpected content type " + contentType);
modSrcDir = new File(modSrcDir, Constants.BUNDLES); modTrgDir = new File(modTrgDir, Constants.BUNDLES); slot = ((BundleItem)mod.getItem()).getSlot(); } else { throw new PatchingException("Unexpected content type " + contentType);
@Override ContentModification createRollbackEntry(ContentModification original, byte[] targetHash, byte[] itemHash) { final BundleItem item = new BundleItem(contentItem.getName(), contentItem.getSlot(), itemHash); switch (original.getType()) { case ADD: return new ContentModification(item, targetHash, ModificationType.REMOVE, original.getCondition()); case REMOVE: return new ContentModification(item, targetHash, ModificationType.ADD, original.getCondition()); default: return new ContentModification(item, targetHash, ModificationType.MODIFY, original.getCondition()); } }
@Override ContentModification createRollbackEntry(ContentModification original, byte[] targetHash, byte[] itemHash) { final BundleItem item = new BundleItem(contentItem.getName(), contentItem.getSlot(), itemHash); switch (original.getType()) { case ADD: return new ContentModification(item, targetHash, ModificationType.REMOVE, original.getCondition()); case REMOVE: return new ContentModification(item, targetHash, ModificationType.ADD, original.getCondition()); default: return new ContentModification(item, targetHash, ModificationType.MODIFY, original.getCondition()); } }
} else { // bundle final BundleItem bundle = (BundleItem) cp2Item; elementBuilder.addBundle(bundle.getName(), bundle.getSlot(), bundle.getContentHash()); } else { // bundle final BundleItem bundle = (BundleItem) cp2Mod.getItem(); elementBuilder.removeBundle(bundle.getName(), bundle.getSlot(), cp1Mod.getTargetHash()); } else { // bundle 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()); } else { // bundle final BundleItem bundle = (BundleItem) cp2Mod.getItem(); elementBuilder.removeBundle(bundle.getName(), bundle.getSlot(), cp1Mod.getTargetHash()); } else { // bundle final BundleItem bundle = (BundleItem) cp2Mod.getItem(); elementBuilder.modifyBundle(bundle.getName(), bundle.getSlot(), cp1Mod.getTargetHash(), bundle.getContentHash());