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); } }
public String getFilePath(String serviceAdminName, String interfaceName) { return CodeGenUtil.toOSFilePath(getSuffixPath(serviceAdminName)) + CLIENT_CONFIG_FILE_NAME; }