Refine search
@Override public void failed(Throwable error) { if (error.getCause() instanceof IOException && retries.getAndIncrement() < 3) { // resend echoResource.resolveTemplate("echo", reqId).request().async().get(this); } else { System.out.print("!"); errors.offer(String.format("Request '%d' has failed: %s", reqId, error.toString())); latch.countDown(); } } });
@Override public RegistryClientEntity getRegistryClient(final String id) throws NiFiClientException, IOException { if (StringUtils.isBlank(id)) { throw new IllegalArgumentException("Registry client id cannot be null"); } final WebTarget target = controllerTarget .path("registry-clients/{id}") .resolveTemplate("id", id); return getRequestBuilder(target).get(RegistryClientEntity.class); }
@Override protected ExecCreateCmdResponse execute(ExecCreateCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/exec").resolveTemplate("id", command.getContainerId()); LOGGER.trace("POST: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON) .post(entity(command, MediaType.APPLICATION_JSON), ExecCreateCmdResponse.class); } }
@Override protected UpdateContainerResponse execute(UpdateContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/update") .resolveTemplate("id", command.getContainerId()); LOGGER.trace("POST: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON) .post(entity(command, MediaType.APPLICATION_JSON), UpdateContainerResponse.class); } }
@Override public ProcessGroupFlowEntity getProcessGroup(final String id) throws NiFiClientException, IOException { if (StringUtils.isBlank(id)) { throw new IllegalArgumentException("Process group id cannot be null"); } return executeAction("Error retrieving process group flow", () -> { final WebTarget target = flowTarget .path("process-groups/{id}") .resolveTemplate("id", id); return getRequestBuilder(target).get(ProcessGroupFlowEntity.class); }); }
@Override public void failed(final Throwable error) { if (error.getCause() instanceof IOException && retries.getAndIncrement() < 3) { // resend echoResource.resolveTemplate("echo", reqId).request().async().get(this); } else { invokeAndWait(new Runnable() { @Override public void run() { requestStatusLabel.setBackground(ERROR_COLOR); requestStatusLabel.setToolTipText(String.format("Request '%d' has failed: %s", reqId, error.toString())); latch.countDown(); } }); } } });
@Override protected Service execute(InspectServiceCmd command) { WebTarget webResource = getBaseResource().path("/services/{id}") .resolveTemplate("id", command.getServiceId()); LOGGER.debug("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(Service.class); }
@Override public VersionedFlowUpdateRequestEntity getUpdateRequest(final String updateRequestId) throws IOException, NiFiClientException { if (StringUtils.isBlank(updateRequestId)) { throw new IllegalArgumentException("Update request id cannot be null or blank"); } return executeAction("Error getting update request", () -> { final WebTarget target = versionsTarget .path("update-requests/{id}") .resolveTemplate("id", updateRequestId); return getRequestBuilder(target).get(VersionedFlowUpdateRequestEntity.class); }); }
newTarget = newTarget.resolveTemplate(((PathParam) ann).value(), value); } else if ((ann = anns.get((QueryParam.class))) != null) { if (value instanceof Collection) { Invocation.Builder builder = newTarget.request()
@Override protected InspectExecResponse execute(InspectExecCmd command) { WebTarget webResource = getBaseResource().path("/exec/{id}/json").resolveTemplate("id", command.getExecId()); LOGGER.debug("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(InspectExecResponse.class); } }
@Override public ProcessGroupEntity getProcessGroup(final String processGroupId) throws NiFiClientException, IOException { if (StringUtils.isBlank(processGroupId)) { throw new IllegalArgumentException("Process group id cannot be null or blank"); } return executeAction("Error getting process group", () -> { final WebTarget target = processGroupsTarget .path("{id}") .resolveTemplate("id", processGroupId); return getRequestBuilder(target).get(ProcessGroupEntity.class); }); }
@Override protected Network execute(InspectNetworkCmd command) { WebTarget webResource = getBaseResource().path("/networks/{id}").resolveTemplate("id", command.getNetworkId()); LOGGER.debug("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(Network.class); } }
@Override public VariableRegistryEntity getVariables(final String processGroupId) throws NiFiClientException, IOException { if (StringUtils.isBlank(processGroupId)) { throw new IllegalArgumentException("Parent process group id cannot be null or blank"); } return executeAction("Error getting variables for process group", () -> { final WebTarget target = processGroupsTarget .path("{id}/variable-registry") .resolveTemplate("id", processGroupId); return getRequestBuilder(target).get(VariableRegistryEntity.class); }); }
@Override protected InspectImageResponse execute(InspectImageCmd command) { WebTarget webResource = getBaseResource().path("/images/{id}/json").resolveTemplate("id", command.getImageId()); LOGGER.trace("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(InspectImageResponse.class); }
@Override public ControllerServicesEntity getControllerServices(final String groupId) throws NiFiClientException, IOException { if (StringUtils.isBlank(groupId)) { throw new IllegalArgumentException("Group Id cannot be null or blank"); } return executeAction("Error retrieving controller services", () -> { final WebTarget target = flowTarget .path("process-groups/{id}/controller-services") .resolveTemplate("id", groupId); return getRequestBuilder(target).get(ControllerServicesEntity.class); }); }
@Override protected SwarmNode execute(InspectSwarmNodeCmd command) { WebTarget webResource = getBaseResource().path("/nodes/{id}") .resolveTemplate("id", command.getSwarmNodeId()); LOGGER.debug("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(SwarmNode.class); } }
@Override public VersionControlInformationEntity getVersionControlInfo(final String processGroupId) throws IOException, NiFiClientException { if (StringUtils.isBlank(processGroupId)) { throw new IllegalArgumentException("Process group id cannot be null or blank"); } return executeAction("Error getting version control info", () -> { final WebTarget target = versionsTarget .path("process-groups/{id}") .resolveTemplate("id", processGroupId); return getRequestBuilder(target).get(VersionControlInformationEntity.class); }); }
@Override protected List<ChangeLog> execute(ContainerDiffCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/changes").resolveTemplate("id", command.getContainerId()); LOGGER.trace("GET: {}", webResource); return webResource.request().accept(MediaType.APPLICATION_JSON).get(new GenericType<List<ChangeLog>>() { }); }
@Override public VariableRegistryUpdateRequestEntity getVariableRegistryUpdateRequest( final String processGroupId, final String requestId) throws NiFiClientException, IOException { if (StringUtils.isBlank(processGroupId)) { throw new IllegalArgumentException("Process group id cannot be null or blank"); } if (StringUtils.isBlank(requestId)) { throw new IllegalArgumentException("Request id cannot be null or blank"); } return executeAction("Error getting variable registry update request", () -> { final WebTarget target = processGroupsTarget .path("{processGroupId}/variable-registry/update-requests/{updateId}") .resolveTemplate("processGroupId", processGroupId) .resolveTemplate("updateId", requestId); return getRequestBuilder(target).get(VariableRegistryUpdateRequestEntity.class); }); }
@Override protected InputStream execute(CopyFileFromContainerCmd command) { WebTarget webResource = getBaseResource().path("/containers/{id}/copy").resolveTemplate("id", command.getContainerId()); LOGGER.trace("POST: " + webResource.toString()); Response response = webResource.request().accept(MediaType.APPLICATION_OCTET_STREAM_TYPE) .post(entity(command, MediaType.APPLICATION_JSON)); return new WrappedResponseInputStream(response); }