public static Object newInstance(Class spiClass, Class defaultClass) { return newInstance(new SPInterface(spiClass), new DefaultClassHolder(defaultClass)); }
public static Object newInstance(Class spiClass, Class defaultClass) { return newInstance(new SPInterface(spiClass), new DefaultClassHolder(defaultClass)); }
public static Object newInstance(Class spiClass, Class defaultClass) { return newInstance(new SPInterface(spiClass), new DefaultClassHolder(defaultClass)); }
/** * Find implementation of SPI. * * @param <T> Service Provider Interface type * * @param spiClass Service Provider Interface Class. * * @param defaultImpl Default implementation. * * @return Instance of a class implementing the SPI. * * @exception DiscoveryException Thrown if the name of a class implementing * the SPI cannot be found, if the class cannot be loaded and * instantiated, or if the resulting class does not implement * (or extend) the SPI. */ public static <T> T find(Class<T> spiClass, String defaultImpl) throws DiscoveryException { return find(null, new SPInterface<T>(spiClass), DiscoverClass.nullProperties, new DefaultClassHolder<T>(defaultImpl)); }
private static synchronized WSAG4JConfigurationEnvironment getEnvironment() { SimpleLog.setLevel( SimpleLog.LOG_LEVEL_INFO ); if ( instance == null ) { SPInterface mssConfigSP = getWSAG4JSPI(); PropertiesHolder pHolder = new PropertiesHolder( WSAG4JEnvironment.DEFAULT_CONFIGURATION_FILE ); DefaultClassHolder cHolder = new DefaultClassHolder( WSAG4JEnvironment.class.getName() ); instance = (WSAG4JConfigurationEnvironment) DiscoverSingleton.find( null, mssConfigSP, pHolder, cHolder ); } return instance; }
/** * Find class implementing SPI. * * @param <T> The SPI type * @param <S> Any class extending T * @param spiClass Service Provider Interface Class. * @param defaultImpl Default implementation name. * @return Class implementing the SPI. * @exception DiscoveryException Thrown if the name of a class implementing * the SPI cannot be found, if the class cannot be loaded, or if * the resulting class does not implement (or extend) the SPI. */ public <T, S extends T> Class<S> find(Class<T> spiClass, String defaultImpl) throws DiscoveryException { return find(getClassLoaders(spiClass), new SPInterface<T>(spiClass), nullProperties, new DefaultClassHolder<T>(defaultImpl)); }
/** * Create new instance of class implementing SPI. * * @param <T> The SPI type * @param spiClass Service Provider Interface Class. * @param defaultImpl Default implementation. * @return Instance of a class implementing the SPI. * @exception DiscoveryException Thrown if the name of a class implementing * the SPI cannot be found, if the class cannot be loaded and * instantiated, or if the resulting class does not implement * (or extend) the SPI. * @throws InstantiationException see {@link Class#newInstance()} * @throws IllegalAccessException see {@link Class#newInstance()} * @throws NoSuchMethodException see {@link Class#newInstance()} * @throws InvocationTargetException see {@link Class#newInstance()} */ public <T> T newInstance(Class<T> spiClass, String defaultImpl) throws DiscoveryException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { return newInstance(getClassLoaders(spiClass), new SPInterface<T>(spiClass), nullProperties, new DefaultClassHolder<T>(defaultImpl)); }
/** * Find implementation of SPI. * * @param <T> Service Provider Interface type * * @param spiClass Service Provider Interface Class. * * @param propertiesFileName Used to determine name of SPI implementation, * and passed to implementation.init() method if * implementation implements Service interface. * * @param defaultImpl Default implementation. * * @return Instance of a class implementing the SPI. * * @exception DiscoveryException Thrown if the name of a class implementing * the SPI cannot be found, if the class cannot be loaded and * instantiated, or if the resulting class does not implement * (or extend) the SPI. */ public static <T> T find(Class<T> spiClass, String propertiesFileName, String defaultImpl) throws DiscoveryException { return find(null, new SPInterface<T>(spiClass), new PropertiesHolder(propertiesFileName), new DefaultClassHolder<T>(defaultImpl)); }
/** * Find implementation of SPI. * * @param <T> Service Provider Interface type * * @param spiClass Service Provider Interface Class. * * @param properties Used to determine name of SPI implementation, * and passed to implementation.init() method if * implementation implements Service interface. * * @param defaultImpl Default implementation. * * @return Instance of a class implementing the SPI. * * @exception DiscoveryException Thrown if the name of a class implementing * the SPI cannot be found, if the class cannot be loaded and * instantiated, or if the resulting class does not implement * (or extend) the SPI. */ public static <T> T find(Class<T> spiClass, Properties properties, String defaultImpl) throws DiscoveryException { return find(null, new SPInterface<T>(spiClass), new PropertiesHolder(properties), new DefaultClassHolder<T>(defaultImpl)); }
/** * Find class implementing SPI. * * @param <T> The SPI type * @param <S> Any class extending T * @param spiClass Service Provider Interface Class. * @param properties Used to determine name of SPI implementation,. * @param defaultImpl Default implementation class. * @return Class implementing the SPI. * @exception DiscoveryException Thrown if the name of a class implementing * the SPI cannot be found, if the class cannot be loaded, or if * the resulting class does not implement (or extend) the SPI. */ public <T, S extends T> Class<S> find(Class<T> spiClass, Properties properties, String defaultImpl) throws DiscoveryException { return find(getClassLoaders(spiClass), new SPInterface<T>(spiClass), new PropertiesHolder(properties), new DefaultClassHolder<T>(defaultImpl)); }
/** * Find class implementing SPI. * * @param <T> The SPI type * @param <S> Any class extending T * @param spiClass Service Provider Interface Class. * @param propertiesFileName Used to determine name of SPI implementation,. * @param defaultImpl Default implementation class. * @return Class implementing the SPI. * @exception DiscoveryException Thrown if the name of a class implementing * the SPI cannot be found, if the class cannot be loaded, or if * the resulting class does not implement (or extend) the SPI. */ public <T, S extends T> Class<S> find(Class<T> spiClass, String propertiesFileName, String defaultImpl) throws DiscoveryException { return find(getClassLoaders(spiClass), new SPInterface<T>(spiClass), new PropertiesHolder(propertiesFileName), new DefaultClassHolder<T>(defaultImpl)); }
/** * Create new instance of class implementing SPI. * * @param <T> The SPI type * @param spiClass Service Provider Interface Class. * @param properties Used to determine name of SPI implementation, * and passed to implementation.init() method if * implementation implements Service interface. * @param defaultImpl Default implementation. * @return Instance of a class implementing the SPI. * @exception DiscoveryException Thrown if the name of a class implementing * the SPI cannot be found, if the class cannot be loaded and * instantiated, or if the resulting class does not implement * (or extend) the SPI. * @throws InstantiationException see {@link Class#newInstance()} * @throws IllegalAccessException see {@link Class#newInstance()} * @throws NoSuchMethodException see {@link Class#newInstance()} * @throws InvocationTargetException see {@link Class#newInstance()} */ public <T> T newInstance(Class<T> spiClass, Properties properties, String defaultImpl) throws DiscoveryException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { return newInstance(getClassLoaders(spiClass), new SPInterface<T>(spiClass), new PropertiesHolder(properties), new DefaultClassHolder<T>(defaultImpl)); }
/** * Create new instance of class implementing SPI. * * @param <T> The SPI type * @param spiClass Service Provider Interface Class. * @param propertiesFileName Used to determine name of SPI implementation, * and passed to implementation.init() method if * implementation implements Service interface. * @param defaultImpl Default implementation. * @return Instance of a class implementing the SPI. * @exception DiscoveryException Thrown if the name of a class implementing * the SPI cannot be found, if the class cannot be loaded and * instantiated, or if the resulting class does not implement * (or extend) the SPI. * @throws InstantiationException see {@link Class#newInstance()} * @throws IllegalAccessException see {@link Class#newInstance()} * @throws NoSuchMethodException see {@link Class#newInstance()} * @throws InvocationTargetException see {@link Class#newInstance()} */ public <T> T newInstance(Class<T> spiClass, String propertiesFileName, String defaultImpl) throws DiscoveryException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { return newInstance(getClassLoaders(spiClass), new SPInterface<T>(spiClass), new PropertiesHolder(propertiesFileName), new DefaultClassHolder<T>(defaultImpl)); }