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 aTeneoManagerClientinstance and initializes it with the given access token.
Besides regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pApiToken, com.artisol.teneo.manager.api.misc.Settings pSettings)Creates aTeneoManagerClientinstance and initializes it with the given access token.
Besides regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret)Creates aTeneoManagerClientinstance and requests a client access token from the server.
Besides, regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret, com.artisol.teneo.manager.api.misc.Settings pSettings)Creates aTeneoManagerClientinstance and requests a client access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret, String pUsername, String pPassword)Creates aTeneoManagerClientinstance and requests a user access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateExceptionruntime exceptions.TeneoManagerClient(String pTeneoManagerURL, String pClientId, String pClientSecret, String pUsername, String pPassword, com.artisol.teneo.manager.api.misc.Settings pSettings)Creates aTeneoManagerClientinstance and requests a user access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime exceptions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPlatformProperties(Properties pProperties)Add to the passed properties the one related to the authentication type.voidforceRefreshTokens()Resets accessTokenTimeout and callsrefreshTokens().StringgetAccessToken()com.artisol.teneo.manager.api.resources.AdminResourcegetAdminClient()static com.artisol.teneo.manager.api.resources.AdminResourcegetAdminClient(String pTeneoManagerURL, String pAccessToken)static com.artisol.teneo.manager.api.resources.AdminResourcegetAdminClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)com.artisol.teneo.manager.api.resources.CommonResourcegetCommonClient()static com.artisol.teneo.manager.api.resources.CommonResourcegetCommonClient(String pTeneoManagerURL, String pAccessToken)static com.artisol.teneo.manager.api.resources.CommonResourcegetCommonClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)TeneoManagerClientgetDelegatedLoginClient(String pToken)static TeneoManagerClientgetDelegatedLoginClient(String pToken, String pTeneoManagerURL, String pClientId, String pClientSecret)static TeneoManagerClientgetDelegatedLoginClient(String pToken, String pTeneoManagerURL, String pClientId, String pClientSecret, com.artisol.teneo.manager.api.misc.Settings pSettings)com.artisol.teneo.manager.api.resources.DocumentationResourcegetDocumentationClient()static com.artisol.teneo.manager.api.resources.DocumentationResourcegetDocumentationClient(String pTeneoManagerURL, String pAccessToken)static com.artisol.teneo.manager.api.resources.DocumentationResourcegetDocumentationClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)com.artisol.teneo.manager.api.resources.InquireResourcegetInquireClient()static com.artisol.teneo.manager.api.resources.InquireResourcegetInquireClient(String pTeneoManagerURL, String pAccessToken)static com.artisol.teneo.manager.api.resources.InquireResourcegetInquireClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)com.artisol.teneo.manager.api.resources.OAuth2ResourcegetOAuth2Client()static com.artisol.teneo.manager.api.resources.OAuth2ResourcegetOAuth2Client(String pTeneoManagerURL, String pAccessToken)static com.artisol.teneo.manager.api.resources.OAuth2ResourcegetOAuth2Client(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)intgetRequestRetryCount()longgetRequestRetryDelay()URLgetStartDelegatedLoginUrl(String pToken)PropertiesgetStatus()com.artisol.teneo.manager.api.resources.StudioResourcegetStudioClient()static com.artisol.teneo.manager.api.resources.StudioResourcegetStudioClient(String pTeneoManagerURL, String pAccessToken)static com.artisol.teneo.manager.api.resources.StudioResourcegetStudioClient(String pTeneoManagerURL, String pAccessToken, com.artisol.teneo.manager.api.misc.Settings pSettings)booleanisDelegated()voidrevokeAccessToken()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 aTeneoManagerClientinstance and requests a client access token from the server.
Besides, regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime 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 aResourceExceptionURISyntaxException- 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 aTeneoManagerClientinstance and requests a client access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime 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 aResourceExceptionURISyntaxException- 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 aTeneoManagerClientinstance and requests a user access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateExceptionruntime 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 aResourceExceptionURISyntaxException- 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 aTeneoManagerClientinstance and requests a user access token from the server.
Besides regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime 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 aResourceExceptionURISyntaxException- In case pTeneoManagerURL is wrong
-
TeneoManagerClient
public TeneoManagerClient(String pTeneoManagerURL, String pApiToken) throws IncompatibleVersionException, com.artisol.teneo.commons.utilities.api.exceptions.ResourceException, URISyntaxException
Creates aTeneoManagerClientinstance and initializes it with the given access token.
Besides regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime 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 aResourceExceptionURISyntaxException- 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 aTeneoManagerClientinstance and initializes it with the given access token.
Besides regular checked exceptions, it can also throwIllegalStateExceptionorProcessingExceptionruntime 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 aResourceExceptionURISyntaxException- 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
OAuth2Resourceinterface - 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
OAuth2Resourceinterface - 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
OAuth2Resourceinterface - 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
AdminResourceinterface - 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
AdminResourceinterface - 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
AdminResourceinterface - 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
CommonResourceinterface - 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
CommonResourceinterface - 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
CommonResourceinterface - 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
InquireResourceinterface - 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
InquireResourceinterface - 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
InquireResourceinterface - 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
StudioResourceinterface - 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
StudioResourceinterface - 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
StudioResourceinterface - 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
DocumentationResourceinterface - 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
DocumentationResourceinterface - 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
DocumentationResourceinterface - 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.ResourceExceptionResets 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 aResourceExceptionURISyntaxException- 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 aResourceExceptionURISyntaxException- 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 aResourceExceptionURISyntaxException- 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
-
-