Java Code Examples for org.jclouds.domain.LoginCredentials#builder()

The following examples show how to use org.jclouds.domain.LoginCredentials#builder() . 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: CloudSigmaConnector.java    From cloudml with GNU Lesser General Public License v3.0 6 votes vote down vote up
private org.jclouds.domain.LoginCredentials.Builder initCredentials(String login, String key){
    String contentKey;
    org.jclouds.domain.LoginCredentials.Builder b= LoginCredentials.builder();
    File f = new File(key);
    if(f.exists() && !f.isDirectory()) {
        try {
            contentKey = FileUtils.readFileToString(new File(key));
            b.user(login);
            b.noPassword();
            b.privateKey(contentKey);
        } catch (IOException e) {
            journal.log(Level.SEVERE, e.getMessage());
        }
    }else{
        b.user(login);
        b.noPassword();
        b.privateKey(key);
    }
    return b;
}
 
Example 2
Source File: OpenStackConnector.java    From cloudml with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Prepare the credential builder
 * @param login
 * @param key
 * @return
 */
private org.jclouds.domain.LoginCredentials.Builder initCredentials(String login, String key){
    String contentKey;
    org.jclouds.domain.LoginCredentials.Builder b= LoginCredentials.builder();
    File f = new File(key);
    if(f.exists() && !f.isDirectory()) {
        try {
            contentKey = FileUtils.readFileToString(new File(key));
            b.user(login);
            b.noPassword();
            b.privateKey(contentKey);
        } catch (IOException e) {
            journal.log(Level.SEVERE, e.getMessage());
        }
    }else{
        b.user(login);
        b.noPassword();
        b.privateKey(key);
    }
    return b;
}
 
Example 3
Source File: JCloudsConnector.java    From cloudml with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Prepare the credential builder
 * @param login
 * @param key
 * @return
 */
private org.jclouds.domain.LoginCredentials.Builder initCredentials(String login, String key){
    String contentKey;
    org.jclouds.domain.LoginCredentials.Builder b= LoginCredentials.builder();
    File f = new File(key);
    if(f.exists() && !f.isDirectory()) {
        try {
            contentKey = FileUtils.readFileToString(f);
            b.user(login);
            b.noPassword();
            b.privateKey(contentKey);
        } catch (IOException e) {
            journal.log(Level.SEVERE, e.getMessage());
        }
    }else{
        b.user(login);
        b.noPassword();
        b.privateKey(key);
    }
    return b;
}