Examples of ConfigException


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

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

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

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

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

   * @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

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

      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

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

    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

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

    } 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

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

   * @see de.odysseus.calyxo.base.conf.FieldConfig#get(java.lang.Class, java.lang.Object)
   */
  public Object get(Class clazz, Object object) throws ConfigException {
    if (clazz == null) {
      if (object == null) {
        throw new ConfigException("Cannot get field from null in " + toInlineString());
      }
      clazz = object.getClass();
    } else if (object != null && !clazz.isInstance(object)) {
      throw new ConfigException("Specified object is not an instance of " + clazz.getName() + " in " + toInlineString());
    }
    try {
      return clazz.getField(name).get(object);
    } catch (Exception e) {
      throw new ConfigException("Could not access field in " + toInlineString(), e);
    }
  }
View Full Code Here

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

      FunctionsConfigImpl value = (FunctionsConfigImpl)functions.next();
      Class clazz = null;
      try {
        clazz = context.getClassLoader().loadClass(value.getClassName());
      } catch (ClassNotFoundException e) {
        throw new ConfigException("Could not find functions class '" + value.getClassName() + "'", e);
      }
      Method[] methods = clazz.getDeclaredMethods();
      for (int i = 0; i < methods.length; i++) {
        int mod = methods[i].getModifiers();
        if (Modifier.isStatic(mod) && Modifier.isPublic(mod)) {
View Full Code Here

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

   * Add functions element
   */
  public void add(FunctionsConfigImpl value) throws ConfigException {
    String key = value.getPrefix();
    if (functions.containsKey(key)) {
      throw new ConfigException("Duplicate functions for prefix '" + key + "' in " + toInlineString());
    }
    functions.put(value.getPrefix(), value);
  }
View Full Code Here

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

  }

  protected void checkValue() throws Exception {
    String key = getValueAttribute();
    if (!groupTag.isSelectable(key)) {
      throw new ConfigException("A " + getTypeAttribute() + " item for group '" + groupTag.getName() + "' contains invalid value '" + key + "'!");
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.