/** * Get the relative path. * * @return the relative path */ public String getRelativePath() { final StringBuilder builder = new StringBuilder(); for(final String p : path) { builder.append(p).append("/"); } builder.append(getName()); return builder.toString(); }
/** * Get the relative path. * * @return the relative path */ public String getRelativePath() { final StringBuilder builder = new StringBuilder(); for(final String p : path) { builder.append(p).append("/"); } builder.append(getName()); return builder.toString(); }
public static File getMiscPath(final File miscRoot, final MiscContentItem item) { if (miscRoot == null) { throw new IllegalStateException(); } File file = miscRoot; for (final String path : item.getPath()) { file = new File(file, path); } file = new File(file, item.getName()); return file; }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append(MiscContentItem.class.getSimpleName()).append("{"); for(final String path : getPath()) { builder.append(path).append("/"); } builder.append(getName()).append("}"); return builder.toString(); }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append(MiscContentItem.class.getSimpleName()).append("{"); for(final String path : getPath()) { builder.append(path).append("/"); } builder.append(getName()).append("}"); return builder.toString(); }
public static File getMiscPath(final File miscRoot, final MiscContentItem item) { if (miscRoot == null) { throw new IllegalStateException(); } File file = miscRoot; for (final String path : item.getPath()) { file = new File(file, path); } file = new File(file, item.getName()); return file; }
@Override ContentModification createRollbackEntry(ContentModification original, byte[] targetHash, byte[] itemHash) { final MiscContentItem item = new MiscContentItem(contentItem.getName(), contentItem.getPath(), itemHash, contentItem.isDirectory(), contentItem.isAffectsRuntime()); return createRollbackEntry(original, item, targetHash); }
@Override ContentModification createRollbackEntry(ContentModification original, byte[] targetHash, byte[] itemHash) { final MiscContentItem item = new MiscContentItem(contentItem.getName(), contentItem.getPath(), itemHash, contentItem.isDirectory(), contentItem.isAffectsRuntime()); return createRollbackEntry(original, item, targetHash); }
static int hashCode(final ContentItem item) { final ContentType type = item.getContentType(); switch (type) { case MODULE: case BUNDLE: final ModuleItem module = (ModuleItem) item; final String[] path = module.getName().split("\\."); return hashCode(type.toString(), module.getSlot(), path); case MISC: final MiscContentItem misc = (MiscContentItem) item; return hashCode(type.toString(), misc.getName(), misc.getPath()); default: throw new IllegalStateException(); } }
static int hashCode(final ContentItem item) { final ContentType type = item.getContentType(); switch (type) { case MODULE: case BUNDLE: final ModuleItem module = (ModuleItem) item; final String[] path = module.getName().split("\\."); return hashCode(type.toString(), module.getSlot(), path); case MISC: final MiscContentItem misc = (MiscContentItem) item; return hashCode(type.toString(), misc.getName(), misc.getPath()); default: throw new IllegalStateException(); } }
path.append(p).append(PATH_DELIMITER); path.append(item.getName());
path.append(p).append(PATH_DELIMITER); path.append(item.getName());
elementBuilder.addFile(misc.getName(), Arrays.asList(misc.getPath()), misc.getContentHash(), misc.isDirectory()); } else { // bundle } else if (cp1Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Mod.getItem(); elementBuilder.removeFile(misc.getName(), Arrays.asList(misc.getPath()), cp1Mod.getTargetHash(), misc.isDirectory()); } else { // bundle } else if (cp1Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Mod.getItem(); elementBuilder.modifyFile(misc.getName(), Arrays.asList(misc.getPath()), cp1Mod.getTargetHash(), misc.getContentHash(), misc.isDirectory()); } else { // bundle
elementBuilder.addFile(misc.getName(), Arrays.asList(misc.getPath()), misc.getContentHash(), misc.isDirectory()); } else { // bundle } else if (cp1Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Mod.getItem(); elementBuilder.removeFile(misc.getName(), Arrays.asList(misc.getPath()), cp1Mod.getTargetHash(), misc.isDirectory()); } else { // bundle } else if (cp1Item.getContentType().equals(ContentType.MISC)) { final MiscContentItem misc = (MiscContentItem) cp2Mod.getItem(); elementBuilder.modifyFile(misc.getName(), Arrays.asList(misc.getPath()), cp1Mod.getTargetHash(), misc.getContentHash(), misc.isDirectory()); } else { // bundle