コード例 #1
0
  public static void generateSecurityPolicyXml(
      ServiceSecurityConfig securityPolicyConfig, String destLoc, String configFileName)
      throws CodeGenFailedException {

    Writer fileWriter = null;
    try {
      fileWriter = CodeGenUtil.getFileWriter(destLoc, configFileName);

      JavaXmlBinder javaXmlBinder = JavaXmlBindingFactory.getInstance();
      javaXmlBinder.generateSecurityPolicyXml(securityPolicyConfig, fileWriter);

    } catch (Exception ex) {
      throw new CodeGenFailedException("Failed to generate Security Policy Config xml file", ex);
    } finally {
      CodeGenUtil.closeQuietly(fileWriter);
    }
  }
コード例 #2
0
  public static void generateClientConfigXml(
      ClientConfigList clientCfgList, String destLoc, String configFileName)
      throws CodeGenFailedException {

    Writer fileWriter = null;
    try {
      fileWriter = CodeGenUtil.getFileWriter(destLoc, configFileName);

      JavaXmlBinder javaXmlBinder = JavaXmlBindingFactory.getInstance();
      javaXmlBinder.generateClientConfigXml(clientCfgList, fileWriter);

    } catch (Exception ex) {
      throw new CodeGenFailedException("Failed to generate Client Config xml file", ex);
    } finally {
      CodeGenUtil.closeQuietly(fileWriter);
    }
  }
コード例 #3
0
  private void generateClientConfigXml(CodeGenContext codeGenCtx, ClientConfigList clientCfgList)
      throws CodeGenFailedException {

    Writer fileWriter = null;
    try {
      if (CodeGenUtil.isEmptyString(codeGenCtx.getClientName()))
        codeGenCtx.getInputOptions().setClientName(codeGenCtx.getServiceAdminName());
      String destFolderPath =
          CodeGenUtil.genDestFolderPath(
              codeGenCtx.getMetaSrcDestLocation(), getSuffixPath(codeGenCtx.getClientName()));
      if (!CodeGenUtil.isEmptyString(codeGenCtx.getInputOptions().getEnvironment())) {
        destFolderPath =
            destFolderPath
                + codeGenCtx.getInputOptions().getEnvironment()
                + File.separator
                + codeGenCtx.getServiceAdminName()
                + File.separator;
        destFolderPath = CodeGenUtil.toOSFilePath(destFolderPath);
      }

      String contents = getUpdatedClientConfigTemplate(codeGenCtx, clientCfgList);

      fileWriter = CodeGenUtil.getFileWriter(destFolderPath, CLIENT_CONFIG_FILE_NAME);
      fileWriter.write(contents);

      getLogger()
          .log(
              Level.INFO,
              "Successfully generated " + CLIENT_CONFIG_FILE_NAME + " under " + destFolderPath);

    } catch (Exception ex) {
      getLogger().log(Level.SEVERE, "Error " + ex.toString());
      throw new CodeGenFailedException("Failed to generate Client Config xml file", ex);
    } finally {
      CodeGenUtil.flushAndCloseQuietly(fileWriter);
    }
  }