ResourceReaderImpl.java 1.55 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.repository.bindings.ResourceRepository
 *  com.adobe.repository.infomodel.bean.Resource
 *  com.adobe.repository.infomodel.bean.ResourceContent
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Reference
 *  org.apache.felix.scr.annotations.Service
 */
package com.adobe.aemds.connector.repository.impl;

import com.adobe.aemds.connector.repository.Resource;
import com.adobe.aemds.connector.repository.ResourceReader;
import com.adobe.aemds.connector.repository.impl.ResourceImpl;
import com.adobe.repository.bindings.ResourceRepository;
import com.adobe.repository.infomodel.bean.ResourceContent;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;

@Service(value={ResourceReader.class})
@Component(immediate=1)
public class ResourceReaderImpl
implements ResourceReader {
    @Reference
    ResourceRepository resourceRepository;

    public Resource readResource(String resourcePath) throws Exception {
        return new ResourceImpl(this.resourceRepository.readResource(resourcePath).getContent());
    }

    protected void bindResourceRepository(ResourceRepository resourceRepository) {
        this.resourceRepository = resourceRepository;
    }

    protected void unbindResourceRepository(ResourceRepository resourceRepository) {
        if (this.resourceRepository == resourceRepository) {
            this.resourceRepository = null;
        }
    }
}