Package org.apache.commons.discovery

Examples of org.apache.commons.discovery.DiscoveryException


            if (defaultImpl != null) {
                return defaultImpl.getDefaultClass(spi, loaders);
            }
        }
       
        throw new DiscoveryException("No implementation defined for " + spi.getSPName());
    }
View Full Code Here


                                                              setLogParamClasses);
           
            if (setLog == null) {
                String msg = "Internal Error: " + clazz.getName() + " required to implement 'public static void setLog(Log)'";
                log.fatal(msg);
                throw new DiscoveryException(msg);
            }
        } catch (SecurityException se) {
            String msg = "Required Security Permissions not present";
            log.fatal(msg, se);
            throw new DiscoveryException(msg, se);
        }

        if (log.isDebugEnabled())
            log.debug("Class meets requirements: " + clazz.getName());
View Full Code Here

                try {
                    setLog = clazz.getMethod("setLog", setLogParamClasses);
                } catch(Exception e) {
                    String msg = "Internal Error: pre-check for " + clazz.getName() + " failed?!";
                    log.fatal(msg, e);
                    throw new DiscoveryException(msg, e);
                }
   
                Object[] setLogParam = new Object[] { factory.getInstance(clazz.getName()) };
               
                try {
                    setLog.invoke(null, setLogParam);
                } catch(Exception e) {
                    String msg = "Internal Error: setLog failed for " + clazz.getName();
                    log.fatal(msg, e);
                    throw new DiscoveryException(msg, e);
                }
            }
        }
    }
View Full Code Here

               IllegalAccessException,
               NoSuchMethodException,
               InvocationTargetException
    {
        if (impl == null) {
            throw new DiscoveryException("No implementation defined for " + getSPName());
        }

        verifyAncestory(impl);           

        if (paramClasses == null || params == null) {
View Full Code Here

     * Throws exception if <code>impl</code> does not
     * implement or extend the SPI.
     */
    public void verifyAncestory(Class impl) {
        if (!getSPClass().isAssignableFrom(impl)) {
            throw new DiscoveryException("Class " + impl.getName() +
                                         " does not implement " + getSPName());
        }
    }
View Full Code Here

                    // ignore
                }
            }
        }
       
        throw new DiscoveryException("No implementation defined for " + spi.getSPName());
        // return null;
    }
View Full Code Here

                    put(contextLoader, spi.getSPName(), obj);
                }
            } catch (DiscoveryException de) {
                throw de;
            } catch (Exception e) {
                throw new DiscoveryException("Unable to instantiate implementation class for " + spi.getSPName(), e);
            }
        }
       
        return obj;
    }
View Full Code Here

     */
    public static void verifyAncestory(Class spi, Class impl)
        throws DiscoveryException
    {
        if (spi == null) {
            throw new DiscoveryException("No interface defined!");
        }

        if (impl == null) {
            throw new DiscoveryException("No implementation defined for " + spi.getName());
        }

        if (!spi.isAssignableFrom(impl)) {
            throw new DiscoveryException("Class " + impl.getName() +
                                         " does not implement " + spi.getName());
        }
    }
View Full Code Here

                                                              setLogParamClasses);
           
            if (setLog == null) {
                String msg = "Internal Error: " + clazz.getName() + " required to implement 'public static void setLog(Log)'";
                log.fatal(msg);
                throw new DiscoveryException(msg);
            }
        } catch (SecurityException se) {
            String msg = "Required Security Permissions not present";
            log.fatal(msg, se);
            throw new DiscoveryException(msg, se);
        }

        if (log.isDebugEnabled())
            log.debug("Class meets requirements: " + clazz.getName());
View Full Code Here

                try {
                    setLog = clazz.getMethod("setLog", setLogParamClasses);
                } catch(Exception e) {
                    String msg = "Internal Error: pre-check for " + clazz.getName() + " failed?!";
                    log.fatal(msg, e);
                    throw new DiscoveryException(msg, e);
                }
   
                Object[] setLogParam = new Object[] { factory.getInstance(clazz.getName()) };
               
                try {
                    setLog.invoke(null, setLogParam);
                } catch(Exception e) {
                    String msg = "Internal Error: setLog failed for " + clazz.getName();
                    log.fatal(msg, e);
                    throw new DiscoveryException(msg, e);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.discovery.DiscoveryException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.