Class PromaManager

java.lang.Object
de.xima.fc.proma.manager.PromaManager

public final class PromaManager extends Object
This class is used to manage PROMA API instances for interacting with the PROMA API.
  • Method Details

    • createPromaApiUrl

      public static String createPromaApiUrl()
      Returns:
      The URL to the PROMA REST API, as configured for this application.
    • defaultBinaryTimeout

      public static Duration defaultBinaryTimeout()
      Returns:
      The default timeout for operations that you expect to take a "long" time, such as downloads etc. For simple requests with a small payload you should use defaultTimeout().
    • defaultBinaryTimeoutUnit

      public static TimeUnit defaultBinaryTimeoutUnit()
      Same as defaultBinaryTimeout(), but returns only the unit without the value. This is useful when you are dealing with APIs that do not accept a Duration, such as the Future API.
      Returns:
      The default timeout unit.
    • defaultBinaryTimeoutValue

      public static long defaultBinaryTimeoutValue()
      Same as defaultBinaryTimeout(), but returns only the value without units, in the unit as returned by defaultBinaryTimeoutUnit(). This is useful when you are dealing with APIs that do not accept a Duration, such as the Future API.
      Returns:
      The default timeout value.
    • defaultCombinedTimeout

      public static Duration defaultCombinedTimeout()
      Returns:
      Combined timeout for multiple plain text requests or "small" requests which you do not expect to take a long time.
    • defaultTimeout

      public static Duration defaultTimeout()
      Returns:
      The default timeout for simple operations that you do not expect to take a "long" time. For downloads etc. you should use defaultBinaryTimeout().
    • defaultTimeoutUnit

      public static TimeUnit defaultTimeoutUnit()
      Same as defaultTimeout(), but returns only the unit without the value. This is useful when you are dealing with APIs that do not accept a Duration, such as the Future API.
      Returns:
      The default timeout unit.
    • defaultTimeoutValue

      public static long defaultTimeoutValue()
      Same as defaultTimeout(), but returns only the value without units, in the unit as returned by defaultTimeoutUnit(). This is useful when you are dealing with APIs that do not accept a Duration, such as the Future API.
      Returns:
      The default timeout value.
    • init

      public static void init()
      Initializes the PROMA API.
    • isPluginStoreAvailable

      public static <R> StageChain<Boolean,R> isPluginStoreAvailable(IPublicPromaInvocationContext pc)
      Parameters:
      pc - Context for accessing the PROMA API.
      Returns:
      true when the proma rest api and the plugin store is available. false if proma or the plugin store is not available.
    • isPromaAvailable

      public static <R> StageChain<Boolean,R> isPromaAvailable(IPublicPromaInvocationContext pc)
    • isPromaConfigured

      public static boolean isPromaConfigured()
      Checks whether the license server / PROMA was configured and initialized. When this returns false, publicPromaApi(EHttpClient) should not be called,
      Returns:
      Whether PROMA was initialized and configured, e.g. whether a valid URL was set.
    • publicPromaApi

      public static de.xima.proma.restclient.pub.gen.ApiBundle publicPromaApi(EHttpClient client) throws IllegalStateException
      This method returns the ApiBundle of the cached public PROMA API.
      Parameters:
      client - The client with which the RESTEasy HTTP engine is created.
      Returns:
      cached ApiBundle of the current with current public PROMA API. Empty when e.g. no PROMA URL was configured.
      Throws:
      IllegalStateException - When init() was not called yet or the API is already shutdown(); or when PROMA was not configured.
    • shutdown

      public static void shutdown()
      Shuts down the PROMA API, closing existing bundles.