SyncAgentFactoryImpl.java 2.19 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Service
 */
package com.adobe.cq.dam.mac.sync.impl;

import com.adobe.cq.dam.mac.sync.api.SyncAgent;
import com.adobe.cq.dam.mac.sync.api.SyncAgentFactory;
import com.adobe.cq.dam.mac.sync.impl.SyncAgentImpl;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;

@Component(metatype=0)
@Service(value={SyncAgentFactory.class})
public class SyncAgentFactoryImpl
implements SyncAgentFactory {
    @Override
    public SyncAgent getSyncAgent(String type) {
        if (type == null) {
            throw new IllegalArgumentException("Type can not be null");
        }
        if ("Outbox".equals(type)) {
            return new SyncAgentImpl(type, null, "cq/replication/components/agent", "/libs/cq/replication/templates/agent");
        }
        if ("Reverse".equals(type)) {
            return new SyncAgentImpl(type, "GET", "cq/replication/components/revagent", "/libs/cq/replication/templates/revagent");
        }
        if ("Default".equals(type)) {
            return new SyncAgentImpl(type, "POST", "cq/replication/components/agent", "/libs/cq/replication/templates/agent");
        }
        throw new IllegalArgumentException("Type " + type + " is not a recognized type");
    }

    @Override
    public SyncAgent getSyncAgent(String type, String nameHint) {
        if (type == null) {
            throw new IllegalArgumentException("Type can not be null");
        }
        if ("Outbox".equals(type)) {
            return new SyncAgentImpl(type, null, "cq/replication/components/agent", "/libs/cq/replication/templates/agent", nameHint);
        }
        if ("Reverse".equals(type)) {
            return new SyncAgentImpl(type, "GET", "cq/replication/components/revagent", "/libs/cq/replication/templates/revagent", nameHint);
        }
        if ("Default".equals(type)) {
            return new SyncAgentImpl(type, "POST", "cq/replication/components/agent", "/libs/cq/replication/templates/agent", nameHint);
        }
        throw new IllegalArgumentException("Type " + type + " is not a recognized type");
    }
}