Пример #1
0
  private List<TMapServiceEntry> getUniqueServices(List<TMapServiceEntry> allServices) {
    List<TMapServiceEntry> uniqueServices = new ArrayList<TMapServiceEntry>();
    if (allServices == null) {
      return uniqueServices;
    }

    for (int j = 0; j < allServices.size(); j++) {
      TMapServiceEntry tmpService = allServices.get(j);
      boolean isUnique = true;
      for (TMapServiceEntry uniqueServiceEntry : uniqueServices) {
        QName servicePltQname = tmpService.getPartnerLinkNameQname();
        String serviceRoleName = tmpService.getRoleName();
        if (servicePltQname != null
            && servicePltQname.equals(uniqueServiceEntry.getPartnerLinkNameQname())
            && serviceRoleName != null
            && serviceRoleName.equals(uniqueServiceEntry.getRoleName())) {
          isUnique = false;
        }
      }

      if (isUnique) {
        uniqueServices.add(tmpService);
      }
    }

    return uniqueServices;
  }
Пример #2
0
  private String getServiceOperations(
      List<TMapServiceEntry> allServices, TMapServiceEntry uniqueService) {
    assert uniqueService != null && allServices != null;
    assert uniqueService.getPartnerLinkNameQname() != null && uniqueService.getRoleName() != null;
    StringBuffer serviceOperations = new StringBuffer("");

    for (TMapServiceEntry service : allServices) {

      if (uniqueService.getRoleName().equals(service.getRoleName())
          && uniqueService.getPartnerLinkNameQname().equals(service.getPartnerLinkNameQname())) {
        TMapServiceEntry invoke = getInvoke(service);

        StringBuffer invokeSb = new StringBuffer();
        if (invoke != null) {
          invokeSb
              .append("            <invoke partnerLinkType=\"")
              .append(getColonedQName(invoke.getPartnerLinkNameQname(), mNameSpacePrefix));
          invokeSb.append(" opName=\"").append(invoke.getOperation()).append("\" ");
          invokeSb.append(" roleName=\"").append(invoke.getRoleName()).append("\" ");
          invokeSb.append(" file=\"").append(invoke.getFile()).append("\" ");
          invokeSb.append(" transformJBI=\"").append(invoke.getTransformJBI()).append("\" ");
        } else {
          invokeSb.append("/>\n");
        }

        StringBuffer sbOperation = new StringBuffer();
        sbOperation.append("        <operation");
        sbOperation.append(" opName=\"").append(service.getOperation()).append("\" ");
        //                    sbOperation.append(" file=\"").
        //                            append(service.getFile()).
        //                                append("\" ");
        //                    sbOperation.append(" transformJBI=\"").
        //                            append(service.getTransformJBI()).
        //                                append("\" ");
        sbOperation.append(invokeSb);

        serviceOperations.append(sbOperation);
      }
    }

    return serviceOperations.toString();
  }
Пример #3
0
  private void generateTransformMap() throws IOException {
    FileOutputStream fos = null;
    try {

      StringBuffer sb = new StringBuffer();
      sb.append("<transformmap \n");
      sb.append("       xmlns=\"http://xml.netbeans.org/schema/transformmap\"\n");

      int nss = mNameSpacePrefix.size();
      int i = 0;
      Set<String> nsUris = mNameSpacePrefix.keySet();
      for (String nsUri : nsUris) {
        sb.append("        xmlns:" + mNameSpacePrefix.get(nsUri) + "=\"" + nsUri + "\"");
        i++;
        if (i < nss - 1) {
          sb.append("\n");
        }
      }

      sb.append(">\n");

      if (mProviders != null) {

        List<TMapServiceEntry> uniqueServices = getUniqueServices(mProviders);
        for (TMapServiceEntry uniqueService : uniqueServices) {
          sb.append("    <service partnerLinkType=\"")
              .append(getColonedQName(uniqueService.getPartnerLinkNameQname(), mNameSpacePrefix))
              .append("\"");
          sb.append(" roleName=\"").append(uniqueService.getRoleName()).append("\" >\n");

          sb.append(getServiceOperations(mProviders, uniqueService));

          sb.append("    </service>\n");
        }
      }

      sb.append("</transformmap>\n");
      String content = sb.toString();
      fos = new FileOutputStream(getTransformMapFile());
      store(content.getBytes("UTF-8"), fos);
    } finally {
      if (fos != null) {
        fos.close();
      }
    }
  }