Java Code Examples for org.apache.http.util.Args#notEmpty()

The following examples show how to use org.apache.http.util.Args#notEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeneratorMode.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public GeneratorMode(String name, Class<? extends IGeneratorStrategy> strategyClass) {
    Args.notEmpty(name, "name");
    Args.notNull(strategyClass, "strategyClass");

    this.name = name;
    this.strategyClass = strategyClass;
}
 
Example 2
Source File: OArchitectOProperty.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public OArchitectOProperty(String name, OType type, boolean subClassProperty, String linkedClass) {
    Args.notEmpty(name, "name");
    this.name = name;
    this.type = type;
    this.subClassProperty = subClassProperty;
    this.linkedClass = linkedClass;
}
 
Example 3
Source File: AetherUtils.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
/**
 * Download artifact from repository
 * @param artifact {@link Artifact} for download
 * @param repository repository for download artifact
 * @return {@link Artifact} of downloaded artifact or Optional.absent if can't download artifact
 * @throws IllegalArgumentException if artifact or repository is null.
 */
public Artifact downloadArtifact(Artifact artifact, String repository) {
    Args.notNull(artifact, "artifact");
    Args.notEmpty(repository, "repository");
    ArtifactRequest artifactRequest = createArtifactRequest(artifact, newUserRemoteRepository(repository));
    ArtifactResult result = resolveArtifactRequest(artifactRequest);
    return result != null ? result.getArtifact() : null;
}
 
Example 4
Source File: OrienteerClassLoaderUtil.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
/**
 * Add artifact jar file to temp folder
 * @param artifactName artifact name
 * @param fileUpload {@link FileUpload} of artifact's jar
 * @return {@link File} of artifact's jar file or Optional.absent() if can't add artifact's jar file to folder
 * @throws IllegalArgumentException if artifactName is null or empty. Or when fileUpload is null.
 */
public static File createJarTempFile(String artifactName, FileUpload fileUpload) {
    Args.notEmpty(artifactName, "artifactName");
    Args.notNull(fileUpload, "fileUpload");
    String fileName = fileUpload.getClientFileName();
    try {
        File file = File.createTempFile(fileName.replaceAll("\\.jar", ""), ".jar");
        fileUpload.writeTo(file);
        return file;
    } catch (Exception e) {
        LOG.error("Cannot upload file: {}", fileName, e);
    }
    return null;
}
 
Example 5
Source File: OLogObj.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
private OLogObj(String key, Object data) {
    this.key = Args.notEmpty(key, "key");
    this.data = data;
}
 
Example 6
Source File: OArchitectOClass.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public OArchitectOClass(String name, List<String> superClasses, List<OArchitectOProperty> properties) {
    Args.notEmpty(name, "name");
    this.name = name;
    this.superClasses = superClasses;
    this.properties = properties;
}
 
Example 7
Source File: SSLSessionStrategyFactory.java    From apiman with Apache License 2.0 4 votes vote down vote up
/**
 * Convenience function parses map of options to generate {@link SSLSessionStrategy}.
 * <p>
 * Defaults are provided for some fields, others are options. ClientKeystore is required:
 * <p>
 * <ul>
 *   <li>trustStore - default: <a href="https://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CustomizingStores">JSSERefGuide</a></li>
 *   <li>trustStorePassword - none</li>
 *   <li>keyStore - required</li>
 *   <li>keyStorePassword - none</li>
 *   <li>keyAliases - none</li>
 *   <li>keyPassword - none</li>
 *   <li>allowedProtocols - {@link SSLParameters#getProtocols()}</li>
 *   <li>disallowedProtocols - {@link SSLParameters#getCipherSuites()}</li>
 *   <li>allowedCiphers - {@link SSLParameters#getCipherSuites()}</li>
 *   <li>disallowedCiphers - {@link SSLParameters#getCipherSuites()}</li>
 *   <li>allowAnyHost - false</li>
 *   <li>allowSelfSigned - false</li>
 * </ul>
 *
 * @param optionsMap map of options
 * @return the SSL session strategy
 * @see #build(String, String, String, String, String[], String, String[], String[], boolean, boolean)
 * @throws NoSuchAlgorithmException if the selected algorithm is not available on the system
 * @throws KeyManagementException when particular cryptographic algorithm not available
 * @throws KeyStoreException problem with keystore
 * @throws CertificateException if there was a problem with the certificate
 * @throws IOException if the truststore could not be found or was invalid
 * @throws UnrecoverableKeyException a key in keystore cannot be recovered
 */
@SuppressWarnings("nls")
public static SSLSessionStrategy buildMutual(TLSOptions optionsMap)
        throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException,
        IOException, UnrecoverableKeyException {
    Args.notNull(optionsMap.getKeyStore(), "KeyStore");
    Args.notEmpty(optionsMap.getKeyStore(), "KeyStore must not be empty");

    String[] allowedProtocols = arrayDifference(optionsMap.getAllowedProtocols(),
            optionsMap.getDisallowedProtocols(),
            getDefaultProtocols());
    String[] allowedCiphers = arrayDifference(optionsMap.getAllowedCiphers(),
            optionsMap.getDisallowedCiphers(),
            getDefaultCipherSuites());

    return build(optionsMap.getTrustStore(),
            optionsMap.getTrustStorePassword(),
            optionsMap.getKeyStore(),
            optionsMap.getKeyStorePassword(),
            optionsMap.getKeyAliases(),
            optionsMap.getKeyPassword(),
            allowedProtocols,
            allowedCiphers,
            optionsMap.isAllowAnyHost(),
            optionsMap.isTrustSelfSigned());
}