Class 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 Detail

      • TeneoManagerClient

        public TeneoManagerClient​(String pTeneoManagerURL,
                                  String pClientId,
                                  String pClientSecret)
                           throws IncompatibleVersionException,
                                  com.artisol.teneo.commons.utilities.api.exceptions.ResourceException,
                                  URISyntaxException
        Creates a TeneoManagerClient instance and requests a client access token from the server.
        Besides, regular checked exceptions, it can also throw IllegalStateException or ProcessingException runtime exceptions.
        Parameters:
        pTeneoManagerURL - Teneo Manager server URL
        pClientId - ClientId to be used to authenticate
        pClientSecret - ClientSecret to be used to authenticate
        Throws:
        IncompatibleVersionException - In case of incompatible version found
        com.artisol.teneo.commons.utilities.api.exceptions.ResourceException - Other kind of exceptions wrapped in a ResourceException
        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 a TeneoManagerClient instance and requests a client access token from the server.
        Besides regular checked exceptions, it can also throw IllegalStateException or ProcessingException runtime exceptions.
        Parameters:
        pTeneoManagerURL - Teneo Manager server URL
        pClientId - ClientId to be used to authenticate
        pClientSecret - ClientSecret to be used to authenticate
        pSettings - Settings used to create ManagerClient
        Throws:
        IncompatibleVersionException - In case of incompatible version found
        com.artisol.teneo.commons.utilities.api.exceptions.ResourceException - Other kind of exceptions wrapped in a ResourceException
        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 a TeneoManagerClient instance and requests a user access token from the server.
        Besides regular checked exceptions, it can also throw IllegalStateException runtime exceptions.
        Parameters:
        pTeneoManagerURL - Teneo Manager server URL
        pClientId - ClientId to be used to authenticate
        pClientSecret - ClientSecret to be used to authenticate
        pUsername - Username to be used to authenticate
        pPassword - User password to be used to authenticate
        Throws:
        IncompatibleVersionException - In case of incompatible version found
        com.artisol.teneo.commons.utilities.api.exceptions.ResourceException - Other kind of exceptions wrapped in a ResourceException
        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 a TeneoManagerClient instance and requests a user access token from the server.
        Besides regular checked exceptions, it can also throw IllegalStateException or ProcessingException runtime exceptions.
        Parameters:
        pTeneoManagerURL - Teneo Manager server URL
        pClientId - ClientId to be used to authenticate
        pClientSecret - ClientSecret to be used to authenticate
        pUsername - Username to be used to authenticate
        pPassword - User password to be used to authenticate
        pSettings - Settings used to create ManagerClient
        Throws:
        IncompatibleVersionException - In case of incompatible version found
        com.artisol.teneo.commons.utilities.api.exceptions.ResourceException - Other kind of exceptions wrapped in a ResourceException
        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 a TeneoManagerClient instance and initializes it with the given access token.
        Besides regular checked exceptions, it can also throw IllegalStateException or ProcessingException runtime exceptions.
        Parameters:
        pTeneoManagerURL - Teneo Manager server URL
        pApiToken - A valid apiToken to be used as accessToken
        Throws:
        IncompatibleVersionException - In case of incompatible version found
        com.artisol.teneo.commons.utilities.api.exceptions.ResourceException - Other kind of exceptions wrapped in a ResourceException
        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 a TeneoManagerClient instance and initializes it with the given access token.
        Besides regular checked exceptions, it can also throw IllegalStateException or ProcessingException runtime exceptions.
        Parameters:
        pTeneoManagerURL - Teneo Manager server URL
        pApiToken - A valid apiToken to be used as accessToken
        pSettings - Settings used to create ManagerClient
        Throws:
        IncompatibleVersionException - In case of incompatible version found
        com.artisol.teneo.commons.utilities.api.exceptions.ResourceException - Other kind of exceptions wrapped in a ResourceException
        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 URL
        pAccessToken - 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 URL
        pAccessToken - Access_token string
        pSettings - 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 URL
        pAccessToken - 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 URL
        pAccessToken - Access_token string
        pSettings - 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 URL
        pAccessToken - 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 URL
        pAccessToken - Access_token string
        pSettings - 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 URL
        pAccessToken - 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 URL
        pAccessToken - Access_token string
        pSettings - 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 URL
        pAccessToken - 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 URL
        pAccessToken - Access_token string
        pSettings - 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 URL
        pAccessToken - 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 URL
        pAccessToken - Access_token string
        pSettings - 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 calls refreshTokens().
        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 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 token
        pTeneoManagerURL - Teneo Manager server URL
        pClientId - ClientId to be used to authenticate
        pClientSecret - ClientSecret to be used to authenticate
        pSettings - Settings used to create the WebTarget of the generated resource instance
        Returns:
        A delegated login TeneoManagerClient
        Throws:
        IncompatibleVersionException - In case of incompatible version found
        com.artisol.teneo.commons.utilities.api.exceptions.ResourceException - Other kind of exceptions wrapped in a ResourceException
        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 token
        pTeneoManagerURL - Teneo Manager server URL
        pClientId - ClientId to be used to authenticate
        pClientSecret - ClientSecret to be used to authenticate
        Returns:
        A delegated login TeneoManagerClient
        Throws:
        IncompatibleVersionException - In case of incompatible version found
        com.artisol.teneo.commons.utilities.api.exceptions.ResourceException - Other kind of exceptions wrapped in a ResourceException
        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