sleeproviderfactory.java

来自「jainslee1.0 源代码」· Java 代码 · 共 58 行

JAVA
58 行
字号
package javax.slee.management;/** * The <code>SleeProviderFactory</code> provides a static factory method for * instantiating {@link SleeProvider} peer classes.  The peer class provides * a management client with enough information to begin interacting with a * particular vendor's SLEE management subsystem.  Every SLEE vendor must provide * an implementation of the <code>SleeProvider</code> interface (a peer class) * and document the its fully-qualifed class name. */public final class SleeProviderFactory {    /**     * Get an instance of a <code>SleeProvider</code> peer class.  This method is     * equivalent to {@link #getSleeProvider(String, ClassLoader) getSleeProvider(peerClassName,     * SleeProviderFactory.class.getClassLoader())}.  In the case where the     * SleeProviderFactory's class loader is <code>null</code>,     * <code>ClassLoader.getSystemClassLoader()</code> is used instead.     * @param peerClassName the fully-qualified class name of a class that     *        implements the <code>SleeProvider</code> interface.     * @return an instance of the specified class.     * @throws NullPointerException if <code>peerClassName</code> is <code>null</code>.     * @throws PeerUnavailableException if the peer class could not be instantiated     *        or did not implement the <code>SleeProvider</code> interface.     */    public static SleeProvider getSleeProvider(String peerClassName) throws NullPointerException, PeerUnavailableException {        ClassLoader classloader = SleeProviderFactory.class.getClassLoader();        if (classloader == null) classloader = ClassLoader.getSystemClassLoader();        return getSleeProvider(peerClassName, classloader);    }    /**     * Get an instance of a <code>SleeProvider</code> peer class using the specified     * class loader.     * @param peerClassName the fully-qualified class name of a class that     *        implements the <code>SleeProvider</code> interface.     * @param classloader the classloader to use to load the peer class.     * @return an instance of the specified class.     * @throws NullPointerException if <code>peerClassName</code> or <code>classloader</code>     *         is <code>null</code>.     * @throws PeerUnavailableException if the peer class could not be instantiated     *        or did not implement the <code>SleeProvider</code> interface.     */    public static SleeProvider getSleeProvider(String peerClassName, ClassLoader classloader) throws NullPointerException, PeerUnavailableException {        if (peerClassName == null) throw new NullPointerException("peerClassName is null");        if (peerClassName.length() == 0) throw new PeerUnavailableException("peerClassName is zero-length");        try {            return (SleeProvider)classloader.loadClass(peerClassName).newInstance();        }        catch (Throwable t) {            throw new PeerUnavailableException("Peer class could not be instantiated", t);        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?