AssetResourceProviderFactory.java 1.71 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.granite.comments.CommentManager
 *  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.granite.rest.assets.impl;

import com.adobe.granite.comments.CommentManager;
import com.adobe.granite.rest.ApiResourceProvider;
import com.adobe.granite.rest.ApiResourceProviderFactory;
import com.adobe.granite.rest.assets.impl.AssetResourceProvider;
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={"assets"})})
public class AssetResourceProviderFactory
implements ApiResourceProviderFactory {
    @Reference
    private CommentManager commentManager;

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

    public ApiResourceProvider getResourceProvider(String contextPath) {
        return new AssetResourceProvider(contextPath, this.commentManager);
    }

    protected void bindCommentManager(CommentManager commentManager) {
        this.commentManager = commentManager;
    }

    protected void unbindCommentManager(CommentManager commentManager) {
        if (this.commentManager == commentManager) {
            this.commentManager = null;
        }
    }
}