/** * Replace $[variables} in list with a matching property from the map * @param list List of Strings to be token-replaced */ public void resolve(List<String> list) { for (int i = 0; i < list.size(); i++) { String s = list.get(i); if (hasToken(s)) { list.set(i, resolve(s)); } } }
/** * Replace $[variables} in list with a matching property from the map * @param list List of Strings to be token-replaced */ public void resolve(List<String> list) { for (int i = 0; i < list.size(); i++) { String s = list.get(i); if (hasToken(s)) { list.set(i, resolve(s)); } } }
/** * Replace $[variables} in list with a matching property from the map * @param list List of Strings to be token-replaced */ public void resolve(List<String> list) { for (int i = 0; i < list.size(); i++) { String s = list.get(i); if (hasToken(s)) { list.set(i, resolve(s)); } } }
@Override protected void validate() throws CommandException { remoteUser = resolver.resolve(getRawRemoteUser()); }
all.putAll(profiler.getConfig()); TokenResolver resolver = new TokenResolver(all); resolver.resolve(jvmOptions.xProps); resolver.resolve(jvmOptions.xxProps); resolver.resolve(jvmOptions.plainProps); resolver.resolve(jvmOptions.sysProps); resolver.resolve(javaConfig.getMap()); resolver.resolve(profiler.getConfig()); resolver.resolve(debugOptions); logFilename = resolver.resolve(logFilename); adminFileRealmKeyFile = resolver.resolve(adminFileRealmKeyFile);
/** * This method first obtains a list of files under the product installation * directory. It then modifies each path by prepending it with remote install dir path. * For ex. glassfish/lib/appserv-rt.jar becomes * <remote-install-path>/glassfish/lib/appserv-rt.jar * @return List of files and directories * @throws IOException */ List<String> getListOfInstallFiles(String installDir) throws IOException { String ins = resolver.resolve("${com.sun.aas.productRoot}"); Set files = FileUtils.getAllFilesAndDirectoriesUnder(new File(ins)); if (logger.isLoggable(Level.FINER)) logger.finer("Total number of files under " + ins + " = " + files.size()); String remoteDir = installDir; if (!installDir.endsWith("/")) { remoteDir = remoteDir + "/"; } List<String> modList = new ArrayList<String>(); for (Object f : files) { modList.add(remoteDir + FileUtils.makeForwardSlashes(((File) f).getPath())); } return modList; }
@Override protected void validate() throws CommandException { super.validate(); Globals.setDefaultHabitat(habitat); installDir = resolver.resolve(installDir); }
tr.resolve(this);
@Override protected void validate() throws CommandException { super.validate(); Globals.setDefaultHabitat(habitat); installDir = resolver.resolve(installDir); if(ok(archive)) { archive = SmartFile.sanitize(archive); } }
/** * Validate all the parameters used to create an ssh node * @param map Map with all parameters used to create an ssh node. * The map values can contain system property tokens. * @throws CommandValidationException */ private void validateSsh(ParameterMap map, String nodehost) throws CommandValidationException { String sshkeyfile = map.getOne(PARAM_SSHKEYFILE); if (StringUtils.ok(sshkeyfile)) { // User specified a key file. Make sure we get use it File kfile = new File(resolver.resolve(sshkeyfile)); if (!kfile.isAbsolute()) { throw new CommandValidationException( Strings.get("key.path.not.absolute", kfile.getPath())); } if (!kfile.exists()) { throw new CommandValidationException( Strings.get("key.path.not.found", kfile.getPath())); } if (!kfile.canRead()) { throw new CommandValidationException( Strings.get("key.path.not.readable", kfile.getPath(), System.getProperty("user.name"))); } } }
if (StringUtils.ok(sshkeyfile)) { File kfile = new File(resolver.resolve(sshkeyfile)); if (! kfile.isAbsolute()) { throw new CommandValidationException(
new HashMap<String, String>((Map)(System.getProperties())); resolver = new TokenResolver(systemPropsMap); String resolvedInstallDir = resolver.resolve(installdir); File actualInstallDir = new File( resolvedInstallDir+"/" + NodeUtils.LANDMARK_FILE);
new HashMap<String, String>((Map)(System.getProperties())); resolver = new TokenResolver(systemPropsMap); String resolvedInstallDir = resolver.resolve(installdir); File actualInstallDir = new File( resolvedInstallDir+"/" + NodeUtils.LANDMARK_FILE);