Пример #1
0
  public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
      throws ConfigurationException {

    if (!this.initialized) {
      this.lazy_initialize();
    }
    if (this.defaultInput == null) {
      if (getLogger().isWarnEnabled()) getLogger().warn("No input module given. FAILING");
      return null;
    }

    Configuration inputConfig = null;
    String inputName = null;
    Mapping mapping = this.mapping;
    String prefix = this.prefix;
    String suffix = this.suffix;
    String rmPrefix = this.rmPrefix;
    String rmSuffix = this.rmSuffix;

    if (modeConf != null && modeConf.getChildren().length > 0) {
      inputName = modeConf.getChild("input-module").getAttribute("name", null);
      if (inputName != null) {
        inputConfig = modeConf.getChild("input-module");
      }
      mapping = new Mapping(modeConf);
      prefix = modeConf.getChild("prefix").getValue(null);
      suffix = modeConf.getChild("suffix").getValue(null);
      rmPrefix = modeConf.getChild("rm-prefix").getValue(null);
      rmSuffix = modeConf.getChild("rm-suffix").getValue(null);
    }

    // remove rm-prefix and rm-suffix
    if (rmPrefix != null && name.startsWith(rmPrefix)) {
      name = name.substring(rmPrefix.length());
    }
    if (rmSuffix != null && name.endsWith(rmSuffix)) {
      name = name.substring(0, name.length() - rmSuffix.length());
    }
    // map
    String param = mapping.mapTo(name);
    // add prefix and suffix
    if (prefix != null) param = prefix + param;
    if (suffix != null) param = param + suffix;
    if (getLogger().isDebugEnabled())
      getLogger().debug("mapping ['" + name + "'] to ['" + param + "']");

    Object[] res =
        getValues(
            param,
            objectModel,
            this.input,
            this.defaultInput,
            this.inputConf,
            null,
            inputName,
            inputConfig);
    if (getLogger().isDebugEnabled())
      getLogger().debug("getting for real attribute ['" + param + "'] value: " + res);

    return res;
  }