SyncAgentImpl.java 1.62 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.cq.dam.mac.sync.impl;

import com.adobe.cq.dam.mac.sync.api.SyncAgent;

public class SyncAgentImpl
implements SyncAgent {
    private String name;
    private String type;
    private String protocolHTTPMethod;
    private String slingResourceType;
    private String cqTemplate;

    public SyncAgentImpl(String type, String httpMethod, String slingResourceType, String cqTemplate) {
        this.type = type;
        this.protocolHTTPMethod = httpMethod;
        this.slingResourceType = slingResourceType;
        this.cqTemplate = cqTemplate;
        this.name = "MAC Sync Replication Agent " + this.type;
    }

    public SyncAgentImpl(String type, String httpMethod, String slingResourceType, String cqTemplate, String nameHint) {
        this.type = type;
        this.protocolHTTPMethod = httpMethod;
        this.slingResourceType = slingResourceType;
        this.cqTemplate = cqTemplate;
        this.name = nameHint + " " + this.type;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public String getType() {
        return this.type;
    }

    @Override
    public String getProtocolHTTPMethod() {
        return this.protocolHTTPMethod;
    }

    @Override
    public String getSlingResourceType() {
        return this.slingResourceType;
    }

    @Override
    public String getCqTemplate() {
        return this.cqTemplate;
    }

    @Override
    public String getAgentNameForTenant(String tenant) {
        String agentName = this.getName() + " " + tenant;
        return agentName.replaceAll(" ", "_").toLowerCase();
    }
}