AEM – Fetch product info via API

Here is a code snippet that can be used to fetch AEM’s product information via APIs.

import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Modified;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.adobe.granite.license.ProductInfo;
import com.adobe.granite.license.ProductInfoProvider;

@Component(immediate = true)
public class ProductInfoImpl {
   private static final Logger LOG = LoggerFactory.getLogger(ProductInfoImpl.class);

   private ProductInfoProvider piProvider;

   protected void activate(ComponentContext cc) {
       if (piProvider != null) {
           ProductInfo pi = piProvider.getProductInfo();

           //Logging product information
 "Product name: " + pi.getName());
 "Product short name: " + pi.getShortName());
 "Product version: " + pi.getVersion());
 "Product short version: " + pi.getShortVersion());


Information printed in logs:

Product name: Adobe Experience Manager
Product short name: AEM
Product version: 6.3.0
Product short version: 6.3





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s