Class DynamicMediaServicesConfigUtil

java.lang.Object
com.day.cq.dam.commons.util.DynamicMediaServicesConfigUtil

public class DynamicMediaServicesConfigUtil extends Object
Utility helper class to facilitate access to Dynamic Media services cloud configuration. There can be only a single definition of this service.
  • Constructor Details

    • DynamicMediaServicesConfigUtil

      public DynamicMediaServicesConfigUtil()
  • Method Details

    • isDynamicMediaServiceConfigured

      public static boolean isDynamicMediaServiceConfigured(ResourceResolver resolver)
      Helper method to determine if Dynamic Media Service support cloud config has been defined.
      Parameters:
      resolver - a ResourceResolver to be used for the operation
      Returns:
      Boolean indicating if Dynamic Media is enabled or not
    • isDynamicMediaServiceConfigured

      public static boolean isDynamicMediaServiceConfigured(ResourceResolver resolver, String assetPath)
      Helper method to determine if Dynamic Media Service support cloud config has been defined.
      Parameters:
      resolver - a ResourceResolver to be used for the operation
      assetPath - - optional uploaded asset path, invalid value refers to the non-tenant-aware environment
      Returns:
      Boolean indicating if Dynamic Media is enabled or not
    • getDefaultConfig

      public static DynamicMediaServicesConfig getDefaultConfig(ResourceResolver resourceResolver)
      the default definition of DynamicMediaServicesConfig
      Parameters:
      resourceResolver -
      Returns:
      DynamicMediaServicesConfig or null if it is not completely defined (includes a registration ID)
    • getDefaultConfig

      public static DynamicMediaServicesConfig getDefaultConfig(ResourceResolver resourceResolver, String assetPath)
      the default definition of DynamicMediaServicesConfig
      Parameters:
      resourceResolver -
      assetPath - - optional uploaded asset path, invalid value refers to the non-tenant-aware environment
      Returns:
      DynamicMediaServicesConfig or null if it is not completely defined (includes a registration ID)
    • getRegistrationId

      public static String getRegistrationId(ResourceResolver resourceResolver)
      Get encrypted Registration Id for the Dynamic Media service
      Parameters:
      resourceResolver -
      Returns:
      the registration Id or null if undefined This is an encrypted version of the registration
    • getRegistrationId

      public static String getRegistrationId(ResourceResolver resourceResolver, String assetPath)
      Get encrypted Registration Id for the Dynamic Media service
      Parameters:
      resourceResolver -
      assetPath - - optional uploaded asset path, invalid value refers to the non-tenant-aware environment
      Returns:
      the registration Id or null if undefined This is an encrypted version of the registration
    • getRegistrationId

      public static String getRegistrationId(Resource resource)
      Get encrypted Registration Id for the Dynamic Media service
      Parameters:
      resource -
      Returns:
      the registration Id or null if undefined This is an encrypted version of the registration
    • getRegistrationIdFromTenant

      public static String getRegistrationIdFromTenant(DynamicMediaServicesConfig config)
      Get encrypted Registration Id for the Dynamic Media service
      Parameters:
      config -
      Returns:
      the registration Id or null if undefined This is an encrypted version of the registration
    • getPublicKey

      public static String getPublicKey(ResourceResolver resourceResolver)
      The public key for the Dynamic Media service
      Parameters:
      resourceResolver -
      Returns:
      the public key proxy server or null if undefined
    • getPublicKey

      public static String getPublicKey(ResourceResolver resourceResolver, String assetPath)
      The public key for the Dynamic Media service
      Parameters:
      resourceResolver -
      assetPath - - optional uploaded asset path, invalid value refers to the non-tenant-aware environment
      Returns:
      the public key proxy server or null if undefined
    • getServiceUrl

      public static String getServiceUrl(ResourceResolver resourceResolver)
      The service url for the Dynamic Media pr0xy service
      Parameters:
      resourceResolver -
      Returns:
      the service url or null if none exists
    • getServiceUrl

      public static String getServiceUrl(ResourceResolver resourceResolver, String assetPath)
      The service url for the Dynamic Media pr0xy service
      Parameters:
      resourceResolver -
      assetPath - - optional uploaded asset path, invalid value refers to the non-tenant-aware environment
      Returns:
      the service url or null if none exists
    • getServiceUrl

      public static String getServiceUrl(Resource resource)
      The service url for the Dynamic Media pr0xy service
      Parameters:
      resource -
      Returns:
      the service url or null if none exists
    • getServiceUrlFromTenant

      public static String getServiceUrlFromTenant(DynamicMediaServicesConfig config)
      The service url for the Dynamic Media pr0xy service
      Parameters:
      config -
      Returns:
      the service url or null if none exists
    • getDefaultConfigForTenant

      public static DynamicMediaServicesConfig getDefaultConfigForTenant(ResourceResolver resourceResolver, String tenantId)
      the default definition of DynamicMediaServicesConfig
      Parameters:
      resourceResolver -
      tenantId - - gets the tenantId of the loggedIn tenant user
      Returns:
      DynamicMediaServicesConfig or null if it is not completely defined (includes a registration ID)
    • getImageServiceUrl

      public static String getImageServiceUrl(ResourceResolver resourceResolver)
      The image service url for the Dynamic Media image delivery
      Parameters:
      resourceResolver - Resource resolver
      Returns:
      the service url or empty if none exists
    • getImageServiceUrl

      public static String getImageServiceUrl(ResourceResolver resourceResolver, String assetPath)
      The image service url for the Dynamic Media image delivery
      Parameters:
      resourceResolver - Resource resolver
      assetPath - - optional uploaded asset path, invalid value refers to the non-tenant-aware environment
      Returns:
      the service url or empty if none exists