private static boolean isFeatureEnabled(Distribution distribution, Feature feature) { return (distribution.getVersion() instanceof IFeatureAwareVersion && ((IFeatureAwareVersion) distribution.getVersion()).enabled(feature)); }
protected boolean useWindows2008PlusVersion(Distribution distribution) { String osName = System.getProperty("os.name"); if (osName.contains("Windows Server 2008 R2") || (distribution.getVersion() instanceof IFeatureAwareVersion) && ((IFeatureAwareVersion) distribution.getVersion()).enabled(Feature.ONLY_WINDOWS_2008_SERVER)) { return true; } else { return osName.contains("Windows 7"); } }
protected boolean withSsl(Distribution distribution) { if ((distribution.getPlatform() == Platform.Windows || distribution.getPlatform() == Platform.OS_X) && distribution.getVersion() instanceof IFeatureAwareVersion) { return ((IFeatureAwareVersion) distribution.getVersion()).enabled(Feature.ONLY_WITH_SSL); } else { return false; } }
public PostgresFilesToExtract(IDirectory dirFactory, ITempNaming executableNaming, FileSet fileSet, Distribution distribution) { super(dirFactory, executableNaming, fileSet); this.fileSet = fileSet; if (dirFactory.asFile() != null) { final File file = new File(dirFactory.asFile(), "pgsql-" + distribution.getVersion().asInDownloadPath()); if (!file.exists()) { //noinspection ResultOfMethodCallIgnored file.mkdir(); } this.extractBasePath = file.getPath(); } else { this.extractBasePath = null; } }
static String asPath(Distribution distribution) { return new StringBuilder() .append(distribution.getPlatform().name()) .append("-") .append(distribution.getBitsize().name()) .append("--") .append(distribution.getVersion().asInDownloadPath()) .toString(); }
@Override public FileSet getFileSet(Distribution distribution) { return com.wix.mysql.distribution.FileSet.emit( distribution.getPlatform(), (Version) distribution.getVersion()); }
@Override public String getPath(Distribution distribution) { String downloadPath = distribution.getVersion().asInDownloadPath(); BitSize bs = distribution.getBitsize(); switch (distribution.getPlatform()) { case OS_X: return format("%s-x86%s.tar.gz", downloadPath, bs == B32 ? "" : "_64"); case Linux: return format("%s-%s.tar.gz", downloadPath, bs == B32 ? "i686" : "x86_64"); case Windows: return format("%s-win%s.zip", downloadPath, bs == B32 ? "32" : "x64"); default: throw new RuntimeException("Not implemented for: " + distribution.getPlatform()); } } }
switch (distribution.getBitsize()) { case B32: if (distribution.getVersion() instanceof IFeatureAwareVersion) { IFeatureAwareVersion featuredVersion = (IFeatureAwareVersion) distribution.getVersion(); if (featuredVersion.enabled(Feature.ONLY_64BIT)) { throw new IllegalArgumentException("this version does not support 32Bit: "+distribution);
@Override public IExtractedFileSet extractFileSet(Distribution distribution) throws IOException { try { final File dir = this.eDir.asFile(); final FileSet filesSet = downloadConfig.getPackageResolver().getFileSet(distribution); final Path path = get(dir.getPath(), "pgsql" + "-" + distribution.getVersion().asInDownloadPath(), "pgsql"); if (exists(path)) { final Builder extracted = builder(dir).baseDirIsGenerated(false); iterateFiles(path.toFile(), TRUE, TRUE).forEachRemaining(file -> { FileType type = Library; if (filesSet.entries().stream() .anyMatch(entry -> entry.matchingPattern().matcher(file.getPath()).matches())) { type = Executable; } extracted.file(type, file); }); return extracted.build(); } else { return super.extractFileSet(distribution); } } catch (Exception e) { LOGGER.error("Failed to extract file set", e); return new EmptyFileSet(); } } }
@Override public String getPath(Distribution distribution) { String sversion = getVersionPart(distribution.getVersion());
@Override public String getPath(Distribution distribution) { String downloadVersion = getVersionPart(distribution.getVersion());
@Override public String getPath(Distribution distribution) { String sversion = getVersionPart(distribution.getVersion());
@Override public String getPath(Distribution distribution) { String versionStr = getVersionPart(distribution.getVersion()); if (distribution.getPlatform() == Platform.Solaris && isFeatureEnabled(distribution, Feature.NO_SOLARIS_SUPPORT)) { throw new IllegalArgumentException("Mongodb for solaris is not available anymore"); } ArchiveType archiveType = getArchiveType(distribution); String archiveTypeStr = getArchiveString(archiveType); String platformStr = getPlattformString(distribution); String bitSizeStr = getBitSize(distribution); if ((distribution.getBitsize()==BitSize.B64) && (distribution.getPlatform()==Platform.Windows)) { versionStr = (useWindows2008PlusVersion(distribution) ? "2008plus-": "") + (withSsl(distribution) ? "ssl-": "") + versionStr; } if (distribution.getPlatform() == Platform.OS_X && withSsl(distribution) ) { return platformStr + "/mongodb-" + platformStr + "-ssl-" + bitSizeStr + "-" + versionStr + "." + archiveTypeStr; } return platformStr + "/mongodb-" + platformStr + "-" + bitSizeStr + "-" + versionStr + "." + archiveTypeStr; }