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)
@Service(ProductInfoImpl.class)
public class ProductInfoImpl {
private static final Logger LOG = LoggerFactory.getLogger(ProductInfoImpl.class);
@Reference
private ProductInfoProvider piProvider;
@Activate
@Modified
protected void activate(ComponentContext cc) {
if (piProvider != null) {
ProductInfo pi = piProvider.getProductInfo();
//Logging product information
LOG.info("Product name: " + pi.getName());
LOG.info("Product short name: " + pi.getShortName());
LOG.info("Product version: " + pi.getVersion());
LOG.info("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
No comments:
Post a Comment
If you have any doubts or questions, please let us know.