private DomainVersion detectCurrentVersion() throws IOException { Integer currentVersionNumber = detectCurrentVersionNumber(); if (currentVersionNumber != null) { return domain.getVersion(currentVersionNumber); } else { return null; } }
private Set<DomainVersion> detectCachedVersions(SortedSet<CueballFilePath> cachedFiles) throws IOException { Set<DomainVersion> cachedVersions = new HashSet<DomainVersion>(); for (CueballFilePath file : cachedFiles) { DomainVersion version = domain.getVersion(file.getVersion()); if (version != null) { cachedVersions.add(version); } } return cachedVersions; }
@Override protected void action(HttpServletRequest req, HttpServletResponse resp) throws IOException { Domain domain = DomainController.this.coordinator.getDomain(req.getParameter("n")); final DomainVersion domainVersion = domain.getVersion(Integer.parseInt(req.getParameter("ver"))); domainVersion.setDefunct(true); redirect("/domain.jsp?n=" + req.getParameter("n"), resp); } });
@Override protected void action(HttpServletRequest req, HttpServletResponse resp) throws IOException { Domain domain = DomainController.this.coordinator.getDomain(req.getParameter("n")); final DomainVersion domainVersion = domain.getVersion(Integer.parseInt(req.getParameter("ver"))); domainVersion.setDefunct(false); redirect("/domain.jsp?n=" + req.getParameter("n"), resp); } });
@Override protected void action(HttpServletRequest req, HttpServletResponse resp) throws IOException { Domain domain = DomainController.this.coordinator.getDomain(req.getParameter("n")); final DomainVersion domainVersion = domain.getVersion(Integer.parseInt(req.getParameter("ver"))); domainVersion.close(); redirect("/domain.jsp?n=" + req.getParameter("n"), resp); } });
private void addDomainVersionDataToResponse(Map<String, Object> requestData, Map<String, Object> responseData) throws IOException { Domain domain = coordinator.getDomain((String) requestData.get(Params.DOMAIN)); try { DomainVersion version = domain.getVersion(Integer.valueOf((String) requestData.get(Params.DOMAIN_VERSION))); responseData.put(String.valueOf(version.getVersionNumber()), apiHelper.getDomainVersionData(version).asMap()); } catch (Exception ignored) { } // No data added, but no harm done }
@Override public DomainVersion getParentDomainVersion(DomainVersion domainVersion) throws IOException { if (domainVersion.getVersionNumber() == 0) { return null; } else { return domain.getVersion(domainVersion.getVersionNumber() - 1); } }
@Override public void run(Coordinator coordinator) throws IOException { domain = DomainBuilderProperties.getDomain(coordinator, domainName); domainVersionToCompact = domain.getVersion(DomainCompactorProperties.getVersionNumberToCompact(domainName, conf)); } });
private Set<DomainVersion> detectCachedVersions(SortedSet<CueballFilePath> cueballCachedFiles, SortedSet<CurlyFilePath> curlyCachedFiles) throws IOException { // Record in a set all cached Cueball versions HashSet<Integer> cachedCueballVersions = new HashSet<Integer>(); for (CueballFilePath cueballCachedFile : cueballCachedFiles) { cachedCueballVersions.add(cueballCachedFile.getVersion()); } // Compute cached Curly versions Set<DomainVersion> cachedVersions = new HashSet<DomainVersion>(); for (CurlyFilePath curlyCachedFile : curlyCachedFiles) { // Check that the corresponding Cueball version is also cached if (cachedCueballVersions.contains(curlyCachedFile.getVersion())) { DomainVersion version = domain.getVersion(curlyCachedFile.getVersion()); if (version != null) { cachedVersions.add(version); } } } return cachedVersions; }
public static DomainVersion getParentDomainVersion(Domain domain, DomainVersion version) throws IOException { IncrementalDomainVersionProperties properties = (IncrementalDomainVersionProperties)version.getProperties(); if (properties == null) { throw new IOException("Failed to get parent of Domain Version since corresponding properties are empty: " + version); } else { Integer parentVersionNumber = properties.getParentVersionNumber(); if (parentVersionNumber == null) { return null; } else { DomainVersion result = domain.getVersion(parentVersionNumber); if (result == null) { throw new IOException("Failed to get parent Domain Version since specified parent version number (" + parentVersionNumber + ") of version " + version.getVersionNumber() + " of Domain " + domain.getName() + " does not correspond to any version."); } return result; } } }
public static String formatDomainGroupDomainVersionsTable(DomainGroup domainGroup, String cssClass, boolean linkToDomains) throws IOException { StringBuilder content = new StringBuilder(); content.append("<table class='" + cssClass + "'><tr><th>Domain</th><th>Version</th><th>Closed On</th></tr>"); for (DomainAndVersion version : domainGroup.getDomainVersionsSorted()) { content.append("<tr><td class='centered'>"); if (linkToDomains) { content.append("<a href='/domain.jsp?n=" + URLEnc.encode(version.getDomain().getName()) + "'>"); content.append(version.getDomain().getName()); content.append("</a>"); } else { content.append(version.getDomain().getName()); } content.append("</td><td class='centered'>"); content.append(version.getVersionNumber()); content.append("</td><td class='centered'>"); content.append(formatDomainVersionClosedAt(version.getDomain().getVersion(version.getVersionNumber()))); content.append("</td></tr>"); } content.append("</table>"); return content.toString(); }
throw new RuntimeException("Given domain was not found: " + domainName); DomainVersion domainVersion = domain.getVersion(versionNumber); if (domainVersion == null) { throw new RuntimeException("Given version was not found: " + domainName + " version " + versionNumber);
public static void main(String[] args) throws IOException, InvalidConfigurationException { CommandLineChecker.check(args, new String[]{"configuration", "domain name", "domain version number"}, RemoteDomainVersionDeletionHelper.class ); String configurationPath = args[0]; String domainName = args[1]; Integer versionNumber = Integer.parseInt(args[2]); Coordinator coordinator = new YamlCoordinatorConfigurator(configurationPath).createCoordinator(); Domain domain = coordinator.getDomain(domainName); if (domain == null) { throw new RuntimeException("Given domain was not found: " + domainName); } DomainVersion domainVersion = domain.getVersion(versionNumber); if (domainVersion == null) { throw new RuntimeException("Given version was not found: " + domainName + " version " + versionNumber); } LOG.info("Deleting remote data for domain " + domainName + " version " + versionNumber); domainVersion.setDefunct(true); domain.getStorageEngine().getRemoteDomainVersionDeleter(StorageEngine.RemoteLocation.DOMAIN_BUILDER).deleteVersion(versionNumber); } }
private static boolean allDeltasComplete(DomainVersion version, Domain domain) throws IOException { if(version == null){ return true; } if (isBase(version)) { return true; } if (!DomainVersions.isClosed(version)) { return false; } IncrementalDomainVersionProperties properties = (IncrementalDomainVersionProperties)version.getProperties(); return allDeltasComplete( domain.getVersion(properties.getParentVersionNumber()), domain ); }
private static boolean isCompleteToBase(DomainVersion version, Domain domain) throws IOException { if(version == null){ return true; } if (!DomainVersions.isClosed(version)) { return false; } if (isBase(version)) { return !version.isDefunct(); } // TODO is there ever going to be a different impl of props? IncrementalDomainVersionProperties properties = (IncrementalDomainVersionProperties)version.getProperties(); return isCompleteToBase( domain.getVersion(properties.getParentVersionNumber()), domain ); }
domain.getVersion(targetDomainAndVersion.getVersionNumber());