Exemplo n.º 1
0
    /**
     * Overriden to contruct a valid SQL92 JOIN clause as opposed to the Oracle-like SQL the
     * superclass produces.
     *
     * <p>kieran copied from PostgresqlExpression
     */
    @Override
    public String joinClauseString() {
      NSMutableDictionary<String, Boolean> seenIt = new NSMutableDictionary<String, Boolean>();
      StringBuilder sb = new StringBuilder();
      JoinClauseDefinition jc;
      EOSortOrdering.sortArrayUsingKeyOrderArray(
          _alreadyJoined,
          new NSArray<EOSortOrdering>(
              EOSortOrdering.sortOrderingWithKey("sortKey", EOSortOrdering.CompareAscending)));
      if (_alreadyJoined.count() > 0) {
        jc = _alreadyJoined.objectAtIndex(0);

        sb.append(jc);
        seenIt.setObjectForKey(Boolean.TRUE, jc._table1);
        seenIt.setObjectForKey(Boolean.TRUE, jc._table2);
      }

      for (int i = 1; i < _alreadyJoined.count(); i++) {
        jc = _alreadyJoined.objectAtIndex(i);

        sb.append(jc._op);
        if (seenIt.objectForKey(jc._table1) == null) {
          sb.append(jc._table1);
          seenIt.setObjectForKey(Boolean.TRUE, jc._table1);
        } else if (seenIt.objectForKey(jc._table2) == null) {
          sb.append(jc._table2);
          seenIt.setObjectForKey(Boolean.TRUE, jc._table2);
        }
        sb.append(jc._joinCondition);
      }
      return sb.toString();
    }
Exemplo n.º 2
0
  @Override
  protected void processTestElements(NSMutableArray<SeleniumTest.Element> elements) {
    int includeCount = 0;
    int i = 0;
    while (i < elements.count()) {
      SeleniumTest.Element element = elements.get(i);
      if (element instanceof SeleniumTest.MetaCommand) {
        SeleniumTest.MetaCommand metaCommand = (SeleniumTest.MetaCommand) element;
        if (metaCommand.getName().equals("include")) {
          if (includeCount >= INCLUDE_LIMIT) {
            throw new RuntimeException("Too many @include commands (recursive include?)");
          }
          NSArray<SeleniumTest.Element> newElements =
              getIncludedArguments(metaCommand.argumentsString());

          NSArray<SeleniumTest.Element> tailElements =
              elements.subarrayWithRange(new NSRange(i + 1, elements.count() - i - 1));
          elements.removeObjectsInRange(new NSRange(i, elements.count() - i));
          elements.addObjectsFromArray(newElements);
          elements.addObjectsFromArray(tailElements);
          ++includeCount;
        }
      }
      ++i;
    }
  }
Exemplo n.º 3
0
  /**
   * Overrides the parent implementation to provide a more efficient mechanism for generating
   * primary keys, while generating the primary key support on the fly.
   *
   * @param count the batch size
   * @param entity the entity requesting primary keys
   * @param channel open JDBCChannel
   * @return NSArray of NSDictionary where each dictionary corresponds to a unique primary key value
   */
  public NSArray newPrimaryKeys(int count, EOEntity entity, JDBCChannel channel) {
    if (isPrimaryKeyGenerationNotSupported(entity)) {
      return null;
    }

    EOAttribute attribute = (EOAttribute) entity.primaryKeyAttributes().lastObject();
    String attrName = attribute.name();
    boolean isIntType = "i".equals(attribute.valueType());

    NSMutableArray results = new NSMutableArray(count);
    String sequenceName = sequenceNameForEntity(entity);
    DB2Expression expression = new DB2Expression(entity);

    boolean succeeded = false;
    for (int tries = 0; !succeeded && tries < 2; tries++) {
      while (results.count() < count) {
        try {
          StringBuffer sql = new StringBuffer();
          sql.append("SELECT ");
          sql.append("next value for " + sequenceName + " AS KEY");
          sql.append(" from sysibm.sysdummy1");
          expression.setStatement(sql.toString());
          channel.evaluateExpression(expression);
          try {
            NSDictionary row;
            while ((row = channel.fetchRow()) != null) {
              Enumeration pksEnum = row.allValues().objectEnumerator();
              while (pksEnum.hasMoreElements()) {
                Number pkObj = (Number) pksEnum.nextElement();
                Number pk;
                if (isIntType) {
                  pk = Integer.valueOf(pkObj.intValue());
                } else {
                  pk = Long.valueOf(pkObj.longValue());
                }
                results.addObject(new NSDictionary(pk, attrName));
              }
            }
          } finally {
            channel.cancelFetch();
          }
          succeeded = true;
        } catch (JDBCAdaptorException ex) {
          throw ex;
        }
      }
    }

    if (results.count() != count) {
      throw new IllegalStateException(
          "Unable to generate primary keys from the sequence for " + entity + ".");
    }

    return results;
  }
Exemplo n.º 4
0
  private void doCreateDummyData() {
    try {
      log.info("load");

      String wordFile = ERXFileUtilities.stringFromFile(new File("/usr/share/dict/words"));
      words = NSArray.componentsSeparatedByString(wordFile, "\n");
      log.info("loaded words: {}", words.count());

      int MAX = 100;
      int MAX_ASSETS = MAX * 10;

      for (int i = 0; i < MAX; i++) {
        Tag tag = Tag.clazz.createAndInsertObject(ec);
        tag.setName(randomWord());
        tags.addObject(tag);
      }
      log.info("created tags: {}", tags.count());

      for (int i = 0; i < MAX; i++) {
        AssetGroup group = AssetGroup.clazz.createAndInsertObject(ec);
        group.setName(randomWord());
        groups.addObject(group);
      }
      log.info("created groups: {}", groups.count());

      for (int i = 0; i < MAX_ASSETS; i++) {
        Asset asset = Asset.clazz.createAndInsertObject(ec);
        asset.setAssetGroup(randomAssetGroup());
        asset.setCreationDate(randomTime());
        asset.setUserCount((long) randomInt(10000));
        asset.setPrice(randomPrice());

        for (int j = 0; j < 10; j++) {
          asset.addToTags(randomTag());
        }

        asset.setContent(randomText(1000));

        asset.setGenericInfo(randomText(1000));

        assets.addObject(asset);
      }
      log.info("created assets: {}", assets.count());

      ec.saveChanges();
      log.info("fin: {}", words.count());
    } catch (IOException e) {
      throw NSForwardException._runtimeExceptionForThrowable(e);
    }
  }
Exemplo n.º 5
0
 public WOActionResults delete() {
   NSMutableArray personList = (NSMutableArray) session().valueForKey("personList");
   if (personList != null && personList.count() > 0) {
     for (int i = 0; i < personList.count(); i++) {
       PersonLink pers = (PersonLink) personList.objectAtIndex(i);
       if (item == EOUtilities.localInstanceOfObject(ec, pers.person())) {
         personList.removeObjectAtIndex(i);
         break;
       }
     }
   }
   return context().page();
   //		onEdit = null;
 }
Exemplo n.º 6
0
 // CLAUSE WHERE "UV.ANUNIV || UV.PRDUNIV = ... AND UV.UVC = ...
 // AND UV.ANUNIV || UV.PRDUNIV = EIA.ANUNIV || EIA.PRDUNIV" UV o� est
 // inscris l'�tudiant
 private static EOQualifier qualForUv(String uv, String periode) {
   // ARGSUV.addObject(uv);
   NSMutableArray quals = new NSMutableArray();
   EOEditingContext myContext = ERXEC.newEditingContext();
   EOQualifier qalUv =
       EOVueInsuv.UVC
           .eq(uv)
           .and(
               EOVueInsuv.EO_ETUDIANT_INSCR_ADM
                   .dot(EOEtudiantInscrAdm.ETU_ID)
                   .eq(EOVueInsuv.ETU_ID));
   quals.addObject(qalUv);
   if (periode != null) {
     EOQualifier qualPer =
         EOQualifier.qualifierWithQualifierFormat("anUniv=%@ AND prdUniv=%@", ARGSUV);
     quals.addObject(qualPer);
   }
   EOFetchSpecification spec = null;
   if (quals.count() == 2) {
     EOQualifier qual = new EOAndQualifier(quals);
     spec = new EOFetchSpecification("EOVueInsuv", qual, null);
   } else {
     spec = new EOFetchSpecification("EOVueInsuv", qalUv, null);
   }
   spec.setUsesDistinct(true);
   NSArray uvs = myContext.objectsWithFetchSpecification(spec);
   NSMutableArray etuids = new NSMutableArray();
   for (int i = 0; i < uvs.count(); i++) {
     EOVueInsuv luv = (EOVueInsuv) uvs.objectAtIndex(i);
     Long etu_id = luv.etuId();
     etuids.addObject(etu_id);
   }
   EOQualifier fin = ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.ETU_ID).in(etuids.immutableClone());
   return fin;
 }
Exemplo n.º 7
0
 public void setNavigationLevel(int level, String state) {
   if (level > 0) {
     NSMutableArray navTemp = new NSMutableArray(navigationState());
     if (navTemp.count() >= level) navTemp.replaceObjectAtIndex(state, level - 1);
     else navTemp.addObject(state);
     setNavigationState(navTemp);
   }
 }
Exemplo n.º 8
0
 /**
  * Override so that the joinClause can be constructed after super has iterated though all joins
  * and called our assembleJoinClause to create our array of JoinClauseDefinitions.
  *
  * @see com.webobjects.eoaccess.EOSQLExpression#joinExpression()
  */
 @Override
 public void joinExpression() {
   super.joinExpression();
   if (_alreadyJoined.count() > 0) {
     _joinClauseString = joinClauseString();
   } else {
     _joinClauseString = null;
   }
 }
Exemplo n.º 9
0
 public void sendUpdateSiteToWotaskds() {
   startReading();
   try {
     NSMutableArray hostArray = siteConfig().hostArray();
     if (hostArray.count() != 0) {
       NSMutableDictionary updateRequestDictionary =
           createUpdateRequestDictionary(siteConfig(), null, null, null, "configure");
       WOResponse[] responses = sendRequest(updateRequestDictionary, hostArray, true);
       NSDictionary[] responseDicts = generateResponseDictionaries(responses);
       getUpdateErrors(responseDicts, "configure", false, false, false, true);
     }
   } finally {
     endReading();
   }
 }
Exemplo n.º 10
0
  /**
   * <div class="ja"> ネットワークインアーフェースからIP一覧を得る
   *
   * @return 動作マシンのネットワーク設定が所有しているIPアドレス配列
   * @exception Exception </div>
   */
  private static NSArray<String> _machineIpList() throws Exception {
    // ワーク用
    NSMutableArray<String> workArray = new NSMutableArray<String>();

    // 全ネットワーク・インタフェース
    Enumeration<NetworkInterface> enNi = NetworkInterface.getNetworkInterfaces();
    while (enNi.hasMoreElements()) {
      NetworkInterface ni = enNi.nextElement();

      // 全 InetAddress
      Enumeration<InetAddress> enIp = ni.getInetAddresses();
      while (enIp.hasMoreElements()) {
        String ip = enIp.nextElement().getHostAddress();

        // IP アドレスとプロパティー内に保存されている優先順を合体する
        if ((ip.indexOf(":") < 0) && (!ip.equals(LOCAL_IP_ADDRESS))) {

          String ipPri =
              ERXProperties.stringFor2Keys(
                  "er.erxtensions.ERXTcpIp.IpPriority" + ip, "wodka.a10.A10TcpIp.IpPriority" + ip);
          if (ERXStringUtilities.stringIsNullOrEmpty(ipPri)) {
            ipPri = "9999";
          } else {
            ipPri = ERXStringUtilities.trimZeroInFrontOfNumbers(ipPri);

            while (ipPri.length() < 4) {
              ipPri = "0" + ipPri;
            }
          }

          workArray.addObject(ipPri + UNDER_BAR + ip);
        }
      }
    }

    // 優先順位順に並べ、IPのみ抜き出してArrayListにする
    workArray.sortUsingComparator(NSComparator.AscendingStringComparator);

    // 戻す配列の準備
    NSMutableArray<String> resultArray = new NSMutableArray<String>(workArray.count());

    for (String obj : workArray) {
      resultArray.addObject(obj.substring(5));
    }

    return resultArray.immutableClone();
  }
Exemplo n.º 11
0
 /** @return the lesCapacites */
 public NSArray lesCapacites() {
   if (lesCapacites == null) {
     NSMutableArray<EOCapacite> tmp = new NSMutableArray<EOCapacite>();
     NSMutableArray<EOCapacite> tmp2 = new NSMutableArray<EOCapacite>();
     NSArray<EODomaine> domaines = null;
     NSArray<EORepartDomCapacite> rdcs = null;
     domaines = EODomaine.fetchDomaines(ec, wocomponent().mySession().TODAY);
     if (!wocomponent().droitTout()) domaines = filtreDomaine(domaines).immutableClone();
     domaines =
         ERXArrayUtilities.arrayWithoutDuplicateKeyValue(
             domaines, EODomaine.REPART_DOM_CAPACITES_KEY);
     rdcs =
         (NSArray<EORepartDomCapacite>) domaines.valueForKey(EODomaine.REPART_DOM_CAPACITES_KEY);
     rdcs =
         ERXArrayUtilities.arrayWithoutDuplicateKeyValue(rdcs, EORepartDomCapacite.CAPACITE_KEY);
     if (rdcs != null && rdcs.count() > 0 && verifCap(rdcs)) {
       NSArray tt = (NSArray<EOCapacite>) rdcs.valueForKey(EORepartDomCapacite.CAPACITE_KEY);
       for (int t = 0; t < tt.count(); t++) {
         Object obj = (NSMutableArray) tt.objectAtIndex(t);
         // Correction bug plusieur objet dans un objet
         if (((NSMutableArray) obj).count() > 1) {
           for (Object ob : (NSMutableArray) obj) {
             EOCapacite cp = (EOCapacite) ob;
             if (cp != null) tmp2.addObject(cp);
           }
         } else {
           EOCapacite cp = (EOCapacite) ((NSMutableArray) obj).lastObject();
           if (cp != null) tmp2.addObject(cp);
         }
       }
       NSArray tmp3 = tmp2.immutableClone();
       tmp.addObjectsFromArray(tmp3);
     } else {
       tmp.addObjectsFromArray(EOCapacite.fetchCapacites(ec, wocomponent().mySession().TODAY));
     }
     EOCapacite capacite = selectedCapacite();
     if (capacite != null && !tmp.contains(capacite)) {
       tmp.addObject(capacite);
     }
     if (tmp != null && tmp.count() > 0) {
       ERXArrayUtilities.sortArrayWithKey(tmp, EOCapacite.LBL_COURT_KEY);
       lesCapacites = ERXArrayUtilities.arrayWithoutDuplicates(tmp);
     }
   }
   return lesCapacites;
 }
 protected EOQualifier extraQualifier(D2WContext c, NSDictionary<String, Object> dict) {
   NSMutableArray<EOQualifier> qualifiers = new NSMutableArray<>();
   EOQualifier result = null;
   for (String key : dict.allKeys()) {
     Object value = null;
     if (dict.objectForKey(key) instanceof NSDictionary) {
       // qualifier definition with operator
       NSDictionary qDict = (NSDictionary) dict.objectForKey(key);
       if (qDict.size() == 1) {
         String operatorKey = (String) qDict.allKeys().lastObject();
         String contextKeyPath = (String) qDict.objectForKey(operatorKey);
         if ("NSKeyValueCoding.NullValue".equals(contextKeyPath)) {
           value = NSKeyValueCoding.NullValue;
         } else {
           value = c.valueForKeyPath(contextKeyPath);
         }
         if (value != null) {
           EOQualifier q = qualifierForOperatorAndObject(key, operatorKey, value);
           qualifiers.addObject(q);
         }
       }
     } else {
       value = c.valueForKeyPath((String) dict.objectForKey(key));
       if (value != null) {
         EOQualifier q;
         if (value instanceof NSArray) {
           q = qualifierForArray(key, (NSArray) value);
         } else {
           if (value == NSKeyValueCoding.NullValue) {
             value = null;
           }
           q = qualifierForObject(key, value);
         }
         if (q != null) {
           qualifiers.addObject(q);
         }
       }
     }
   }
   if (qualifiers.count() > 0) result = new EOAndQualifier(qualifiers);
   if (log.isDebugEnabled()) {
     log.debug("Computed qualifier: " + result);
   }
   return result;
 }
  /*
   * (non-Javadoc)
   *
   * @see com.webobjects.eocontrol.EOCustomObject#validateForSave()
   */
  public void validateForSave() throws ValidationException {
    NSMutableArray validationExceptions = new NSMutableArray();
    RuleContext validationContext = validatingEditingContext().validationContext();
    boolean didSetTask = false;

    if (validationContext.valueForKey(ValidatingRecord.TASK_KEY) == null) {
      didSetTask = true;

      validationContext.takeValueForKey(ValidatingRecord.SAVE_VALUE, ValidatingRecord.TASK_KEY);
    }

    validationContext.takeValueForKey(entityName(), ValidatingRecord.ENTITY_NAME_KEY);

    try {
      super.validateForSave();
    } catch (NSValidation.ValidationException ve) {
      validationExceptions.addObject(ve);
    }

    EOClassDescription classDescription = classDescription();

    if (classDescription instanceof ValidatingClassDescription) {
      try {
        ValidatingClassDescription vClassDescription =
            (ValidatingClassDescription) classDescription;

        vClassDescription.validateAdditionalKeys(this);
      } catch (NSValidation.ValidationException ve) {
        validationExceptions.addObject(ve);
      }
    }
    if (didSetTask) {
      validationContext.takeValueForKey(null, ValidatingRecord.TASK_KEY);
    }

    validationContext.takeValueForKey(null, ValidatingRecord.ENTITY_NAME_KEY);

    int vCount = validationExceptions.count();

    if (vCount == 1) {
      throw (NSValidation.ValidationException) validationExceptions.objectAtIndex(0);
    } else if (vCount > 1) {
      throw NSValidation.ValidationException.aggregateExceptionWithExceptions(validationExceptions);
    }
  }
Exemplo n.º 14
0
  /**
   * Looks through the child components to locate the AjaxTabbedPanelTabs that are controlled by
   * this panel. Tabs without an explicit id attributed are assigned a calculated one.
   *
   * @param template the graph of elements passed to the constructor.
   */
  private void findTabs(WODynamicGroup template) {
    if (template == null || template.childrenElements() == null) return;

    NSArray children = template.childrenElements();
    for (int i = 0; i < children.count(); i++) {
      WOElement child = (WOElement) children.objectAtIndex(i);
      if (child instanceof MTAjaxTabbedPanelTab) {
        MTAjaxTabbedPanelTab childTab = (MTAjaxTabbedPanelTab) child;

        // The tabs need to have an id attribute so we assign one if needed
        if (childTab.id() == null) {
          childTab.setId(
              new WOConstantValueAssociation(id.valueInComponent(null) + "_pane_" + tabs.count()));
        }

        tabs.addObject(childTab);
      } else if (child instanceof WODynamicGroup) {
        findTabs((WODynamicGroup) child);
      }
    }
  }
Exemplo n.º 15
0
  public static void initColors() {
    if (theColors == null) {
      theColors = new NSMutableArray();
    }
    if (theColors.count() == 0) {

      String[] aColor = {"0", "0", "255"};
      NSArray theColor = new NSArray(aColor);
      theColors.addObject(theColor);

      String[] bColor = {"255", "0", "0"};
      theColor = new NSArray(bColor);
      theColors.addObject(theColor);

      String[] cColor = {"0", "255", "0"};
      theColor = new NSArray(cColor);
      theColors.addObject(theColor);

      String[] dColor = {"255", "0", "255"};
      theColor = new NSArray(dColor);
      theColors.addObject(theColor);

      String[] eColor = {"0", "0", "0"};
      theColor = new NSArray(eColor);
      theColors.addObject(theColor);

      String[] fColor = {"125", "0", "50"};
      theColor = new NSArray(fColor);
      theColors.addObject(theColor);

      String[] gColor = {"50", "125", "0"};
      theColor = new NSArray(gColor);
      theColors.addObject(theColor);

      String[] hColor = {"50", "0", "125"};
      theColor = new NSArray(hColor);
      theColors.addObject(theColor);
    }
  }
Exemplo n.º 16
0
 public void search() {
   try {
     found = Person.Utility.search(ec, entity(), searchString);
     if ((found == null || found.count() == 0) && alterEntity() != null)
       found = Person.Utility.search(ec, alterEntity(), searchString);
   } catch (Exception e) {
     searchMessage = e.getMessage();
     canCreate = false;
     return;
   }
   if (found.count() < 1) {
     searchMessage = (String) session().valueForKeyPath("strings.Strings.messages.nothingFound");
     canCreate = Various.boolForObject(session().valueForKeyPath("readAccess.create." + entity()));
     return;
   }
   NSMutableArray fullList = (NSMutableArray) session().valueForKey("personList");
   NSMutableArray tmp = found.mutableClone();
   tmp.removeObjectsInArray(fullList);
   fullList.addObjectsFromArray(tmp);
   if (fullList.count() > 1) EOSortOrdering.sortArrayUsingKeyOrderArray(fullList, Person.sorter);
   searchMessage = null;
 }
Exemplo n.º 17
0
  private boolean isRobot(String userAgent) {
    synchronized (robotExpressions) {
      if (robotExpressions.count() == 0) {
        String strings =
            ERXStringUtilities.stringFromResource(
                "robots", "txt", NSBundle.bundleForName("ERExtensions"));
        for (String item : NSArray.componentsSeparatedByString(strings, "\n")) {
          if (item.trim().length() > 0 && item.charAt(0) != '#') {
            robotExpressions.addObject(Pattern.compile(item));
          }
        }
      }
      userAgent = userAgent.toLowerCase();
      for (Pattern pattern : robotExpressions) {
        if (pattern.matcher(userAgent).find()) {
          log.debug(pattern + " matches  " + userAgent);
          return true;
        }
      }
    }

    return false;
  }
Exemplo n.º 18
0
  private String _generateModProxyConfig() {
    StringBuilder result = new StringBuilder();

    result.append("#\n");
    result.append("# Common configuration (if not already set)\n");
    result.append("#\n");
    result.append("ProxyRequests Off\nProxyVia Full\n");
    result.append("#\n");
    result.append("# Give us a name\n");
    result.append("#\n");
    result.append("RequestHeader append x-webobjects-adaptor-version \"mod_proxy\"\n\n\n");

    result.append("#\n");
    result.append("# Balancer routes\n");
    result.append("#\n");

    for (Enumeration<MApplication> e = siteConfig().applicationArray().objectEnumerator();
        e.hasMoreElements(); ) {
      MApplication anApp = e.nextElement();
      anApp.extractAdaptorValuesFromSiteConfig();

      String tmpAdaptor = siteConfig().woAdaptor();
      tmpAdaptor = StringUtils.removeEnd(tmpAdaptor, "/");

      NSArray<String> tmpPath = NSArray.componentsSeparatedByString(tmpAdaptor, "/");

      int count = tmpPath.count();
      String adaptorPath = "/" + tmpPath.get(count - 2) + "/" + tmpPath.get(count - 1) + "/";

      result.append("<Proxy balancer://" + anApp.name() + ".woa>\n");

      NSMutableArray<String> reversePathes = new NSMutableArray<String>();

      for (Enumeration<MInstance> e2 = anApp.instanceArray().objectEnumerator();
          e2.hasMoreElements(); ) {
        MInstance anInst = e2.nextElement();

        anInst.extractAdaptorValuesFromApplication();

        String host = anInst.values().valueForKey("hostName").toString();
        String port = anInst.values().valueForKey("port").toString();

        String url = "http://" + host + ":" + port + adaptorPath + anApp.name() + ".woa";

        result.append("\tBalancerMember ");
        result.append(url);
        result.append(" route=");
        result.append(_proxyBalancerRoute(anApp.name(), host, port));
        result.append('\n');

        reversePathes.add(url);
      }

      result.append("</Proxy>\n");
      result.append("ProxyPass ");
      result.append(adaptorPath);
      result.append(anApp.name());
      result.append(".woa balancer://");
      result.append(anApp.name());
      result.append(".woa stickysession=");
      result.append(_proxyBalancerCookieName(anApp.name()));
      result.append(" nofailover=On\n");

      for (int i = 0; i < reversePathes.count(); i++) {
        String url = reversePathes.objectAtIndex(i);
        result.append("ProxyPassReverse / ");
        result.append(url);
        result.append('\n');
      }
      result.append('\n');
    }

    result.append("#\n");
    result.append("# Balancer configuration\n");
    result.append("#\n");
    for (Enumeration<MApplication> e = siteConfig().applicationArray().objectEnumerator();
        e.hasMoreElements(); ) {
      MApplication anApp = e.nextElement();
      anApp.extractAdaptorValuesFromSiteConfig();
      String name = anApp.name();
      result.append("ProxySet balancer://" + name + ".woa");
      if (timeout != null && timeout.intValue() > 0) {
        result.append(" timeout=");
        result.append(timeout);
      }
      if (loadBalancer != null) {
        result.append(" lbmethod=");
        result.append(loadBalancer);
      } else {
        result.append(" lbmethod=byrequests");
      }
      result.append('\n');
    }

    result.append("#\n");
    result.append("#\n");
    result.append("#\n");

    result.append('\n');
    return result.toString();
  }