private ClientConfigList createClientConfigList(CodeGenContext codeGenCtx) { ClientConfigList clientCfgList = new ClientConfigList(); ClientConfig clientCfg = createClientConfig(codeGenCtx); clientCfgList.getClientConfig().add(clientCfg); return clientCfgList; }
private String getUpdatedClientConfigTemplate( CodeGenContext codeGenCtx, ClientConfigList clientCfgList) throws CodeGenFailedException { try { if (clientCfgList == null || clientCfgList.getClientConfig().size() == 0) { throw new CodeGenFailedException("The content of 'ClientConfigList' is empty."); } String contents = CodeGenUtil.getTemplateContent(CLIENT_CONFIG_TEMPLATE); ClientConfig clientConfig = clientCfgList.getClientConfig().get(0); contents = CodeGenConfigUtil.replaceTemplate( contents, CONFIG_GROUP_NAME, clientConfig.getGroup(), CONFIG_GROUP_NAME_ATTR); contents = CodeGenConfigUtil.replaceTemplate( contents, CONFIG_SERVICE_NAME, clientConfig.getServiceName(), CONFIG_SERVICE_NAME_ATTR); contents = CodeGenConfigUtil.replaceTemplate( contents, SERVICE_INT_NAME, clientConfig.getServiceInterfaceClassName(), SERVICE_INT_NAME_NODE); contents = CodeGenConfigUtil.replaceTemplate( contents, WSDL_LOCATION, clientConfig.getWsdlLocation(), WSDL_LOCATION_NODE); contents = CodeGenConfigUtil.replaceTemplate( contents, SERVICE_LOCATION, clientConfig.getServiceLocation(), SERVICE_LOCATION_NODE); ClientGroupConfig clientInstanceConfig = clientConfig.getClientInstanceConfig(); InvocationOptionConfig invocationOptions = null; PreferredTransportConfig preferredTransport = null; if (clientInstanceConfig != null) { invocationOptions = clientConfig.getClientInstanceConfig().getInvocationOptions(); } if (invocationOptions != null) { preferredTransport = invocationOptions.getPreferredTransport(); contents = CodeGenConfigUtil.replaceTemplate( contents, REQ_DATA_BINDING, invocationOptions.getRequestDataBinding(), REQ_DATA_BINDING_NODE); contents = CodeGenConfigUtil.replaceTemplate( contents, RESP_DATA_BINDING, invocationOptions.getResponseDataBinding(), RESP_DATA_BINDING_NODE); contents = CodeGenConfigUtil.replaceTemplate( contents, CONSUMER_ID, invocationOptions.getConsumerId(), CONSUMER_ID_NODE); contents = CodeGenConfigUtil.replaceTemplate( contents, INVOCATION_USE_CASE, invocationOptions.getInvocationUseCase(), INVOCATION_USE_CASE_NODE); } String transportName = null; if (preferredTransport != null) { transportName = preferredTransport.getName(); } contents = CodeGenConfigUtil.replaceTemplate( contents, PREFERRED_TRANSPORT_NAME, transportName, PREFERRED_TRANSPORT_NAME_ATTR); return contents; } catch (Throwable e) { throw new CodeGenFailedException( "Failed in retriveing the client config template " + CLIENT_CONFIG_TEMPLATE + e.getMessage(), e); } }