예제 #1
0
  static void writeDistribution(XMLWriter writer, DistributionDescriptor descriptor)
      throws java.io.IOException {
    if (descriptor.icepatch.length() > 0) {
      java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
      attributes.add(createAttribute("icepatch", descriptor.icepatch));

      if (descriptor.directories.isEmpty()) {
        writer.writeElement("distrib", attributes);
      } else {
        writer.writeStartTag("distrib", attributes);
        for (String p : descriptor.directories) {
          writer.writeElement("directory", p);
        }
        writer.writeEndTag("distrib");
      }
    }
  }
예제 #2
0
  static void writePropertySet(
      XMLWriter writer,
      String id,
      String idAttrName,
      PropertySetDescriptor psd,
      java.util.List<AdapterDescriptor> adapters,
      String[] logs)
      throws java.io.IOException {
    if (id.length() == 0 && psd.references.length == 0 && psd.properties.size() == 0) {
      return;
    }

    //
    // We don't show the .Endpoint of adapters,
    // since they already appear in the Adapter descriptors
    //
    java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<String>();
    java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<String>();

    if (adapters != null) {
      for (AdapterDescriptor p : adapters) {
        hiddenPropertyNames.add(p.name + ".Endpoints");

        for (ObjectDescriptor q : p.objects) {
          hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
        }
        for (ObjectDescriptor q : p.allocatables) {
          hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
        }
      }
    }

    if (logs != null) {
      for (String log : logs) {
        hiddenPropertyValues.add(log);
      }
    }

    java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
    if (id.length() > 0) {
      attributes.add(createAttribute(idAttrName, id));
    }
    if (psd.references.length == 0 && psd.properties.size() == 0) {
      writer.writeElement("properties", attributes);
    } else {
      writer.writeStartTag("properties", attributes);

      for (String ref : psd.references) {
        attributes.clear();
        attributes.add(createAttribute("refid", ref));
        writer.writeElement("properties", attributes);
      }

      for (PropertyDescriptor p : psd.properties) {
        if (hiddenPropertyNames.contains(p.name)) {
          //
          // We hide only the first occurence
          //
          hiddenPropertyNames.remove(p.name);
        } else if (hiddenPropertyValues.contains(p.value)) {
          hiddenPropertyValues.remove(p.value);
        } else {
          attributes.clear();
          attributes.add(createAttribute("name", p.name));
          attributes.add(createAttribute("value", p.value));
          writer.writeElement("property", attributes);
        }
      }
      writer.writeEndTag("properties");
    }
  }