1 /* 2 * Copyright (C) The MX4J Contributors. 3 * All rights reserved. 4 * 5 * This software is distributed under the terms of the MX4J License version 1.0. 6 * See the terms of the MX4J License in the documentation provided with this software. 7 */ 8 9 package mx4j.server; 10 11 import javax.management.loading.ClassLoaderRepository; 12 13 /** 14 * Base class to extend to create custom ClassLoaderRepositories. 15 * MX4J's MBeanServer can use a custom ClassLoaderRepository instead of the default one 16 * by simply specifying a suitable system property, see {@link mx4j.MX4JSystemKeys}. 17 * It must be a class, otherwise it opens up a security hole, as anyone can cast the MBeanServer's 18 * ClassLoaderRepository down to this class and call addClassLoader or removeClassLoader 19 * since, if this class is an interface, they must be public. 20 * 21 * @version $Revision: 1.4 $ 22 */ 23 public abstract class ModifiableClassLoaderRepository implements ClassLoaderRepository 24 { 25 /** 26 * Adds, if does not already exist, the specified ClassLoader to this repository. 27 * 28 * @param cl The classloader to add 29 * @see #removeClassLoader 30 */ 31 protected abstract void addClassLoader(ClassLoader cl); 32 33 /** 34 * Removes, if exists, the specified ClassLoader from this repository. 35 * 36 * @param cl The classloader to remove 37 * @see #addClassLoader 38 */ 39 protected abstract void removeClassLoader(ClassLoader cl); 40 } 41