Interface RequireAem

All Known Implementing Classes:
RequireAemModel

@ProviderType public interface RequireAem
This OSGi Service allows to distinguish between AEM Classic or AEM as a Cloud Service instance types. It can be used in two different ways:
  1. To check if AEM is running as Cloud Ready (AEM as a Cloud Service or local AEM as a Cloud Service SDK QuickStart Jar) or not by leveraging its method in code.
     @Reference
     RequireAem requireAem;
     ...
     if ((Distribution.CLOUD_READY.equals(requireAem.getDistribution()) {
         .. Do something that only works for the Cloud ..
     } else {
         .. Do something for AMS / On-Prem ..
     }
     
  2. To prevent OSGi Components from starting by using it as service reference with target (without actually leveraging it in code).
     @Component
     public class IOnlyWorkOnTheCloud implements Foo {
         @Reference(target="(distribution=cloud-ready)")
         RequireAem requireAem;
         ...
     }
     
    ... OR ...
     @Component
     public class IOnlyWorkOnAmsOrOnPrem implements Bar {
         @Reference(target="(distribution=classic)")
         RequireAem requireAem;
         ...
     }
     
  • Method Details

    • getDistribution

      RequireAem.Distribution getDistribution()
      Returns:
      the running AEM's environments distribution type.