CQProductInfoProvider.java 4.01 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.granite.license.ProductInfo
 *  com.adobe.granite.license.ProductInfoProvider
 *  org.apache.felix.scr.annotations.Activate
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Service
 *  org.apache.sling.api.resource.ValueMap
 *  org.apache.sling.api.wrappers.ValueMapDecorator
 *  org.osgi.framework.Version
 *  org.osgi.service.component.ComponentContext
 */
package com.adobe.cq.product.info.impl;

import com.adobe.granite.license.ProductInfo;
import com.adobe.granite.license.ProductInfoProvider;
import java.util.HashMap;
import java.util.Map;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.api.wrappers.ValueMapDecorator;
import org.osgi.framework.Version;
import org.osgi.service.component.ComponentContext;

@Component(metatype=0)
@Service
public class CQProductInfoProvider
implements ProductInfoProvider {
    private static final String prodName = "Adobe Experience Manager";
    private static final String prodShortName = "AEM";
    private static final String prodVersion = "6.2.0";
    private static final String prodShortVersion = "6.2";
    private static final String prodYear = "2015";
    private static final String prodUrl = "http://adobe.com/aem";
    private static final String prodVendor = "Adobe Systems Incorporated";
    private static final String prodVendorUrl = "http://www.adobe.com";
    private static final String PN_NAME = "name";
    private static final String PN_SHORT_NAME = "shortName";
    private static final String PN_VERSION = "version";
    private static final String PN_SHORT_VERSION = "shortVersion";
    private static final String PN_YEAR = "year";
    private static final String PN_URL = "url";
    private static final String PN_VENDOR = "vendor";
    private static final String PN_VENDOR_URL = "vendorUrl";
    private ProductInfo info;

    public ProductInfo getProductInfo() {
        return this.info;
    }

    @Activate
    private void activate(ComponentContext ctx) {
        if (this.info == null) {
            HashMap<String, String> props = new HashMap<String, String>();
            props.put("name", "Adobe Experience Manager");
            props.put("shortName", "AEM");
            props.put("shortVersion", "6.2");
            props.put("url", "http://adobe.com/aem");
            props.put("vendor", "Adobe Systems Incorporated");
            props.put("vendorUrl", "http://www.adobe.com");
            props.put("version", "6.2.0");
            props.put("year", "2015");
            this.info = new InfoImpl((ValueMap)new ValueMapDecorator(props));
        }
    }

    private static class InfoImpl
    implements ProductInfo {
        private final ValueMap props;

        private InfoImpl(ValueMap props) {
            this.props = props;
        }

        public String getName() {
            return (String)this.props.get("name", (Object)"");
        }

        public String getShortName() {
            return (String)this.props.get("shortName", (Object)"");
        }

        public Version getVersion() {
            String s = (String)this.props.get("version", (Object)"");
            return new Version(s.replace("SNAPSHOT.", "SNAPSHOT-"));
        }

        public String getShortVersion() {
            return (String)this.props.get("shortVersion", (Object)"");
        }

        public String getYear() {
            return (String)this.props.get("year", (Object)"");
        }

        public String getVendor() {
            return (String)this.props.get("vendor", (Object)"");
        }

        public String getVendorUrl() {
            return (String)this.props.get("vendorUrl", (Object)"");
        }

        public String getUrl() {
            return (String)this.props.get("url", (Object)"");
        }

        public ValueMap getProperties() {
            return this.props;
        }
    }

}