Class PluginUtils

java.lang.Object
org.restheart.utils.PluginUtils

public class PluginUtils extends Object
Author:
Andrea Di Cesare <andrea@softinstigate.com>
  • Constructor Details

    • PluginUtils

      public PluginUtils()
  • Method Details

    • interceptPoint

      public static InterceptPoint interceptPoint(Interceptor interceptor)
      Parameters:
      interceptor -
      Returns:
      the interceptPoint as defined by the @RegisterPlugin annotation if annotated or the value of the field interceptPoint if exists
    • requiredinterceptor

      public static Boolean requiredinterceptor(Interceptor interceptor)
      Parameters:
      interceptor -
      Returns:
      the requiredinterceptor as defined by the @RegisterPlugin annotation
    • initPoint

      public static InitPoint initPoint(Initializer initializer)
    • requiresContent

      public static boolean requiresContent(Interceptor<? extends Request<?>,? extends Response<?>> interceptor)
    • name

      public static String name(Plugin plugin)
      Parameters:
      plugin -
      Returns:
      the plugin name
    • defaultURI

      public static String defaultURI(Service service)
      Parameters:
      service -
      Returns:
      the service default URI. If not explicitly set via defaulUri attribute, it is /[service-name]
    • uriMatchPolicy

      public static RegisterPlugin.MATCH_POLICY uriMatchPolicy(Service service)
      Parameters:
      service -
      Returns:
      uri match policy.
    • defaultURI

      public static <P extends Service> String defaultURI(Class<P> serviceClass)
      Type Parameters:
      P -
      Parameters:
      serviceClass -
      Returns:
      the service default URI. If not explicitly set via defaulUri attribute, it is /[service-name]
    • actualUri

      public static <P extends Service> String actualUri(Map<String,Object> conf, Class<P> serviceClass)
      Type Parameters:
      P -
      Parameters:
      conf - the plugin configuration got from @Inject("conf")
      serviceClass - the class of the service
      Returns:
      the actual service uri set in cofiguration or the defaultURI
    • dontIntercept

      public static InterceptPoint[] dontIntercept(Service service)
      Parameters:
      service -
      Returns:
      the intercept points of interceptors that must not be executed on requests handled by service
    • authorizerType

      public static Authorizer.TYPE authorizerType(Authorizer authorizer)
      Parameters:
      authorizer -
      Returns:
      the Authorizer type
    • blocking

      public static boolean blocking(Service<?,?> service)
    • handlingService

      public static Service<?,?> handlingService(PluginsRegistry registry, io.undertow.server.HttpServerExchange exchange)
      Parameters:
      registry -
      exchange -
      Returns:
      the service handling the exchange or null if the request is not handled by a service
    • handlingServicePluginRecord

      public static PluginRecord<Service<?,?>> handlingServicePluginRecord(PluginsRegistry registry, io.undertow.server.HttpServerExchange exchange)
      Parameters:
      registry -
      exchange -
      Returns:
      the plugin record of the service handling the exchange or null if the request is not handled by a service
    • dontIntercept

      public static InterceptPoint[] dontIntercept(PluginsRegistry registry, io.undertow.server.HttpServerExchange exchange)
      Parameters:
      registry -
      exchange -
      Returns:
      the intercept points of interceptors that must not be executed on the exchange
    • cachedRequestType

      public static Type cachedRequestType(ExchangeTypeResolver plugin)
      Plugin.requestType() is heavy. This helper methods speeds up invocation using a cache
      Parameters:
      plugin -
      Returns:
    • cachedResponseType

      public static Type cachedResponseType(ExchangeTypeResolver plugin)
      Plugin.responseType() is heavy. This helper methods speeds up invocation using a cache
      Parameters:
      plugin -
      Returns: