Package org.impalaframework.exception

Examples of org.impalaframework.exception.ConfigurationException


           
            if (!(existingClassLoader instanceof URLClassLoader)) {
               
                final JasperClassLoader jasperClassLoader = maybeCreateURLClassLoader();
                if (jasperClassLoader == null) {
                    throw new ConfigurationException("Cannot support JSP as the application is unable to create a JSPClassLoader instance for the current module");
                } else {
                    Thread.currentThread().setContextClassLoader(jasperClassLoader);
                }
            }
           
View Full Code Here


                if (filterNames != null) {
                    List<FilterFactoryBean> filterFactories = new ArrayList<FilterFactoryBean>();
                    for (String filterName : filterNames) {
                        FilterFactoryBean filterFactoryBean = filtersByName.get(filterName);
                        if (filterFactoryBean == null) {
                            throw new ConfigurationException("Suffix '" + suffix + "' has mapping for filter '" + filterName + "' for which no named filter definition is present in the current module.");
                        }
                        filterFactories.add(filterFactoryBean);
                    }
                    suffixFiltersMapping.put(suffix, filterFactories);
                }
               
                String servletName = contributor.getServletName();
                if (servletName != null) {
                    ServletFactoryBean servletFactoryBean = servletsByName.get(servletName);
                    if (servletFactoryBean == null) {
                        throw new ConfigurationException("Suffix '" + suffix + "' has mapping for servlet '" + servletName + "' for which no named servlet definition is present in the current module.");
                    }
                    suffixServletMapping.put(suffix, servletFactoryBean);
                }
            }
        } else {     
            maybeDebug("Module '" + moduleName + "' has no contributions. Looking for servlet matching module name ...");
           
            //if no contributions, first look for servlet whose name is same as module name
            FilterFactoryBean filter = null;
            ServletFactoryBean servlet = servletsByName.get(this.moduleName);
           
            if (servlet == null) {

                maybeDebug("Looking for filter matching module name ...");

                //if not found, look for filter whose name is same as module name
                filter = filtersByName.get(this.moduleName);
                if (filter == null) {
                   
                    maybeDebug("Looking for single servlet definition ...");

                    //check that there is only one servlet, if > 1, throw exception
                    if (servletsByName.size() > 1) {
                        throw new ConfigurationException("Cannot determine default servlet for module '" + moduleName + "' as more than one servlet is registered for this module.");
                    }
                    if (servletsByName.size() == 1) {
                        servlet = ObjectMapUtils.getFirstValue(servletsByName);
                    }
                   
                    if (servlet == null) {
                       
                        maybeDebug("Looking for single filter definition ...");

                        //check that there is only one filter, if > 1, throw exception
                        if (filtersByName.size() > 1) {
                            throw new ConfigurationException("Cannot determine default filter for module '" + moduleName + "' as more than one filter is registered for this module.");
                        }
                        if (filtersByName.size() == 1) {
                            filter = ObjectMapUtils.getFirstValue(filtersByName);
                        }
                    }
View Full Code Here

        ResourceLoader resourceLoader = getResourceLoader();
        Resource resource = resourceLoader.getResource(locationsResourceName);

        if (!resource.exists()) {
            throw new ConfigurationException("Module definition XML resource '" + resource.getDescription()
                    + "' does not exist");
        }

        return newModuleDefinitionSource(resource, factory);
    }
View Full Code Here

    protected abstract String getAlternativeFolderLocation();
   
    @Override
    public void setLocation(Resource location) {
        throw new ConfigurationException("Use 'fileLocation' property instead");
    }
View Full Code Here

        if (contextLoaderClassName != null) {
            try {
                contextLoaderClass = ClassUtils.forName(contextLoaderClassName);
            }
            catch (Throwable e) {
                throw new ConfigurationException("Unable to instantiate context loader class " + contextLoaderClassName);
            }
        }
       
        ContextLoader contextLoader = null;
        try {
View Full Code Here

        throw new ConfigurationException("Use 'fileLocation' property instead");
    }

    @Override
    public void setLocations(Resource[] locations) {
        throw new ConfigurationException("Use 'fileLocations' property instead");
    }
View Full Code Here

            StringPropertyValue allLocations = new StringPropertyValue(propertySource, CoreBootstrapProperties.GRAPH_BEAN_VISIBILITY_TYPE, CoreBootstrapProperties.GRAPH_BEAN_VISIBILITY_TYPE_DEFAULT);
            configSettings.addProperty(CoreBootstrapProperties.GRAPH_BEAN_VISIBILITY_TYPE, allLocations);
        } else if ("hierarchical".equalsIgnoreCase(value)) {
            //nothing to do here
        } else {
            throw new ConfigurationException("Invalid value for property 'classloader.type': " + value);
        }
    }
View Full Code Here

            //make sure that the delegate servlet is available
            Servlet delegateServlet = ObjectUtils.cast(wac.getBean(delegateServletBeanName),
                    Servlet.class);
           
            if (delegateServlet == null) {
                throw new ConfigurationException("No Servlet registered under name " + delegateServletBeanName);
            }
            this.invoker = getInvoker(wac, delegateServlet, this.frameworkLockHolder, this.setThreadContextClassLoader);
            return wac;
           
        }
View Full Code Here

                String expression = trim.substring(constantPrefix.length(), trim.length() - constantSuffix.length()).trim();
               
                int lastDotIndex = expression.lastIndexOf('.');
               
                if (lastDotIndex < 0) {
                    throw new ConfigurationException("Invalid expression '" + expression + "' in expression '" + strVal + "'. Must evaluate to constant (e.g. 'constant:[org.impalframework.constants.LocationConstant.MODULE_CLASS_DIR_PROPERTY]'");
                }
               
                String className = expression.substring(0, lastDotIndex);
                String fieldName = expression.substring(lastDotIndex + 1);
               
                try {
                    Class<?> clazz = Class.forName(className, true, classLoader);
                    try {
                        Field field = clazz.getField(fieldName);
                        Object value = field.get(null);
                        if (value != null) {
                            return value.toString();
                        } else {
                            throw new ConfigurationException("Field '" + fieldName + "' in class " + className + " in expression '" + strVal + "' cannot evaluate to null");
                        }
                    }
                    catch (ConfigurationException e) {
                        throw e;
                    }
                    catch (Exception e) {
                        throw new ConfigurationException("Field '" + fieldName + "' in class " + className + " in expression '" + strVal + "' could not be evaluated. Could not evaluate constant in bean '" + beanName +"'", e);
                    }
                }
                catch (ClassNotFoundException e) {
                    throw new ConfigurationException("Class '" + className + "' in expression '" + strVal + "' could not be found. Could not evaluate constant in bean '" + beanName +"'" );
                }
            }
           
            return strVal;
        }
View Full Code Here

        String workspace = getWorkspaceRoot();
        if (workspace != null) {
            File candidate = new File(workspace);

            if (!candidate.exists()) {
                throw new ConfigurationException("'workspace.root' (" + workspace + ") does not exist");
            }
            if (!candidate.isDirectory()) {
                throw new ConfigurationException("'workspace.root' (" + workspace + ") is not a directory");
            }
            return new FileSystemResource(candidate);
        }
        return new FileSystemResource("../");
    }
View Full Code Here

TOP

Related Classes of org.impalaframework.exception.ConfigurationException

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.