arch = match.getArch(); version = match.getVersion(); javaVersion = match.getJavaVersion(); result = new Platform(match.getName(), match.getSymbolicName(), version, arch, javaVersion); result = new Platform(Name.UNKNOWN, null, version, arch, javaVersion);
/** * Check if a fully qualified directory path contains valid syntax. * @param directory * @return */ public boolean isValidDirectoryPath(File directory) { return isValidDirectoryPath(directory.getAbsolutePath()); } public boolean isValidDirectoryPath(String directoryPath)
/** * Determines if this platform is an instance of another. * * @param platform the platform to compare against * @return {@code true} if the platform is an instance of <tt>platform</tt> */ public boolean isA(Platform platform) { boolean result = false; if (isA(platform.name) && hasSymbolicName(platform.symbolicName) && hasArch(platform.arch) && hasVersion(platform.version) && hasJavaVersion(platform.javaVersion)) { result = true; } return result; }
/** * Determines if a platform is more specific than the current fallback platform. * * @param requested the requested platform * @param fallback the current fallback platform * @param platform the platform to check. * @return <tt>true</tt> if <tt>platform</tt> is a <tt>fallback</tt> or has the same version as that requested * and the fallback doesn't specify a version */ private boolean moreSpecific(Platform requested, Platform fallback, Platform platform) { boolean result = platform.isA(fallback); if (!result) { if (requested.getVersion() != null && requested.getVersion().equals(platform.getVersion()) && fallback.getVersion() == null) { result = true; } } return result; }
for (Platform platform : PLATFORMS) if ((pname == Name.UNKNOWN && equals(name, platform.getSymbolicName(), true)) || (pname != Name.UNKNOWN && pname == platform.getName())) boolean archMatch = arch == platform.getArch(); boolean optArchMatch = platform.getArch() == Arch.UNKNOWN; boolean versionMatch = version != null && equals(version, platform.getVersion()); boolean optVersionMatch = platform.getVersion() == null; boolean symbolicMatch = equals(name, platform.getSymbolicName(), true); if (archMatch)
match = arch.equals(platform.getArch()); match = platform.getVersion() != null && platform.getVersion().equals(model.getVersion()); match = name.equals(platform.getName()); match = platform.getName().isA(family); match = platform.getJavaVersion() != null && platform.getJavaVersion().startsWith(model.getJre());
if (platform.getSymbolicName() != null) path = installData.getVariable(PREFIX + platform.getSymbolicName().toLowerCase()); path = getTargetPanelDir(installData, platform.getName());
if (platform.getName() == Platform.Name.UNKNOWN)
public boolean isValidDirectoryPath(String directoryPath) { String filteredPath = directoryPath; if (name == Name.WINDOWS) { if (!directoryPath.matches("^([a-zA-Z]:|\\\\).*")) { return false; } filteredPath = directoryPath.substring(2, directoryPath.length()); } return isValidDirectorySyntax(filteredPath); } /**
/** * Validate that groupName is a valid directory path * * @param groupName * @return */ public String verifyProgramGroup(String groupName) { if(!platform.isValidDirectorySyntax(groupName)) { return installData.getMessages().get("ShortcutPanel.group.error"); } return ""; }
/** * Determines if this platform is an instance of the platform family name. * * @param name the platform family name * @return {@code true} if the platform is an instance of <tt>name</tt> */ public boolean isA(Name name) { return isA(this.name, name); }
if(!installData.getPlatform().isValidDirectoryPath(file))
/** * Constructs a {@code FileQueueFactory}. * * @param platform the current platform * @param librarian the librarian */ public FileQueueFactory(Platform platform, Librarian librarian) { supportsQueue = platform.isA(Platform.Name.WINDOWS); this.librarian = librarian; }
else if (!installData.getPlatform().isValidDirectoryPath(pathFile))
private String getJavaCommand(String[] args) { String java; boolean console = false; if(args.length > 0) { console = true; } if (platform.isA(WINDOWS)) { if (console) { java = "java.exe"; } else { java = "javaw.exe"; } } else { java = "java"; } return System.getProperty("java.home") + File.separator + "bin" + File.separator + java; }
/** * Returns the command to launch java on the current platform. * * @return the command. This will be fully qualified if the command is found */ public static String getJavaCommand() { String executable = "java"; if (OsVersion.PLATFORM.isA(WINDOWS) || OsVersion.PLATFORM.isA(OS_2)) { executable += ".exe"; } String dir = new File(JAVA_HOME + "/bin").getAbsolutePath(); File exe = new File(dir, executable); if (!exe.exists()) { // if java.home isn't pointing to the correct location, assume java is somewhere on the PATH. return executable; } return exe.getAbsolutePath(); }
private void setInstallDriveFromPath(String path, String variable) { if (getPlatform().isA(WINDOWS)) { String[] parts = path.trim().split(":", 2); if (parts.length > 0 && parts[0].length() == 1) { setVariable(variable, parts[0] + ":"); } } }
/** * Determines if the current name is an instance of the specified platform family name. * * @param current the current name * @param name the plaform family name * @return {@code true} if current is an instance of <tt>name</tt> */ private boolean isA(Name current, Name name) { if (name == current) { return true; } else { for (Name parent : current.getParents()) { if (isA(parent, name)) { return true; } } } return false; }