Package org.impalaframework.exception

Examples of org.impalaframework.exception.ConfigurationException


    // the superclass closes the modules
    final ServletContext servletContext = servlet.getServletContext();
    ModuleManagementFacade facade = ImpalaServletUtils.getModuleManagementFacade(servletContext);

    if (facade == null) {
      throw new ConfigurationException("Unable to load " + FrameworkServletContextCreator.class.getName()
          + " as no attribute '" + WebConstants.IMPALA_FACTORY_ATTRIBUTE
          + "' has been set up. Have you set up your Impala ContextLoader correctly?");
    }

    final String servletName = servlet.getServletName();
    ModuleStateHolder moduleStateHolder = facade.getModuleStateHolder();
   
    if (!initialized) {
     
      ModuleStateChangeNotifier moduleStateChangeNotifier = facade.getModuleStateChangeNotifier();
      moduleStateChangeNotifier.addListener(new ModuleStateChangeListener() {

        public void moduleStateChanged(ModuleStateHolder moduleStateHolder, ModuleStateChange change) {
          try {
            servlet.init();
          }
          catch (Exception e) {
            logger.error("Unable to reinitialize servlet " + servlet.getServletName(), e);
          }
        }

        public String getModuleName() {
          return servletName;
        }

        public Transition getTransition() {
          return Transition.UNLOADED_TO_LOADED;
        }
       
      });
      this.initialized = true;
    }

    ConfigurableApplicationContext context = moduleStateHolder.getModule(servletName);
    if (context != null) {
      if (context instanceof WebApplicationContext) {
        return (WebApplicationContext) context;
      }
      else {
        throw new ConfigurationException("Module registered under name of servlet '" + servletName
            + "' needs to be an instance of " + WebApplicationContext.class.getName());
      }
    }
    else {
      throw new ConfigurationException("No module registered under the name of servlet '" + servletName + "'");
    }
  }
View Full Code Here


 
  private static final Log logger = LogFactory.getLog(ImpalaServletUtils.class);

  public static WebApplicationContext checkIsWebApplicationContext(String servletName, ApplicationContext applicationContext) {
    if (!(applicationContext instanceof WebApplicationContext)) {
      throw new ConfigurationException("Servlet '" + servletName + "' is not backed by an application context of type " + WebApplicationContext.class.getName() + ": " + applicationContext);
    }
    return (WebApplicationContext) applicationContext;
  }
View Full Code Here

    }
    return moduleNames;
  }

  private void invalidChar(char[] chars, int i) {
    throw new ConfigurationException("Invalid definition string " + definitionString + ". Invalid character '" + chars[i]
        + "' at column " + (i + 1));
  }
View Full Code Here

    return resources;
  }

  protected void checkResource(Resource resource, String location, ModuleDefinition moduleDefinition) {
    if (resource == null || !resource.exists())
      throw new ConfigurationException("Unable to load resource from location '" + location
          + "' for module definition '" + moduleDefinition.getName() + "'");
  }
View Full Code Here

      else if (delegatingLoader != null) {
        if (logger.isDebugEnabled()) logger.debug("Loading module " + definition + " using DelegatingContextLoader " + moduleLoader);
        context = delegatingLoader.loadApplicationContext(parent, definition);
      }
      else {
        throw new ConfigurationException("No " + ModuleLoader.class.getName() + " or "
            + DelegatingContextLoader.class.getName() + " specified for module definition type " + definition.getType());
      }

    }
    finally {
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

    List<String> missing = new ArrayList<String>();
    //go through and check that all modules have children but not parents
    for (String moduleName : children.keySet()) {
      if (!parents.containsKey(moduleName)) {
        if (!loadDependendentModules) {
          throw new ConfigurationException("Module '" + moduleName + "' has not been explicitly mentioned, but loadDependentModules has been set to false");
        }
        missing.add(moduleName);
      }
      //FIXME check that all the dependent modules are present
    }
View Full Code Here

    }
  }

  void checkParent(String parent, String moduleName) {
    if (moduleName.equals(parent)){
      throw new ConfigurationException("Module '" + moduleName + "' illegally declares itself as parent in " + MODULE_PROPERTIES);
    }
  }
View Full Code Here

      logger.error("Problem location resources for module: " + moduleName + ". Locations being searched are " + (classLocations.isEmpty() ? "empty": "listed next:"));
      for (Resource classLocation : classLocations) {
        logger.error(classLocation.getDescription() + (classLocation.exists() ? ": is present on file system": " cannot be found"));
      }
     
      throw new ConfigurationException("Application is using internally defined module structure, but no "
          + MODULE_PROPERTIES +
          " file is present on the classpath for module '" + moduleName
          + "'. It must exist in one of the following locations: " + classLocations);
    }
    return resource;
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

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.