@Override public DirectoryStructure getDirectoryStructure() { return identity.getDirectoryStructure(); } }, Collections.<String>emptyList(), structure == null ? null : structure.getInstalledImage());
@Override public TargetInfo loadTargetInfo() throws IOException { return identity.loadTargetInfo(); }
@Override public String getName() { return identity.getName(); }
public static File[] getModuleRoot(final PatchableTarget target) { try { return PatchUtils.getModulePath(target.getDirectoryStructure(), target.loadTargetInfo()); } catch (IOException e) { throw new RuntimeException(e); } }
static void writeTargetInfo(final XMLExtendedStreamWriter writer, final Element element, final PatchableTarget target) throws XMLStreamException { try { final PatchableTarget.TargetInfo info = target.loadTargetInfo(); // writer.writeEmptyElement(element.name); writer.writeAttribute(Attribute.NAME.name, target.getName()); writer.writeAttribute(Attribute.RELEASE_ID.name, info.getCumulativePatchID()); if (! info.getPatchIDs().isEmpty()) { writer.writeAttribute(Attribute.PATCHES.name, PatchUtils.asString(info.getPatchIDs())); } } catch (IOException e) { throw new XMLStreamException(e); } }
static void writeTargetInfo(final XMLExtendedStreamWriter writer, final Element element, final PatchableTarget target) throws XMLStreamException { try { final PatchableTarget.TargetInfo info = target.loadTargetInfo(); // writer.writeEmptyElement(element.name); writer.writeAttribute(Attribute.NAME.name, target.getName()); writer.writeAttribute(Attribute.RELEASE_ID.name, info.getCumulativePatchID()); if (! info.getPatchIDs().isEmpty()) { writer.writeAttribute(Attribute.PATCHES.name, PatchUtils.asString(info.getPatchIDs())); } } catch (IOException e) { throw new XMLStreamException(e); } }
@Override public DirectoryStructure getDirectoryStructure() { return identity.getDirectoryStructure(); } }, Collections.<String>emptyList(), structure == null ? null : structure.getInstalledImage());
@Override public TargetInfo loadTargetInfo() throws IOException { return identity.loadTargetInfo(); }
@Override public String getName() { return identity.getName(); }
public DirectoryStructure getStructure() { return target.getDirectoryStructure(); }
protected void putPatchableTarget(final String name, final PatchableTarget target, Map<String, MutableTargetImpl> map) throws IOException { final PatchableTarget.TargetInfo info = target.loadTargetInfo(); map.put(name, new MutableTargetImpl(info)); }
@Override public Set<String> children() { final InstallationManager manager = getInstallationManager(); if (manager == null) { return Collections.emptySet(); } final Collection<? extends PatchableTarget> targets = getChildTargets(manager.getDefaultIdentity()); if (targets.isEmpty()) { return Collections.emptySet(); } if (targets.size() == 1) { final PatchableTarget target = targets.iterator().next(); return Collections.singleton(target.getName()); } final Set<String> names = new HashSet<String>(targets.size()); for (PatchableTarget target : targets) { names.add(target.getName()); } return names; } }
public DirectoryStructure getStructure() { return target.getDirectoryStructure(); }
protected void putPatchableTarget(final String name, final PatchableTarget target, Map<String, MutableTargetImpl> map) throws IOException { final PatchableTarget.TargetInfo info = target.loadTargetInfo(); map.put(name, new MutableTargetImpl(info)); }
@Override public Set<String> children() { final InstallationManager manager = getInstallationManager(); if (manager == null) { return Collections.emptySet(); } final Collection<? extends PatchableTarget> targets = getChildTargets(manager.getDefaultIdentity()); if (targets.isEmpty()) { return Collections.emptySet(); } if (targets.size() == 1) { final PatchableTarget target = targets.iterator().next(); return Collections.singleton(target.getName()); } final Set<String> names = new HashSet<String>(targets.size()); for (PatchableTarget target : targets) { names.add(target.getName()); } return names; } }
private static boolean isAgedOut(InstalledIdentity installedIdentity, final Patch metadata) { for (PatchElement pe : metadata.getElements()) { final PatchElementProvider peProvider = pe.getProvider(); final PatchableTarget layer = peProvider.isAddOn() ? installedIdentity.getAddOn(peProvider.getName()) : installedIdentity.getLayer(peProvider.getName()); if (layer == null) { // if an identity is missing a layer that means either it was re-configured and the layer // was removed // or the layer in the patch is optional and may be missing on the disk // we haven't had this case yet, not sure how critical this is to terminate the process of // cleaning up throw new IllegalStateException(PatchLogger.ROOT_LOGGER.layerNotFound(peProvider.getName())); } final File patchDir = layer.getDirectoryStructure().getModulePatchDirectory(pe.getId()); if (!patchDir.exists()) { return true; } } return false; }
File getModuleResource(final String layer, final String patchID, final String moduleName) throws IOException { final PatchableTarget.TargetInfo info = getLayer(layer).loadTargetInfo(); final File root = info.getDirectoryStructure().getModulePatchDirectory(patchID); final File moduleRoot = TestUtils.getModuleRoot(root, moduleName); return new File(moduleRoot, RESOURCE); }
private static boolean isAgedOut(InstalledIdentity installedIdentity, final Patch metadata) { for (PatchElement pe : metadata.getElements()) { final PatchElementProvider peProvider = pe.getProvider(); final PatchableTarget layer = peProvider.isAddOn() ? installedIdentity.getAddOn(peProvider.getName()) : installedIdentity.getLayer(peProvider.getName()); if (layer == null) { // if an identity is missing a layer that means either it was re-configured and the layer // was removed // or the layer in the patch is optional and may be missing on the disk // we haven't had this case yet, not sure how critical this is to terminate the process of // cleaning up throw new IllegalStateException(PatchLogger.ROOT_LOGGER.layerNotFound(peProvider.getName())); } final File patchDir = layer.getDirectoryStructure().getModulePatchDirectory(pe.getId()); if (!patchDir.exists()) { return true; } } return false; }
File getModuleResource(final String layer, final String patchID, final String moduleName) throws IOException { final PatchableTarget.TargetInfo info = getLayer(layer).loadTargetInfo(); final File root = info.getDirectoryStructure().getModulePatchDirectory(patchID); final File moduleRoot = TestUtils.getModuleRoot(root, moduleName); return new File(moduleRoot, RESOURCE); }
static void assertModule(final String patchID, final PatchableTarget target, final ModuleItem item) { final File[] mp = TestUtils.getModuleRoot(target); final File currentPatch = target.getDirectoryStructure().getModulePatchDirectory(patchID); final File module = PatchContentLoader.getModulePath(currentPatch, item); assertModulePath(mp, item, module); }