package org.apache.logging.log4j.core.jmx;

import javax.management.ObjectName;
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 = (ContextSelector)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 var4) {
         throw new IllegalStateException(var4);
      }
   }

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

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