Package de.odysseus.calyxo.base.conf

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


      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

   * 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

  }

  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

    }
  }

  protected void checkMultiple() throws Exception {
    if (groupTag.getGroupModel().isMultiple()) {
      throw new ConfigException("A group of radio buttons cannot be multiple (input must not be an array or an index has to be set)!");
    }
  }
View Full Code Here

        value = clazz.newInstance();
      } else {
        value = constructor.invoke(clazz, loader);
      }
    } catch (Exception e) {
      throw new ConfigException(
        "Could not create object of class " + className + " in " + toInlineString(), e);
    }
    apply(value, loader);
    return value;
  }
View Full Code Here

    FormsSupport support = FormsSupport.getInstance(request);
   
    form = support.getForm(request, action);
    if (form == null) {
      throw new ConfigException("Cannot find form for action'" + action + "'!");
    }
    result = support.getFormResult(request, action);
    if (result == null) {
      data = support.getFormData(request, action, create);
    } else {
View Full Code Here

   * Check if the specified component corresponds to an input in this form.
   */
  public void check(FormComponent component) throws ConfigException {
    FormInput input = form.getFormInput(component.getName());
    if (input == null) {
      throw new ConfigException("Input '" + component.getName() + "' does not exist!");
    }
    if (!input.isArray() && component.getIndex() >= 0) {
      throw new ConfigException("Input '" + component.getName() + "' is not an array, but has an index!");
    }
  }
View Full Code Here

  public String getInputValue(FormComponent component) throws Exception {
    FormInput input = form.getFormInput(component.getName());
    if (input.isArray()) {
      int index = component.getIndex();
      if (index < 0) {
        throw new ConfigException("Input '" + component.getName() + "' has no index");
      }
      if (result != null) {
        FormInputResult inputResult = result.getFormInputResult(component.getName());
        if (index >= inputResult.getSize()) {
          return NOT_AVAILABLE;
View Full Code Here

   * Get value array for specified component.
   */
  public String[] getInputValues(FormComponent component) throws Exception {
    FormInput input = form.getFormInput(component.getName());
    if (!input.isArray()) {
      throw new ConfigException("Input '" + component.getName() + "' is not an array");
    }
    if (result != null) {
      return (String[])result.getFormInputResult(component.getName()).format(request);
    } else if (data != null) {
      return (String[])input.format(request, data);
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.