Class GoogleOAuth2Service
- java.lang.Object
-
- net.sf.okapi.connectors.googleautoml.GoogleOAuth2Service
-
public class GoogleOAuth2Service extends Object
-
-
Constructor Summary
Constructors Constructor Description GoogleOAuth2Service()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAccessToken()Gets an access token (refresh it if needed)booleanhasCredential()Indicates if the credential for the service has been set.voidsetCredential(InputStream inputStream)Sets the service credential.voidsetCredentialFilePath(String credentialFilePath)CallssetCredential(InputStream)with a file.voidsetCredentialString(String credentialString)CallssetCredential(InputStream)with the JSON credential string.
-
-
-
Method Detail
-
hasCredential
public boolean hasCredential()
Indicates if the credential for the service has been set.- Returns:
- true if we have credential, false if we need to set it.
-
setCredential
public void setCredential(InputStream inputStream)
Sets the service credential.- Parameters:
inputStream- the input stream where the credential is.- See Also:
setCredentialFilePath(String),setCredentialString(String)
-
setCredentialFilePath
public void setCredentialFilePath(String credentialFilePath)
CallssetCredential(InputStream)with a file.- Parameters:
credentialFilePath- the path of the file with the credential.
-
setCredentialString
public void setCredentialString(String credentialString)
CallssetCredential(InputStream)with the JSON credential string.- Parameters:
credentialString- the JSON credential string.
-
getAccessToken
public String getAccessToken() throws IOException
Gets an access token (refresh it if needed)- Returns:
- the access token for the service.
- Throws:
IOException- when an error occurs.
-
-