Package com.artisol.teneo.manager.client
Class TeneoManagerClient
- java.lang.Object
-
- com.artisol.teneo.manager.client.TeneoManagerClient
-
- All Implemented Interfaces:
Serializable
public class TeneoManagerClient extends Object implements Serializable
Teneo Manager Client thread-safe main class. It allows you to call a Teneo Manager Server for resources and configuration.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TeneoManagerClient(String pTeneoManagerURL, String pApiToken)
Creates aTeneoManagerClient
instance and initializes it with the given access token.
Besides regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pApiToken, com.artisol.teneo.manager.api.misc.Settings pSettings)
Creates aTeneoManagerClient
instance and initializes it with the given access token.
Besides regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret)
Creates aTeneoManagerClient
instance and requests a client access token from the server.
Besides, regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret, com.artisol.teneo.manager.api.misc.Settings pSettings)
Creates aTeneoManagerClient
instance and requests a client access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret, String pUsername, String pPassword)
Creates aTeneoManagerClient
instance and requests a user access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateException
runtime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret, String pUsername, String pPassword, com.artisol.teneo.manager.api.misc.Settings pSettings)
Creates aTeneoManagerClient
instance and requests a user access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPlatformProperties(Properties pProperties)
Add to the passed properties the one related to the authentication type.void
forceRefreshTokens()
Resets accessTokenTimeout and callsrefreshTokens()
.String
getAccessToken()
com.artisol.teneo.manager.api.resources.AdminResource
getAdminClient()
static com.artisol.teneo.manager.api.resources.AdminResource
getAdminClient(String pTeneoManagerURL, String pAccessToken)
static com.artisol.teneo.manager.api.resources.AdminResource
getAdminClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)
com.artisol.teneo.manager.api.resources.CommonResource
getCommonClient()
static com.artisol.teneo.manager.api.resources.CommonResource
getCommonClient(String pTeneoManagerURL, String pAccessToken)
static com.artisol.teneo.manager.api.resources.CommonResource
getCommonClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)
TeneoManagerClient
getDelegatedLoginClient(String pToken)
static TeneoManagerClient
getDelegatedLoginClient(String pToken, String pTeneoManagerURL, String pClientId, String pClientSecret)
static TeneoManagerClient
getDelegatedLoginClient(String pToken, String pTeneoManagerURL, String pClientId, String pClientSecret, com.artisol.teneo.manager.api.misc.Settings pSettings)
com.artisol.teneo.manager.api.resources.DocumentationResource
getDocumentationClient()
static com.artisol.teneo.manager.api.resources.DocumentationResource
getDocumentationClient(String pTeneoManagerURL, String pAccessToken)
static com.artisol.teneo.manager.api.resources.DocumentationResource
getDocumentationClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)
com.artisol.teneo.manager.api.resources.InquireResource
getInquireClient()
static com.artisol.teneo.manager.api.resources.InquireResource
getInquireClient(String pTeneoManagerURL, String pAccessToken)
static com.artisol.teneo.manager.api.resources.InquireResource
getInquireClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)
com.artisol.teneo.manager.api.resources.OAuth2Resource
getOAuth2Client()
static com.artisol.teneo.manager.api.resources.OAuth2Resource
getOAuth2Client(String pTeneoManagerURL, String pAccessToken)
static com.artisol.teneo.manager.api.resources.OAuth2Resource
getOAuth2Client(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)
int
getRequestRetryCount()
long
getRequestRetryDelay()
URL
getStartDelegatedLoginUrl(String pToken)
Properties
getStatus()
com.artisol.teneo.manager.api.resources.StudioResource
getStudioClient()
static com.artisol.teneo.manager.api.resources.StudioResource
getStudioClient(String pTeneoManagerURL, String pAccessToken)
static com.artisol.teneo.manager.api.resources.StudioResource
getStudioClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)
boolean
isDelegated()
void
revokeAccessToken()
Revokes the access token No need to check for the response
-
-
-
Constructor Detail
-
TeneoManagerClient
public TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret) throws IncompatibleVersionException, com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, URISyntaxException
Creates aTeneoManagerClient
instance and requests a client access token from the server.
Besides, regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpClientId
- ClientId to be used to authenticatepClientSecret
- ClientSecret to be used to authenticate- Throws:
IncompatibleVersionException
- In case of incompatible version foundcom.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exceptions wrapped in aResourceException
URISyntaxException
- In case pTeneoManagerURL is wrong
-
TeneoManagerClient
public TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret, com.artisol.teneo.manager.api.misc.Settings pSettings) throws IncompatibleVersionException, com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, URISyntaxException
Creates aTeneoManagerClient
instance and requests a client access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpClientId
- ClientId to be used to authenticatepClientSecret
- ClientSecret to be used to authenticatepSettings
- Settings used to create ManagerClient- Throws:
IncompatibleVersionException
- In case of incompatible version foundcom.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exceptions wrapped in aResourceException
URISyntaxException
- In case pTeneoManagerURL is wrong
-
TeneoManagerClient
public TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret, String pUsername, String pPassword) throws IncompatibleVersionException, com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, URISyntaxException
Creates aTeneoManagerClient
instance and requests a user access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateException
runtime exceptions.- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpClientId
- ClientId to be used to authenticatepClientSecret
- ClientSecret to be used to authenticatepUsername
- Username to be used to authenticatepPassword
- User password to be used to authenticate- Throws:
IncompatibleVersionException
- In case of incompatible version foundcom.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exceptions wrapped in aResourceException
URISyntaxException
- In case pTeneoManagerURL is wrong
-
TeneoManagerClient
public TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret, String pUsername, String pPassword, com.artisol.teneo.manager.api.misc.Settings pSettings) throws URISyntaxException, com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, IncompatibleVersionException
Creates aTeneoManagerClient
instance and requests a user access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpClientId
- ClientId to be used to authenticatepClientSecret
- ClientSecret to be used to authenticatepUsername
- Username to be used to authenticatepPassword
- User password to be used to authenticatepSettings
- Settings used to create ManagerClient- Throws:
IncompatibleVersionException
- In case of incompatible version foundcom.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exceptions wrapped in aResourceException
URISyntaxException
- In case pTeneoManagerURL is wrong
-
TeneoManagerClient
public TeneoManagerClient(String pTeneoManagerURL, String pApiToken) throws IncompatibleVersionException, com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, URISyntaxException
Creates aTeneoManagerClient
instance and initializes it with the given access token.
Besides regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpApiToken
- A valid apiToken to be used as accessToken- Throws:
IncompatibleVersionException
- In case of incompatible version foundcom.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exceptions wrapped in aResourceException
URISyntaxException
- In case pTeneoManagerURL is wrong
-
TeneoManagerClient
public TeneoManagerClient(String pTeneoManagerURL, String pApiToken, com.artisol.teneo.manager.api.misc.Settings pSettings) throws IncompatibleVersionException, com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, URISyntaxException
Creates aTeneoManagerClient
instance and initializes it with the given access token.
Besides regular checked exceptions, it can also throwIllegalStateException
orProcessingException
runtime exceptions.- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpApiToken
- A valid apiToken to be used as accessTokenpSettings
- Settings used to create ManagerClient- Throws:
IncompatibleVersionException
- In case of incompatible version foundcom.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exceptions wrapped in aResourceException
URISyntaxException
- In case pTeneoManagerURL is wrong
-
-
Method Detail
-
getOAuth2Client
public com.artisol.teneo.manager.api.resources.OAuth2Resource getOAuth2Client() throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Returns:
- A callable object implementing
OAuth2Resource
interface - Throws:
com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exception
-
getOAuth2Client
public static com.artisol.teneo.manager.api.resources.OAuth2Resource getOAuth2Client(String pTeneoManagerURL, String pAccessToken) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token string- Returns:
- A callable object implementing
OAuth2Resource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
getOAuth2Client
public static com.artisol.teneo.manager.api.resources.OAuth2Resource getOAuth2Client(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token stringpSettings
- Settings used to create the WebTarget of the generated resource instance- Returns:
- A callable object implementing
OAuth2Resource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
getAdminClient
public com.artisol.teneo.manager.api.resources.AdminResource getAdminClient() throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Returns:
- A callable object implementing
AdminResource
interface - Throws:
com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exception
-
getAdminClient
public static com.artisol.teneo.manager.api.resources.AdminResource getAdminClient(String pTeneoManagerURL, String pAccessToken) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token string- Returns:
- A callable object implementing
AdminResource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
getAdminClient
public static com.artisol.teneo.manager.api.resources.AdminResource getAdminClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token stringpSettings
- Settings used to create the WebTarget of the generated resource instance- Returns:
- A callable object implementing
AdminResource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
getCommonClient
public com.artisol.teneo.manager.api.resources.CommonResource getCommonClient() throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Returns:
- A callable object implementing
CommonResource
interface - Throws:
com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exception
-
getCommonClient
public static com.artisol.teneo.manager.api.resources.CommonResource getCommonClient(String pTeneoManagerURL, String pAccessToken) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token string- Returns:
- A callable object implementing
CommonResource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
getCommonClient
public static com.artisol.teneo.manager.api.resources.CommonResource getCommonClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token stringpSettings
- Settings used to create the WebTarget of the generated resource instance- Returns:
- A callable object implementing
CommonResource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
getInquireClient
public com.artisol.teneo.manager.api.resources.InquireResource getInquireClient() throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Returns:
- A callable object implementing
InquireResource
interface - Throws:
com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exception
-
getInquireClient
public static com.artisol.teneo.manager.api.resources.InquireResource getInquireClient(String pTeneoManagerURL, String pAccessToken) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token string- Returns:
- A callable object implementing
InquireResource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
getInquireClient
public static com.artisol.teneo.manager.api.resources.InquireResource getInquireClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token stringpSettings
- Settings used to create the WebTarget of the generated resource instance- Returns:
- A callable object implementing
InquireResource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
getStudioClient
public com.artisol.teneo.manager.api.resources.StudioResource getStudioClient() throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Returns:
- A callable object implementing
StudioResource
interface - Throws:
com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exception
-
getStudioClient
public static com.artisol.teneo.manager.api.resources.StudioResource getStudioClient(String pTeneoManagerURL, String pAccessToken) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token string- Returns:
- A callable object implementing
StudioResource
interface - Throws:
URISyntaxException
- In case pTeneoManagerURL string has wrong URL format
-
getStudioClient
public static com.artisol.teneo.manager.api.resources.StudioResource getStudioClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token stringpSettings
- Settings used to create the WebTarget of the generated resource instance- Returns:
- A callable object implementing
StudioResource
interface - Throws:
URISyntaxException
- In case pTeneoManagerURL string has wrong URL format
-
getDocumentationClient
public com.artisol.teneo.manager.api.resources.DocumentationResource getDocumentationClient() throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Returns:
- A callable object implementing
DocumentationResource
interface - Throws:
com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exception
-
getDocumentationClient
public static com.artisol.teneo.manager.api.resources.DocumentationResource getDocumentationClient(String pTeneoManagerURL, String pAccessToken) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token string- Returns:
- A callable object implementing
DocumentationResource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
getDocumentationClient
public static com.artisol.teneo.manager.api.resources.DocumentationResource getDocumentationClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings) throws URISyntaxException
- Parameters:
pTeneoManagerURL
- Teneo Manager server URLpAccessToken
- Access_token stringpSettings
- Settings used to create the WebTarget of the generated resource instance- Returns:
- A callable object implementing
DocumentationResource
interface - Throws:
URISyntaxException
- In case of bad-formatted pTeneoManagerURL
-
revokeAccessToken
public void revokeAccessToken()
Revokes the access token No need to check for the response
-
forceRefreshTokens
public void forceRefreshTokens() throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
Resets accessTokenTimeout and callsrefreshTokens()
.- Throws:
com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exception
-
getAccessToken
public String getAccessToken() throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Returns:
- The actual access_token string
- Throws:
com.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exception
-
getRequestRetryCount
public int getRequestRetryCount()
- Returns:
- the number of times the client will try to reconnect to the server for an authorization request
-
getRequestRetryDelay
public long getRequestRetryDelay()
- Returns:
- the amount of time between each reconnection try
-
getStartDelegatedLoginUrl
public URL getStartDelegatedLoginUrl(String pToken) throws MalformedURLException
- Parameters:
pToken
- The delegated login token- Returns:
- The redirected URL for delegation
- Throws:
MalformedURLException
- In case of malformed URL
-
getDelegatedLoginClient
public TeneoManagerClient getDelegatedLoginClient(String pToken) throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, IncompatibleVersionException, URISyntaxException
- Parameters:
pToken
- The delegated login token- Returns:
- A delegated login TeneoManagerClient
- Throws:
IncompatibleVersionException
- In case of incompatible version foundcom.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exceptions wrapped in aResourceException
URISyntaxException
- In case pTeneoManagerURL is wrong
-
getDelegatedLoginClient
public static TeneoManagerClient getDelegatedLoginClient(String pToken, String pTeneoManagerURL, String pClientId, String pClientSecret, com.artisol.teneo.manager.api.misc.Settings pSettings) throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, IncompatibleVersionException, URISyntaxException
- Parameters:
pToken
- The delegated login tokenpTeneoManagerURL
- Teneo Manager server URLpClientId
- ClientId to be used to authenticatepClientSecret
- ClientSecret to be used to authenticatepSettings
- Settings used to create the WebTarget of the generated resource instance- Returns:
- A delegated login TeneoManagerClient
- Throws:
IncompatibleVersionException
- In case of incompatible version foundcom.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exceptions wrapped in aResourceException
URISyntaxException
- In case pTeneoManagerURL is wrong
-
getDelegatedLoginClient
public static TeneoManagerClient getDelegatedLoginClient(String pToken, String pTeneoManagerURL, String pClientId, String pClientSecret) throws com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, IncompatibleVersionException, URISyntaxException
- Parameters:
pToken
- The delegated login tokenpTeneoManagerURL
- Teneo Manager server URLpClientId
- ClientId to be used to authenticatepClientSecret
- ClientSecret to be used to authenticate- Returns:
- A delegated login TeneoManagerClient
- Throws:
IncompatibleVersionException
- In case of incompatible version foundcom.artisol.teneo.commons.utilities.api.exceptions.ResourceException
- Other kind of exceptions wrapped in aResourceException
URISyntaxException
- In case pTeneoManagerURL is wrong
-
getStatus
public Properties getStatus() throws IOException
- Returns:
- The properties shown in the status page
- Throws:
IOException
- If an I/O error occurs while reading stream
-
addPlatformProperties
public void addPlatformProperties(Properties pProperties) throws IOException
Add to the passed properties the one related to the authentication type.- Parameters:
pProperties
- Properties instance where the new property would be added- Throws:
IOException
- If an I/O error occurs while reading stream
-
isDelegated
public boolean isDelegated() throws IOException
- Returns:
- If the authentication type is delegated or not
- Throws:
IOException
- If an I/O error occurs while reading stream
-
-