Example usage for org.apache.commons.discovery.tools DiscoverClass newInstance

List of usage examples for org.apache.commons.discovery.tools DiscoverClass newInstance

Introduction

In this page you can find the example usage for org.apache.commons.discovery.tools DiscoverClass newInstance.

Prototype

public static Object newInstance(ClassLoaders loaders, SPInterface spi, PropertiesHolder properties,
        DefaultClassHolder defaultImpl) throws DiscoveryException, InstantiationException,
        IllegalAccessException, NoSuchMethodException, InvocationTargetException 

Source Link

Document

Create new instance of class implementing SPI.

Usage

From source file:org.apache.axis.AxisProperties.java

/**
 * !WARNING!//from ww  w .j a v  a2  s  .  c om
 * SECURITY issue.
 *
 * See bug 11874
 *
 * The solution to both is to move doPrivilege UP within AXIS to a
 * class that is either private (cannot be reached by code outside
 * AXIS) or that represents a secure public interface...
 *
 * This is going to require analysis and (probably) rearchitecting.
 * So, I'm taking taking the easy way out until we are at a point
 * where we can reasonably rearchitect for security.
 */
private static Object newInstance(final SPInterface spi, final DefaultClassHolder defaultClass) {
    return AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            try {
                return DiscoverClass.newInstance(null, spi, (PropertiesHolder) null, defaultClass);
            } catch (Exception e) {
                log.error(Messages.getMessage("exception00"), e);
            }
            return null;
        }
    });
}