コード例 #1
0
  private String getCollectionName(File f, SlbModelTree slbmodel) {

    if (f.getName().indexOf("slb_base.xml") >= 0) {
      return "slb_base";
    }

    if (slbmodel.getVirtualServers().size() != 1) {
      throw new IllegalStateException("wrong file format, multi virtual servers:" + f);
    }

    VirtualServer vs = (VirtualServer) slbmodel.getVirtualServers().values().toArray()[0];
    return vs.getName();
  }
コード例 #2
0
  private DocumentKey getDocumentKey(File f, SlbModelTree slbmodel) {

    String fileName = f.getName();
    if (fileName.indexOf("slb_base.xml") >= 0) {
      return new DocumentKey("slb_base");
    }

    VirtualServer vs = (VirtualServer) slbmodel.getVirtualServers().values().toArray()[0];
    String name = vs.getName();

    int index = fileName.indexOf(".xml_");
    if (index >= 0) {
      String tag = fileName.substring(index + ".xml_".length()).trim();
      return new DocumentKey(name, Integer.parseInt(tag));
    }
    // concurrent version
    return new DocumentKey(name);
  }