Package de.odysseus.calyxo.base.conf

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


            }
          }
          PropertyUtils.setProperty(this, attribute, object);
        }
      } catch (ELException e) {
        throw new ConfigException("Could not evaluate " + toInlineString() + "/@" + attribute + " '" + value + "'", e);
      } catch (Exception e) {
        throw new ConfigException("Could not access " + toInlineString() + "/@" + attribute, e);
      }
    }
    resolveCalled = true;
  }
View Full Code Here


      Object[] coercedArgs = coerce(rawArgs, constructors[i].getParameterTypes());
      if (coercedArgs != null) {
        try {
          return constructors[i].newInstance(coercedArgs);
        } catch (Exception e) {
          throw new ConfigException(
            "Could not invoke constructor in " + toInlineString(), e);
        }
      }
    }
    throw new ConfigException(
      "Could not find constructor in " + toInlineString());
  }
View Full Code Here

   */
  protected void init() throws Exception {
    super.init();

    if (selectTag.getListModel() == null) {
      throw new ConfigException("A list option tag for input '" + selectTag.getName() + "' requires a model!");
    }
  }
View Full Code Here

  protected void checkValue() throws Exception {
    if (getValue() != null) {
      super.checkValue();
    } else {
      if (selectTag.isSelectable("")) {
        throw new ConfigException("List option default value '' is contained in model for input '" + selectTag.getName() + "'!");
      }
    }
  }
View Full Code Here

      String token = tokens.nextToken().trim();
      URL url = null;
      try {
        url = context.getServletContext().getResource(token);
      } catch (MalformedURLException e) {
        throw new ConfigException(e);
      }
      if (url == null) {
        throw new ConfigException("Could not find resource " + token);
      } else {
        list.add(url);
      }
    }
    URL[] inputs = (URL[])list.toArray(new URL[list.size()]);
View Full Code Here

    super("checkbox");
  }

  protected void checkMultiple() throws Exception {
    if (!groupTag.getGroupModel().isMultiple()) {
      throw new ConfigException("A group of checkboxes must be multiple (input must be an array)!");
    }
  }
View Full Code Here

          PropertyUtils.setPropertyFromString(object, name, (String)value);
        } else {
          PropertyUtils.setProperty(object, name, value);
        }
      } catch (Exception e) {
        throw new ConfigException(
          "Could not set property " +
          name + " in " + toInlineString(), e
        );
      }
    }
View Full Code Here

   * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_resolve(javax.servlet.jsp.el.ExpressionEvaluator, javax.servlet.jsp.el.VariableResolver)
   */
  protected void _resolve(ExpressionEvaluator evaluator, VariableResolver variables) throws ConfigException {
    if (value != null) {
      if (object != null || member != null) {
        throw new ConfigException("The value attribute requires an empty body in " + toInlineString());
      }
    } else {
      if (object == null && member == null) {
        throw new ConfigException("An empty body requires the value attribute in " + toInlineString());
      }
    }
    super._resolve(evaluator, variables);
  }
View Full Code Here

   * @see de.odysseus.calyxo.base.conf.impl.ConfigImpl#_init()
   */
  protected void _init() throws ConfigException {
    super._init();
    if (isFinal() && !isDefined()) {
      throw new ConfigException("Final property must have a value in '" + toInlineString() + "'");
    }
  }
View Full Code Here

   * @see de.odysseus.calyxo.base.conf.MethodConfig#invoke(java.lang.Class, java.lang.Object)
   */
  public Object invoke(Class clazz, Object object, ClassLoader loader) throws ConfigException {
    if (clazz == null) {
      if (object == null) {
        throw new ConfigException("Cannot invoke method on 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());
    }
    Object[] rawArgs = evalArgs(loader);
    Method[] methods = clazz.getMethods();
    for (int i = 0; i < methods.length; i++) {
      if (methods[i].getName().equals(name)) {
        if (object == null && !Modifier.isStatic(methods[i].getModifiers())) {
          continue;
        }
        Class[] types = methods[i].getParameterTypes();
        Object[] coercedArgs = coerce(rawArgs, types);
        if (coercedArgs != null) {
          try {
            return methods[i].invoke(object, coercedArgs);
          } catch (Exception e) {
            throw new ConfigException(
              "Could not invoke method " + name + " in " + toInlineString(), e);
          }
        }
      }
    }
    throw new ConfigException(
      "Could not find method " + name + " in " + toInlineString());
  }
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.