@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); }
public static void appendToOrSetProperty(Properties properties, String key, String value) { Assert.hasText(value); String existingValue = properties.getProperty(key); if (existingValue == null) { existingValue = ""; } String newValue = existingValue + value; properties.setProperty(key, newValue); }
public SqlLocationContext(String encoding, SqlReader reader, int maxCount, int maxSize) { Assert.noBlanks(encoding); Assert.noNulls(reader); Assert.isTrue(maxCount > 0, "max count must be a positive integer"); Assert.isTrue(maxSize >= 0, "max size is negative"); this.encoding = encoding; this.reader = reader; this.maxCount = maxCount; this.maxSize = maxSize; }
private void validate(EncContext ctx, boolean required, Optional<String> password) { Assert.notNull(ctx.getTextEncryptor(), "'textEncryptor' cannot be null"); Assert.notNull(ctx.getStrength(), "'strength' cannot be null"); if (required) { Assert.isTrue(ctx.getTextEncryptor().isPresent()); } if (password.isPresent()) { Assert.noBlanks(password.get()); Assert.notEncrypted(password.get()); Assert.notConcealed(password.get()); } }
private Builder finish() { // Ensure we are being configured correctly Assert.noNulls(root, appenders, loggers, debug, threshold); Assert.isFalse(Logger.isThresholdNull(root), "root logging threshold is null"); Assert.noBlanks(namespace); // Defensive copies of the 2 lists we were passed this.appenders = ListUtils.newArrayList(appenders); this.loggers = ListUtils.newArrayList(loggers); // Return the fully configured Builder return this; }
private static void validate(ChannelContext ctx) { checkNotBlank(ctx.hostname, "hostname"); checkNotBlank(ctx.encoding, "encoding"); Assert.noNulls(ctx.getUsername(), ctx.getConnectTimeout(), ctx.getOptions(), ctx.getKnownHosts(), ctx.getConfig(), ctx.getPrivateKeyFiles(), ctx.getPrivateKeys()); Assert.isPort(ctx.getPort()); Assert.positive(ctx.getWaitForClosedSleepMillis()); Assert.notEncrypted(ctx.getPrivateKeys()); if (ctx.isUseConfigFile()) { Assert.exists(ctx.getConfig()); Assert.isTrue(ctx.getConfig().canRead(), "[" + ctx.getConfig() + "] exists but is not readable"); } if (ctx.getConnectTimeout().isPresent()) { Assert.positive(ctx.getConnectTimeout().get()); } }
public AbstractCachingConfigService(ProjectService projectService, XmlService xmlService) { Assert.noNulls(projectService, xmlService); this.projectService = projectService; this.xmlService = xmlService; }
public CommandResult(byte[] command, int exitValue, long start) { this.stop = System.currentTimeMillis(); Assert.isTrue(stop >= start); Assert.noNulls(command); Assert.noNegatives(start); this.command = command; this.exitValue = exitValue; this.start = start; this.elapsed = stop - start; }
/** * Assert that <code>port</code> is >= 0 and <= 65535 */ public static void isPort(int port) { isTrue(port >= 0 && port <= 65535, "Port must be a number between 0 and 65535"); }
private void validate(EnvCredentialsProvider provider) { Assert.noNulls(provider.getEnv(), provider.getAccessKeyProperties(), provider.getSecretKeyProperties()); Assert.isTrue(provider.getAccessKeyProperties().size() > 0, "Must provide at least one property to examine for AWS Access Key ID"); Assert.isTrue(provider.getSecretKeyProperties().size() > 0, "Must provide at least one property to examine for AWS Secret Key"); }
@Override public synchronized void open() { Assert.isFalse(open, "Already open"); this.open = true; this.done = false; }
public DbaSql(String before, String after) { Assert.noBlanks(before, after); this.before = before; this.after = after; }
@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); }