public void configurePhaseListeners(ArrayList<PhaseListener> list) {
   try {
     for (int i = 0; i < _phaseListenerList.size(); i++)
       list.add((PhaseListener) _phaseListenerList.get(i).newInstance());
   } catch (RuntimeException e) {
     throw e;
   } catch (Exception e) {
     throw ConfigException.create(e);
   }
 }
  /** Sets the value of the attribute */
  @Override
  public void setValue(Object bean, QName name, Object value) throws ConfigException {
    if ("#text".equals(name.getLocalName()))
      throw new ConfigException(L.l("text is not allowed in this context\n  '{0}'", value));

    try {
      _putMethod.invoke(bean, name.getLocalName(), value);
    } catch (Exception e) {
      throw ConfigException.create(_putMethod, e);
    }
  }
示例#3
0
文件: DateType.java 项目: dlitz/resin
  /**
   * Returns the type's configured value
   *
   * @param builder the context builder
   * @param node the configuration node
   * @param parent
   */
  @Override
  public Object valueOf(String text) {
    try {
      if (text == null) return null;
      else if ("".equals(text)) return new Date(Alarm.getCurrentTime());

      QDate date = new QDate();
      date.parseDate(text);

      return new Date(date.getGMTTime());
    } catch (Exception e) {
      throw ConfigException.create(e);
    }
  }
  /** Sets the value of the attribute */
  @Override
  public void setText(Object bean, QName name, String value) throws ConfigException {
    if ("#text".equals(name.getLocalName())) {
      if (value == null || value.trim().length() == 0) return;

      throw new ConfigException(
          L.l(
              "text is not allowed for bean {0}\n  '{1}'",
              bean.getClass().getName(), value.trim()));
    }

    try {
      _putMethod.invoke(bean, name.getLocalName(), _type.valueOf(value));
    } catch (Exception e) {
      throw ConfigException.create(_putMethod, e);
    }
  }
  protected void configure(FilterMapping filterMapping) {
    try {
      if (_urlPattern != null) filterMapping.createUrlPattern().addText(_urlPattern).init();

      if (_servletName != null) filterMapping.addServletName(_servletName);

      filterMapping.setFilterName(_filterName);

      if (_filterClass != null) filterMapping.setFilterClass(_filterClass);

      for (Map.Entry<String, String> entry : _initParamMap.entrySet()) {
        filterMapping.setInitParam(entry.getKey(), entry.getValue());
      }

      filterMapping.setInit(_init);

      // filterMapping.init();
    } catch (Exception e) {
      throw ConfigException.create(e);
    }
  }