ScreensResourceProviderFactory.java 2.17 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.granite.rest.ApiResourceProvider
 *  com.adobe.granite.rest.ApiResourceProviderFactory
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Properties
 *  org.apache.felix.scr.annotations.Property
 *  org.apache.felix.scr.annotations.Reference
 *  org.apache.felix.scr.annotations.Service
 */
package com.adobe.cq.screens.impl.rest;

import com.adobe.cq.screens.device.impl.DeviceService;
import com.adobe.cq.screens.device.registration.RegistrationService;
import com.adobe.cq.screens.impl.rest.ScreensResourceProvider;
import com.adobe.granite.rest.ApiResourceProvider;
import com.adobe.granite.rest.ApiResourceProviderFactory;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;

@Component
@Service
@Properties(value={@Property(name="provider.type", value={"screens"})})
public class ScreensResourceProviderFactory
implements ApiResourceProviderFactory {
    @Reference
    private DeviceService deviceService;
    @Reference
    private RegistrationService registrationService;

    public String getContextPath() {
        return "screens";
    }

    public ApiResourceProvider getResourceProvider(String contextPath) {
        return new ScreensResourceProvider(contextPath, this.deviceService, this.registrationService);
    }

    protected void bindDeviceService(DeviceService deviceService) {
        this.deviceService = deviceService;
    }

    protected void unbindDeviceService(DeviceService deviceService) {
        if (this.deviceService == deviceService) {
            this.deviceService = null;
        }
    }

    protected void bindRegistrationService(RegistrationService registrationService) {
        this.registrationService = registrationService;
    }

    protected void unbindRegistrationService(RegistrationService registrationService) {
        if (this.registrationService == registrationService) {
            this.registrationService = null;
        }
    }
}