/*
 * Decompiled with CFR 0.152.
 */
package org.apache.logging.log4j.core.jmx;

import javax.management.ObjectName;
import org.apache.logging.log4j.core.jmx.ContextSelectorAdminMBean;
import org.apache.logging.log4j.core.jmx.Server;
import org.apache.logging.log4j.core.selector.ContextSelector;
import org.apache.logging.log4j.core.util.Assert;

public class ContextSelectorAdmin
implements ContextSelectorAdminMBean {
    private final ObjectName objectName;
    private final ContextSelector selector;

    public ContextSelectorAdmin(String contextName, ContextSelector selector) {
        this.selector = Assert.requireNonNull(selector, "ContextSelector");
        try {
            String mbeanName = String.format("org.apache.logging.log4j2:type=%s,component=ContextSelector", Server.escape(contextName));
            this.objectName = new ObjectName(mbeanName);
        }
        catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }

    public ObjectName getObjectName() {
        return this.objectName;
    }

    @Override
    public String getImplementationClassName() {
        return this.selector.getClass().getName();
    }
}
