Bootstrapper.java 1.79 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Reference
 *  org.apache.felix.scr.annotations.Service
 *  org.apache.sling.settings.SlingSettingsService
 *  org.osgi.service.component.ComponentContext
 */
package com.adobe.aem.formsndocuments.bootstrap;

import com.adobe.aem.formsndocuments.util.SettingsHolder;
import java.util.Set;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.settings.SlingSettingsService;
import org.osgi.service.component.ComponentContext;

@Component(immediate=1)
@Service(value={Bootstrapper.class})
public class Bootstrapper {
    @Reference(referenceInterface=SlingSettingsService.class)
    private SlingSettingsService slingSettingsService;

    protected void activate(ComponentContext componentContext) {
        if (SettingsHolder.getInstance().getLcInstance() == null) {
            SettingsHolder.getInstance().setLcInstance(this.slingSettingsService.getRunModes().contains("livecycle"));
        }
        if (SettingsHolder.getInstance().isAuthorInstance() == null) {
            SettingsHolder.getInstance().setAuthorInstance(this.slingSettingsService.getRunModes().contains("author"));
        }
    }

    protected void deactivate(ComponentContext componentContext) {
    }

    protected void bindSlingSettingsService(SlingSettingsService slingSettingsService) {
        this.slingSettingsService = slingSettingsService;
    }

    protected void unbindSlingSettingsService(SlingSettingsService slingSettingsService) {
        if (this.slingSettingsService == slingSettingsService) {
            this.slingSettingsService = null;
        }
    }
}