Source:
<code>public APIResult submitExtensionJob(final String extensionName, final String jobName, final String configPath, final String doAsUser) { <START> ClientResponse clientResponse = new ResourceBuilder() <END> .path(ExtensionOperations.DETAIL.path) .call(ExtensionOperations.DETAIL); JSONObject responseJson = clientResponse.getEntity(JSONObject.class); ExtensionType extensionType; String extensionBuildLocation; try { JSONObject extensionDetailsJson = new JSONObject(responseJson.get("detail").toString()); extensionType = ExtensionType.valueOf(extensionDetailsJson.get("type").toString().toUpperCase()); extensionBuildLocation = extensionDetailsJson.get("location").toString(); } catch (JSONException e) { OUT.get().print("Error. " + extensionName + " not found "); return null; } InputStream configStream = getServletInputStream(configPath); List<Entity> entities = null; if (extensionType.equals(ExtensionType.CUSTOM)) { try { entities = ExtensionUtil.loadAndPrepare(extensionName, jobName, configStream, extensionBuildLocation); } catch (Exception e) { OUT.get().println("Error in building the extension"); return null; } if (entities == null || entities.isEmpty()) { OUT.get().println("No entities got built"); return null; } String extensionTag = extensionName + "_" + jobName; for (Entity entity : entities) { String tags = entity.getTags(); if (StringUtils.isNotBlank(tags)) { ExtensionUtil.setEntityTags(entity, tags + TAG_SEPARATOR + extensionTag); } else { ExtensionUtil.setEntityTags(entity, extensionTag); } } } clientResponse = new ResourceBuilder() .path(ExtensionOperations.SUBMIT.path, extensionName) .addQueryParam(DO_AS_OPT, doAsUser) .addQueryParam(ENTITIES_OPT, entities) .call(ExtensionOperations.SUBMIT, configStream); return getResponse(APIResult.class, clientResponse); }</code><technical_language>FalconClient a getExtensionDetail method. reuse that</technical_language>

Target:
public APIResult submitExtensionJob(final String extensionName, final String jobName, final String configPath, final String doAsUser) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.DETAIL.path) .call(ExtensionOperations.DETAIL); JSONObject responseJson = clientResponse.getEntity(JSONObject.class); ExtensionType extensionType; String extensionBuildLocation; try { JSONObject extensionDetailsJson = new JSONObject(responseJson.get("detail").toString()); extensionType = ExtensionType.valueOf(extensionDetailsJson.get("type").toString().toUpperCase()); extensionBuildLocation = extensionDetailsJson.get("location").toString(); } catch (JSONException e) { OUT.get().print("Error. " + extensionName + " not found "); return null; } InputStream configStream = getServletInputStream(configPath); List<Entity> entities; if (extensionType.equals(ExtensionType.CUSTOM)) { try { entities = ExtensionHandler.loadAndPrepare(extensionName, jobName, configStream, extensionBuildLocation); } catch (Exception e) { OUT.get().println("Error in building the extension"); return null; } if (entities == null || entities.isEmpty()) { OUT.get().println("No entities got built"); return null; } try { EntityUtil.applyTags(extensionName, jobName, entities); } catch (FalconException e) { OUT.get().println("Error in applying tags to generated entities"); } } clientResponse = new ResourceBuilder() .path(ExtensionOperations.SUBMIT.path, extensionName) .addQueryParam(DO_AS_OPT, doAsUser) .call(ExtensionOperations.SUBMIT, configStream); return getResponse(APIResult.class, clientResponse); }