RetreiveImplementationsImpl.java 3.33 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.ReferenceCardinality
 *  org.apache.felix.scr.annotations.ReferencePolicy
 *  org.apache.felix.scr.annotations.References
 *  org.apache.felix.scr.annotations.Service
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
package com.adobe.aemfd.watchfolder.serviceImpls;

import com.adobe.aemfd.watchfolder.service.api.ContentProcessor;
import com.adobe.aemfd.watchfolder.service.api.RetreiveImplementations;
import com.adobe.aemfd.watchfolder.workflow.api.payload.PayloadMapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.ReferencePolicy;
import org.apache.felix.scr.annotations.References;
import org.apache.felix.scr.annotations.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/*
 * This class specifies class file version 49.0 but uses Java 6 signatures.  Assumed Java 6.
 */
@Service
@Component
@References(value={@Reference(name="ContentProcessor", cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE, policy=ReferencePolicy.DYNAMIC, referenceInterface=ContentProcessor.class, bind="bindContentProcessor", unbind="unbindContentProcessor"), @Reference(name="PayloadMapper", cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE, policy=ReferencePolicy.DYNAMIC, referenceInterface=PayloadMapper.class, bind="bindPayloadMapper", unbind="unbindPayloadMapper")})
public class RetreiveImplementationsImpl
implements RetreiveImplementations {
    private static final Logger logger = LoggerFactory.getLogger(RetreiveImplementationsImpl.class);
    protected List<ContentProcessor> contentProcessorList = new CopyOnWriteArrayList<ContentProcessor>();
    protected List<PayloadMapper> payloadMapperList = new CopyOnWriteArrayList<PayloadMapper>();

    public void bindContentProcessor(ContentProcessor contentProcessor) {
        this.contentProcessorList.add(contentProcessor);
    }

    public void unbindContentProcessor(ContentProcessor contentProcessor) {
        this.contentProcessorList.remove(contentProcessor);
    }

    public void bindPayloadMapper(PayloadMapper payloadMapper) {
        this.payloadMapperList.add(payloadMapper);
    }

    public void unbindPayloadMapper(PayloadMapper payloadMapper) {
        this.payloadMapperList.remove(payloadMapper);
    }

    @Override
    public Map<String, Object> getContentProcessorImplsList() {
        HashMap<String, Object> implMap = new HashMap<String, Object>();
        for (ContentProcessor contentProcessor : this.contentProcessorList) {
            implMap.put(contentProcessor.getClass().getName(), contentProcessor.getClass().getName());
        }
        return implMap;
    }

    @Override
    public Map<String, Object> getPayloadMapperImplsList() {
        HashMap<String, Object> implMap = new HashMap<String, Object>();
        for (PayloadMapper payloadMapper : this.payloadMapperList) {
            implMap.put(payloadMapper.getClass().getName(), payloadMapper.getClass().getName());
        }
        return implMap;
    }
}