AbstractFeature.java 2.1 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.felix.scr.annotations.Activate
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Property
 *  org.apache.sling.commons.osgi.PropertiesUtil
 *  org.apache.sling.featureflags.Feature
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
package com.adobe.granite.frags.impl;

import java.util.Map;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.sling.commons.osgi.PropertiesUtil;
import org.apache.sling.featureflags.Feature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component(componentAbstract=1)
public abstract class AbstractFeature
implements Feature {
    @Property(label="Name", description="The name of this feature flag", value={"Name is not available"})
    public static String PROP_NAME = "feature.name";
    @Property(label="Description", description="The description of this feature flag", value={"Description is not available"})
    public static String PROP_DESCRIPTION = "feature.description";
    static final String NAME_NOT_AVAILABLE = "Name is not available";
    static final String DESCRIPTION_NOT_AVAILABLE = "Description is not available";
    protected final Logger LOGGER;
    private String name;
    private String description;

    public AbstractFeature() {
        this.LOGGER = LoggerFactory.getLogger(this.getClass());
    }

    @Activate
    protected final void activate(Map<String, Object> config) {
        this.name = PropertiesUtil.toString((Object)config.get(PROP_NAME), (String)"Name is not available");
        this.description = PropertiesUtil.toString((Object)config.get(PROP_DESCRIPTION), (String)"Description is not available");
        this.configure(config);
        this.LOGGER.info("{} activated", (Object)this);
    }

    protected void configure(Map<String, Object> config) {
    }

    public final String getName() {
        return this.name;
    }

    public final String getDescription() {
        return this.description;
    }
}