Package org.apache.commons.discovery

Examples of org.apache.commons.discovery.DiscoveryException


                                                              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

            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

     * @param impl The class has to be verified is a SPI implementation/extension
     * @throws DiscoveryException if the input implementation class is not an SPI implementation
     */
    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

                    error = e;
                }
            }
        }

        throw new DiscoveryException("No implementation defined for " + spi.getSPName(), error);
        // 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

                    // 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

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.