@Override public String getRelativePath() { return getName() + ":" + slot; }
@Override public String getRelativePath() { return getName() + ":" + slot; }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append(ModuleItem.class.getSimpleName()).append("{"); builder.append(getName()).append(":").append(slot).append("}"); return builder.toString(); } }
public static byte[] getAbsentModuleContent(final ModuleItem item) { final StringBuilder builder = new StringBuilder(128); builder.append("<?xml version='1.0' encoding='UTF-8'?>\n<module-absent xmlns=\"urn:jboss:module:1.2\""); builder.append(" name=\"").append(item.getName()).append("\""); builder.append(" slot=\"").append(item.getSlot()).append("\""); builder.append(" />\n"); return builder.toString().getBytes(StandardCharsets.UTF_8); }
@Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append(ModuleItem.class.getSimpleName()).append("{"); builder.append(getName()).append(":").append(slot).append("}"); return builder.toString(); } }
public static byte[] getAbsentModuleContent(final ModuleItem item) { final StringBuilder builder = new StringBuilder(128); builder.append("<?xml version='1.0' encoding='UTF-8'?>\n<module-absent xmlns=\"urn:jboss:module:1.2\""); builder.append(" name=\"").append(item.getName()).append("\""); builder.append(" slot=\"").append(item.getSlot()).append("\""); builder.append(" />\n"); return builder.toString().getBytes(StandardCharsets.UTF_8); }
public static File getModulePath(File root, ModuleItem item) { return getModulePath(root, item.getName(), item.getSlot()); }
void disableBaseModule(final ModuleItem item) throws IOException { if(modulesToDisable.isEmpty()) { modulesToDisable = new ArrayList<File>(); } final File modulePath = PatchContentLoader.getModulePath(getDirectoryStructure().getModuleRoot(), item.getName(), ((ModuleItem)item).getSlot()); final List<File> files = listFiles(modulePath); if (files != null && files.size() > 0) { for (final File file : files) { modulesToDisable.add(file); } } }
public static File getModulePath(File root, ModuleItem item) { return getModulePath(root, item.getName(), item.getSlot()); }
void disableBaseModule(final ModuleItem item) throws IOException { if(modulesToDisable.isEmpty()) { modulesToDisable = new ArrayList<File>(); } final File modulePath = PatchContentLoader.getModulePath(getDirectoryStructure().getModuleRoot(), item.getName(), ((ModuleItem)item).getSlot()); final List<File> files = listFiles(modulePath); if (files != null && files.size() > 0) { for (final File file : files) { modulesToDisable.add(file); } } }
static ModuleItem createContentItem(final ModuleItem original, final byte[] contentHash) { final ContentType type = original.getContentType(); if(type == ContentType.BUNDLE) { return new BundleItem(original.getName(), original.getSlot(), contentHash); } else { return new ModuleItem(original.getName(), original.getSlot(), contentHash); } }
void reenableBaseModule(final ModuleItem item) throws IOException { if(modulesToReenable.isEmpty()) { modulesToReenable = new ArrayList<File>(); } final File modulePath = PatchContentLoader.getModulePath(getDirectoryStructure().getModuleRoot(), item.getName(), ((ModuleItem)item).getSlot()); final List<File> files = listFiles(modulePath); if (files != null && files.size() > 0) { for (final File file : files) { modulesToReenable.add(file); } } }
void reenableBaseModule(final ModuleItem item) throws IOException { if(modulesToReenable.isEmpty()) { modulesToReenable = new ArrayList<File>(); } final File modulePath = PatchContentLoader.getModulePath(getDirectoryStructure().getModuleRoot(), item.getName(), ((ModuleItem)item).getSlot()); final List<File> files = listFiles(modulePath); if (files != null && files.size() > 0) { for (final File file : files) { modulesToReenable.add(file); } } }
static ModuleItem createContentItem(final ModuleItem original, final byte[] contentHash) { final ContentType type = original.getContentType(); if(type == ContentType.BUNDLE) { return new BundleItem(original.getName(), original.getSlot(), contentHash); } else { return new ModuleItem(original.getName(), original.getSlot(), contentHash); } }
@Override byte[] backup(PatchingTaskContext context) throws IOException { final File[] repoRoots = context.getTargetModulePath(); final String moduleName = contentItem.getName(); final String slot = contentItem.getSlot(); for(final File path : repoRoots) { // Find the first module and calculate the hash final File modulePath = PatchContentLoader.getModulePath(path, moduleName, slot); final File moduleXml = new File(modulePath, MODULE_XML); if(moduleXml.exists()) { PatchLogger.ROOT_LOGGER.debugf("found in path (%s)", moduleXml.getAbsolutePath()); context.invalidateRoot(modulePath); return HashUtils.hashFile(modulePath); } } return notFound(contentItem); }
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(); } }
@Override protected ContentModification getOriginalModification(byte[] targetHash, byte[] itemHash) { final ModuleItem original = getContentItem(); final ModuleItem item = new ModuleItem(original.getName(), original.getSlot(), targetHash); return new ContentModification(item, description.getModification().getTargetHash(), ModificationType.MODIFY, description.getModification().getCondition()); }
@Override protected ContentModification getOriginalModification(byte[] targetHash, byte[] itemHash) { final ModuleItem original = getContentItem(); final ModuleItem item = new ModuleItem(original.getName(), original.getSlot(), targetHash); return new ContentModification(item, description.getModification().getTargetHash(), ModificationType.MODIFY, description.getModification().getCondition()); }