public SimpleScanner(File baseDir, List<String> includes, List<String> excludes) { if (baseDir != null) { setBasedir(baseDir); } if (!CollectionUtils.isEmpty(includes)) { setIncludes(CollectionUtils.toStringArray(includes)); } if (!CollectionUtils.isEmpty(excludes)) { setExcludes(CollectionUtils.toStringArray(excludes)); } }
protected void setActiveProfiles(ConfigurableApplicationContext applicationContext, List<String> activeProfiles) { if (!CollectionUtils.isEmpty(activeProfiles)) { ConfigurableEnvironment env = applicationContext.getEnvironment(); env.setActiveProfiles(CollectionUtils.toStringArray(activeProfiles)); } }
public static void setupProfiles(ConfigurableApplicationContext ctx, List<String> activeProfiles, List<String> defaultProfiles) { if (!CollectionUtils.isEmpty(activeProfiles)) { ConfigurableEnvironment env = ctx.getEnvironment(); env.setActiveProfiles(CollectionUtils.toStringArray(activeProfiles)); } if (!CollectionUtils.isEmpty(defaultProfiles)) { ConfigurableEnvironment env = ctx.getEnvironment(); env.setDefaultProfiles(CollectionUtils.toStringArray(defaultProfiles)); } }
protected void setDefaultProfiles(ConfigurableApplicationContext applicationContext, List<String> defaultProfiles) { if (!CollectionUtils.isEmpty(defaultProfiles)) { ConfigurableEnvironment env = applicationContext.getEnvironment(); env.setDefaultProfiles(CollectionUtils.toStringArray(defaultProfiles)); } }
/** * <pre> * ssh [args] [user@]hostname command * </pre> */ public static final int ssh(List<String> args, String user, String hostname, String command) { Assert.notNull(hostname); Assert.notNull(command); List<String> arguments = new ArrayList<String>(); arguments.addAll(CollectionUtils.toEmptyList(args)); if (!StringUtils.isBlank(user)) { arguments.add(user + "@" + hostname); } else { arguments.add(hostname); } arguments.add(command); Commandline cl = new Commandline(); cl.setExecutable(SSH); cl.addArguments(CollectionUtils.toStringArray(arguments)); return execute(cl); }
/** * <pre> * rsync [options] source destination * rsync [options] source [user@]hostname:destination * rsync [options] [user@]hostname:source destination * </pre> */ public static final int rsync(List<String> options, String source, String destination) { Assert.notNull(source); Assert.notNull(destination); List<String> arguments = new ArrayList<String>(); arguments.addAll(CollectionUtils.toEmptyList(options)); arguments.add(source); arguments.add(destination); Commandline cl = new Commandline(); cl.setExecutable(RSYNC); cl.addArguments(CollectionUtils.toStringArray(arguments)); return execute(cl); }
/** * <pre> * scp [args] source destination * </pre> * * Where both <code>source</code> and <code>destination</code> are in the format * * <pre> * [[user@]host:]file * </pre> */ public static final int scp(List<String> args, String source, String destination) { Assert.notNull(source); Assert.notNull(destination); List<String> arguments = new ArrayList<String>(); arguments.addAll(CollectionUtils.toEmptyList(args)); arguments.add(source); arguments.add(destination); Commandline cl = new Commandline(); cl.setExecutable(SCP); cl.addArguments(CollectionUtils.toStringArray(arguments)); return execute(cl); }
protected Commandline getCommandLine(ExecContext context) { Commandline cl = new Commandline(); cl.setExecutable(context.getExecutable()); if (context.isAddSystemEnvironment()) { try { cl.addSystemEnvironment(); } catch (Exception e) { throw new IllegalStateException(e); } } if (context.getArgs() != null) { cl.addArguments(CollectionUtils.toStringArray(context.getArgs())); } if (context.getWorkingDirectory() != null) { cl.setWorkingDirectory(context.getWorkingDirectory()); } return cl; }
String[] locationsArray = CollectionUtils.toStringArray(convertedLocations);
String[] locationsArray = CollectionUtils.toStringArray(convertedLocations);