001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache license, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the license for the specific language governing permissions and
015 * limitations under the license.
016 */
017 package org.apache.logging.log4j.core.jmx;
018
019 /**
020 * The MBean interface for monitoring and managing the {@code ContextSelector}.
021 */
022 public interface ContextSelectorAdminMBean {
023 /**
024 * ObjectName pattern ({@value}) for ContextSelectorAdmin MBeans.
025 * This pattern contains a variable, which is the name of the logger context.
026 * <p>
027 * You can find all registered ContextSelectorAdmin MBeans like this:
028 * </p>
029 * <pre>
030 * MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
031 * String pattern = String.format(ContextSelectorAdminMBean.PATTERN, "*");
032 * Set<ObjectName> contextSelectorNames = mbs.queryNames(new ObjectName(pattern), null);
033 * </pre>
034 * <p>
035 * Some characters are not allowed in ObjectNames. The logger context name
036 * may be quoted. When ContextSelectorAdmin MBeans are
037 * registered, their ObjectNames are created using this pattern as follows:
038 * </p>
039 * <pre>
040 * String ctxName = Server.escape(loggerContext.getName());
041 * String name = String.format(PATTERN, ctxName);
042 * ObjectName objectName = new ObjectName(name);
043 * </pre>
044 * @see Server#escape(String)
045 */
046 String PATTERN = Server.DOMAIN + ":type=%s,component=ContextSelector";
047
048 /**
049 * Returns the name of the class implementing the {@code ContextSelector}
050 * interface.
051 *
052 * @return the name of the {@code ContextSelector} implementation class.
053 */
054 String getImplementationClassName();
055 }