Class AuthleteApiFactory


  • public class AuthleteApiFactory
    extends Object
    Factory to create an AuthleteApi instance.
    Author:
    Takahiko Kawasaki
    • Method Detail

      • create

        public static AuthleteApi create​(AuthleteConfiguration configuration)
        Create an instance of AuthleteApi.

        This method repeats to call create(AuthleteConfiguration, String) until one of the known classes is successfully instantiated.

        The classes listed below are the ones that the current implementation knows for Authlete API V3.

        1. com.authlete.jaxrs.api.AuthleteApiImplV3
          (using JAX-RS 2.0 API, contained in com.authlete:authlete-java-jaxrs)

        The classes listed below are the ones that the current implementation knows for Authlete API V2.

        1. com.authlete.jaxrs.api.AuthleteApiImpl
          (using JAX-RS 2.0 API, contained in com.authlete:authlete-java-jaxrs)
        2. com.authlete.common.api.AuthleteApiImpl
          (using HttpURLConnection, contained in com.authlete:authlete-java-common since version 2.0)
        Parameters:
        configuration - Authlete configuration.
        Returns:
        An instance of AuthleteApi. If none of the known classes that implement AuthleteApi interface was successfully instantiated, null is returned.
      • getDefaultApi

        public static AuthleteApi getDefaultApi()
        Get the default instance of AuthleteApi.

        This method loads a configuration file (using AuthletePropertiesConfiguration) on the first call, creates an instance of AuthleteApi and caches the instance. The second and subsequent calls return the cached instance.

        The default name of the configuration file is authlete.properties, but it can be changed by a system property authlete.configuration.file. The current directory and the classpath are searched for the configuration file in this order.

        Returns:
        An instance of AuthleteApi.
        Since:
        1.29