public static void noNullsWithMsg(String msg, Object... objects) { for (Object object : objects) { notNull(object, msg); } }
public SqlEvent(String sql, int updateCount, long startTimeMillis, long stopTimeMillis) { Assert.notNull(sql); this.sql = sql; this.updateCount = updateCount; this.startTimeMillis = startTimeMillis; this.stopTimeMillis = stopTimeMillis; }
@Deprecated public static void notNull(Object... objects) { for (Object object : objects) { notNull(object); } }
protected String toNull(String token, String nullToken) { Assert.notNull(nullToken); return StringUtils.equals(token, nullToken) ? null : token; } }
public static final String getLocation(String user, String hostname, String filename) { Assert.notNull(user); Assert.notNull(filename); StringBuilder sb = new StringBuilder(); if (!StringUtils.isBlank(user)) { sb.append(user + "@"); } sb.append(hostname); sb.append(":"); sb.append(filename); return sb.toString(); }
/** * <pre> * ssh [args] [user@]hostname rm -rf file * </pre> */ public static final int sshrm(List<String> args, String user, String hostname, String file) { Assert.notNull(file); return sshrm(args, user, hostname, Collections.singletonList(file)); }
/** * Print the start token */ public void start() { if (startMessage != null) { LoggerUtils.log(startMessage, logger); } Assert.notNull(printStream, "printStream is null"); this.progress = 0; printStream.print(startToken); }
public TomcatFiles build() { Assert.noBlanks(rootWar, serverXml, webXml); Assert.notNull(logsDirJsps); this.logsDirJsps = ImmutableList.copyOf(logsDirJsps); return new TomcatFiles(this); }
@Override public void copyStringToFile(String string, RemoteFile destination) { Assert.notNull(string); Assert.notBlank(encoding); InputStream in = new ByteArrayInputStream(Str.getBytes(string, encoding)); copyInputStreamToFile(in, destination); IOUtils.closeQuietly(in); }
protected void store(File file, org.kuali.common.util.config.ProjectConfigContainer config) { Assert.notNull(file, "file is null"); Assert.notNull(config, "config is null"); org.kuali.common.util.config.ProjectConfigContainer clone = new org.kuali.common.util.config.ProjectConfigContainer(config); Nullifier nullifier = new org.kuali.common.util.config.ProjectConfigContainerNullifier(); nullifier.nullify(); xmlService.write(file, clone); }
@Override public CopyResult scpString(String string, RemoteFile destination) { Assert.notNull(string); InputStream in = new ByteArrayInputStream(Str.getBytes(string, context.getEncoding())); CopyResult result = scp(in, destination); IOUtils.closeQuietly(in); return result; }
public SimpleStringSupplier(List<String> strings) { Assert.notNull(strings); this.strings = ListUtils.newImmutableArrayList(strings); this.metaData = MetaDataUtils.getSqlMetaData(this); }
@Override public void copyInputStreamToFile(InputStream source, RemoteFile destination) { Assert.notNull(source); try { createDirectories(destination); sftp.put(source, destination.getAbsolutePath()); } catch (SftpException e) { throw new IllegalStateException(e); } }
@Override public CopyResult scp(File source, RemoteFile destination) { Assert.notNull(source); Assert.exists(source); Assert.isFalse(source.isDirectory(), "[" + source + "] is a directory"); Assert.isTrue(source.canRead(), "[" + source + "] not readable"); return scp(LocationUtils.getCanonicalURLString(source), destination); }
/** * <pre> * ssh [args] [user@]hostname chmod mode file * </pre> */ public static final int sshchmod(List<String> args, String user, String hostname, String mode, String path) { Assert.hasLength(mode); Assert.notNull(path); return ssh(args, user, hostname, cmds.chmod(mode, path)); }
public static void logTable(LogTableContext context) { String table = getTable(context); Assert.notNull(context.getLogger(), "logger is null"); Assert.notNull(context.getLevel(), "level is null"); String msg = context.getTitle() + "\n\n" + table; logMsg(msg, context.getLogger(), context.getLevel()); }
public static String getTable(LogTableContext context) { Assert.notNull(context, "context is null"); int[] padding = getPadding(context.getColumns(), context.getRows()); int cols = context.getColumns().size(); int rows = context.getRows().size(); String header = getHeader(context.getColumns(), padding, context.isLeftAlign()); updateArgsList(context.getRows(), padding, context.isLeftAlign()); Properties properties = getProperties(context.getRows()); String tableString = getTableString(rows, cols); String resolved = HELPER.replacePlaceholders(tableString, properties); return header + "\n" + resolved; }
@Override public String getObject() { Assert.notNull(localRepositoryDir); Assert.hasText(getGroupId()); Assert.hasText(getArtifactId()); Assert.hasText(getVersion()); Assert.hasText(getType()); File file = org.kuali.common.util.RepositoryUtils.getFile(localRepositoryDir, this); validate(file); return LocationUtils.getCanonicalPath(file); }