Package de.odysseus.calyxo.base.conf

Examples of de.odysseus.calyxo.base.conf.ConfigException


  /**
   * Add exception element.
   */
  public void add(ExceptionHandlerConfigImpl value) throws ConfigException {
    if (exceptions.containsKey(value.getType())) {
      throw new ConfigException("Duplicate exception type '" + value.getClassName() + "' in " + toInlineString());
    }
    exceptions.put(value.getType(), value);
  }
View Full Code Here


  /**
   * Add dispatch element.
   */
  public void add(DispatchConfigImpl value) throws ConfigException {
    if (dispatches.containsKey(value.getName())) {
      throw new ConfigException("Duplicate dispatch name '" + value.getName() + "' in " + toInlineString());
    }
    dispatches.put(value.getName(), value);
  }
View Full Code Here

   * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_init()
   */
  protected void _init() throws ConfigException {
    super._init();
    if ((action == null) == (path == null)) {
      throw new ConfigException("Either path or action must be specified in dispatch '" + toInlineString() + "'");
    }
    if (path != null && module != null) {
      throw new ConfigException("Cannot specify module with path in dispatch '" + toInlineString());
    }
  }
View Full Code Here

   * Add action.
   * @exception ConfigException if an action with same path already exists
   */
  public void add(ActionConfigImpl action) throws ConfigException {
    if (actions.containsKey(action.getPath())) {
      throw new ConfigException("Duplicate action path '" + action.getPath() + "' in " + toInlineString());
    }
    actions.put(action.getPath(), action);
  }
View Full Code Here

  /**
   * Add dispatch
   */
  public void add(DispatchConfigImpl value) throws ConfigException {
    if (dispatchConfigs.containsKey(value.getName())) {
      throw new ConfigException("Duplicate dispatch name '" + value.getName() + "' in " + toInlineString());
    }
    dispatchConfigs.put(value.getName(), value);
  }
View Full Code Here

  /**
   * Add exception element.
   */
  public void add(ExceptionHandlerConfigImpl value) throws ConfigException {
    if (exceptionConfigs.containsKey(value.getType())) {
      throw new ConfigException("Duplicate exception type '" + value.getClassName() + "' in " + toInlineString());
    }
    exceptionConfigs.put(value.getType(), value);
  }
View Full Code Here

   * @param config
   * @throws ConfigException
   */
  private void check(FilterConfig config) throws ConfigException {
    if (config.getParamConfig("form") == null) {
      throw new ConfigException("Missing parameter 'form' in " + config.toInlineString());
    }
    Iterator params = config.getParamConfigs();
    while (params.hasNext()) {
      ParamConfig param = (ParamConfig)params.next();
      if ("scope".equals(param.getName())) {
        String scope = param.getValue();
        if (!"request".equals(scope) && !"session".equals(scope)) {
          throw new ConfigException("Bad scope '" + scope + "' in " + config.toInlineString());
        }
        if (config.getParamConfig("attribute") == null) {
          throw new ConfigException("Parameter 'scope' without 'attribute' in " + config.toInlineString());
        }     
      } else if ("class".equals(param.getName())) {
        String clazz = param.getValue();
        try {
          loader.loadClass(clazz);
        } catch (Exception e) {
          throw new ConfigException("Bad class '" + clazz + "' in " + config.toInlineString(), e);
        }
      }
    }
  }
View Full Code Here

      if (scope == null || "session".equals(scope.getValue())) {
        request.getSession().removeAttribute(attribute.getValue());
      } else if ("request".equals(scope.getValue())) {
        request.removeAttribute(attribute.getValue());
      } else {
        throw new ConfigException("Bad scope '" +  scope.getValue() + "' in " + filterConfig.toInlineString());
      }
    }
  }
View Full Code Here

    try {
      InputSource input = new InputSource(url.openStream());
      input.setSystemId(url.toString());
      digester.parse(input);
    } catch (Exception e) {
      throw new ConfigException("Error parsing " + url, e);
    }

    // Parse imported files
    Iterator imports = root.getImportConfigs();
    ArrayList children = null;
    if (imports.hasNext()) {
      children = new ArrayList();
      while (imports.hasNext()) {
        String file = ((ImportConfig)imports.next()).getFile();
        URL childURL = null;
        try {
          if (file.startsWith("/")) {
            if (context != null) {
              childURL = context.getServletContext().getResource(file);
            }
            if (childURL == null) {
              childURL = getClass().getResource(file);
            }
          } else {
            childURL = new URL(url, file);
          }
          if (childURL == null) {
            throw new ConfigException("Could not find file: '" + file + "'");
          }
        } catch (MalformedURLException e) {
          throw new ConfigException("Bad file path: '" + file + "'", e);
        }
        children.add(parse(childURL));
      }
    }
View Full Code Here

    } else if (value.equals("module")) {
      scope = MODULE_SCOPE;
    } else if (value.equals("application")) {
      scope = APPLICATION_SCOPE;
    } else {
      throw new ConfigException("Bad scope name " + value + " in " + toInlineString());
    }
    scopeName = value;
  }
View Full Code Here

TOP

Related Classes of de.odysseus.calyxo.base.conf.ConfigException

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.