com.saucelabs.rest
Class Credential

java.lang.Object
  extended by com.saucelabs.rest.Credential

public class Credential
extends java.lang.Object

Credential for the Sauce OnDemand service.

Author:
Kohsuke Kawaguchi

Constructor Summary
Credential()
          Loads the credential from the default location "~/.sauce-ondemand"
Credential(java.io.File propertyFile)
          Loads a credential from the specified property file.
Credential(java.lang.String username, java.lang.String key)
          Creates a credential by specifying the username and the key directly.
 
Method Summary
static java.io.File getDefaultCredentialFile()
          Location of the default credential file.
 java.lang.String getKey()
           
 java.lang.String getUsername()
           
 void saveTo(java.io.File propertyFile)
          Persists this credential to the disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Credential

public Credential(java.lang.String username,
                  java.lang.String key)
Creates a credential by specifying the username and the key directly.


Credential

public Credential(java.io.File propertyFile)
           throws java.io.IOException
Loads a credential from the specified property file. The property file should look like the following:
 username=kohsuke
 password=12345678-1234-1234-1234-1234567890ab
 

Throws:
java.io.IOException - If the file I/O fails, such as non-existent file, incorrect format, or if the file is missing the 'username' or 'key' parameters.

Credential

public Credential()
           throws java.io.IOException
Loads the credential from the default location "~/.sauce-ondemand"

Throws:
java.io.IOException
Method Detail

getUsername

public java.lang.String getUsername()

getKey

public java.lang.String getKey()

saveTo

public void saveTo(java.io.File propertyFile)
            throws java.io.IOException
Persists this credential to the disk.

Throws:
java.io.IOException - If the file I/O fails.

getDefaultCredentialFile

public static java.io.File getDefaultCredentialFile()
Location of the default credential file. "~/.sauce-ondemand"

This common convention allows all the tools that interact with Sauce OnDemand REST API to use the single credential, thereby simplifying the user configuration.



Copyright © 2010. All Rights Reserved.