Package de.xima.fc.proma.manager
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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
createPromaApiUrl()
static Duration
defaultBinaryTimeout()
static TimeUnit
defaultBinaryTimeoutUnit()
Same asdefaultBinaryTimeout()
, but returns only the unit without the value.static long
defaultBinaryTimeoutValue()
Same asdefaultBinaryTimeout()
, but returns only the value without units, in the unit as returned bydefaultBinaryTimeoutUnit()
.static Duration
defaultCombinedTimeout()
static Duration
defaultTimeout()
static TimeUnit
defaultTimeoutUnit()
Same asdefaultTimeout()
, but returns only the unit without the value.static long
defaultTimeoutValue()
Same asdefaultTimeout()
, but returns only the value without units, in the unit as returned bydefaultTimeoutUnit()
.static void
init()
Initializes the PROMA API.static <R> StageChain<Boolean,R>
isPluginStoreAvailable(IPublicPromaInvocationContext pc)
static <R> StageChain<Boolean,R>
isPromaAvailable(IPublicPromaInvocationContext pc)
static boolean
isPromaConfigured()
Checks whether the license server / PROMA was configured and initialized.static de.xima.proma.restclient.pub.gen.ApiBundle
publicPromaApi(EHttpClient client)
This method returns theApiBundle
of the cached public PROMA API.static void
shutdown()
Shuts down the PROMA API, closing existing bundles.
-
-
-
Method Detail
-
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 asdefaultBinaryTimeout()
, but returns only the unit without the value. This is useful when you are dealing with APIs that do not accept aDuration
, such as theFuture
API.- Returns:
- The default timeout unit.
-
defaultBinaryTimeoutValue
public static long defaultBinaryTimeoutValue()
Same asdefaultBinaryTimeout()
, but returns only the value without units, in the unit as returned bydefaultBinaryTimeoutUnit()
. This is useful when you are dealing with APIs that do not accept aDuration
, such as theFuture
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 asdefaultTimeout()
, but returns only the unit without the value. This is useful when you are dealing with APIs that do not accept aDuration
, such as theFuture
API.- Returns:
- The default timeout unit.
-
defaultTimeoutValue
public static long defaultTimeoutValue()
Same asdefaultTimeout()
, but returns only the value without units, in the unit as returned bydefaultTimeoutUnit()
. This is useful when you are dealing with APIs that do not accept aDuration
, such as theFuture
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 returnsfalse
,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 theApiBundle
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
- Wheninit()
was not called yet or the API is alreadyshutdown()
; or whenPROMA was not configured
.
-
shutdown
public static void shutdown()
Shuts down the PROMA API, closing existing bundles.
-
-