Exemplo n.º 1
0
 public void setRefid(Reference r) {
   Object o = r.getReferencedObject();
   if (!(o instanceof ResourceCollection)) {
     throw new BuildException(r.getRefId() + " doesn\'t denote a ResourceCollection");
   }
   rc = (ResourceCollection) o;
 }
Exemplo n.º 2
0
  public void execute() {
    validate();

    String val = value;
    if (val == null && ref != null) val = ref.getReferencedObject(project).toString();

    if (val == null)
      throw new BuildException("Either the 'Value' or 'Refid' attribute must be set.");

    StringTokenizer st = new StringTokenizer(val, delimiter);
    Vector vec = new Vector(st.countTokens());
    while (st.hasMoreTokens()) vec.addElement(st.nextToken());

    String propList[] = null;

    if (orderPropertyFile != null) {
      try {
        Vector sorted = sortByOrderPropertyFile(vec);
        propList = new String[sorted.size()];
        sorted.copyInto(propList);
      } catch (IOException e) {
        throw new BuildException(e);
      }
    } else {
      String s[] = (String[]) (vec.toArray(new String[vec.size()]));
      propList = new String[s.length];
      System.arraycopy(s, 0, propList, 0, s.length);
      mergeSort(s, propList, 0, s.length, casesensitive, numeric);
    }

    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < propList.length; i++) {
      if (i != 0) sb.append(delimiter);
      sb.append(propList[i]);
    }

    setPropertyValue(sb.toString());
  }