logger.debug("mutation response={}", mutationResponse); } catch (AtlasServiceException e) { if (e.getStatus().getStatusCode() == AtlasErrorCode.INSTANCE_NOT_FOUND.getHttpCode().getStatusCode() && e.getMessage().contains(AtlasErrorCode.INSTANCE_NOT_FOUND.getErrorCode())) {
return qualifiedName; } catch (AtlasServiceException e) { if (ClientResponse.Status.NOT_FOUND.equals(e.getStatus())) { logger.warn("{} entity was not found for guid {}", typeName, guid); } else {
public InputStream exportData(AtlasExportRequest request) throws AtlasServiceException { try { return (InputStream) callAPI(EXPORT, Object.class, request); } catch (Exception e) { LOG.error("error writing to file", e); throw new AtlasServiceException(e); } }
if (ClientResponse.Status.NOT_FOUND.equals(e.getStatus())) { logger.debug("nifi_flow_path was not found for qualifiedName {}", flowPathQualifiedName); } else {
protected String getString(JSONObject jsonObject, String parameter) throws AtlasServiceException { try { return jsonObject.getString(parameter); } catch (JSONException e) { throw new AtlasServiceException(e); } }
private void printStandardHttpErrorDetails(AtlasServiceException e) { System.err.println("Error details: "); System.err.println("HTTP Status: " + e.getStatus().getStatusCode() + "," + e.getStatus().getReasonPhrase()); System.err.println("Exception message: " + e.getMessage()); }
if (ClientResponse.Status.NOT_FOUND.equals(e.getStatus())){ getLogger().debug("Existing flow was not found for {}@{}", new Object[]{rootProcessGroup.getId(), clusterName}); } else {
public void exportData(AtlasExportRequest request, String absolutePath) throws AtlasServiceException { OutputStream fileOutputStream = null; try { InputStream inputStream = exportData(request); fileOutputStream = new FileOutputStream(new File(absolutePath)); byte[] buffer = new byte[8 * 1024]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) != -1) { fileOutputStream.write(buffer, 0, bytesRead); } IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(fileOutputStream); } catch (Exception e) { LOG.error("error writing to file", e); throw new AtlasServiceException(e); } finally { if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException e) { LOG.error("error closing file", e); throw new AtlasServiceException(e); } } } }
private void printStandardHttpErrorDetails(AtlasServiceException e) { System.err.println("Error details: "); System.err.println("HTTP Status: " + e.getStatus().getStatusCode() + "," + e.getStatus().getReasonPhrase()); System.err.println("Exception message: " + e.getMessage()); }
public boolean isServerReady() throws AtlasServiceException { WebResource resource = getResource(VERSION.getPath()); try { callAPIWithResource(VERSION, resource, null, JSONObject.class); return true; } catch (ClientHandlerException che) { return false; } catch (AtlasServiceException ase) { if (ase.getStatus() != null && ase.getStatus().equals(ClientResponse.Status.SERVICE_UNAVAILABLE)) { LOG.warn("Received SERVICE_UNAVAILABLE, server is not yet ready"); return false; } throw ase; } }
private String selectActiveServerAddress(Client client, AtlasServerEnsemble serverEnsemble) throws AtlasServiceException { List<String> serverInstances = serverEnsemble.getMembers(); String activeServerAddress = null; for (String serverInstance : serverInstances) { LOG.info("Trying with address {}", serverInstance); activeServerAddress = getAddressIfActive(client, serverInstance); if (activeServerAddress != null) { LOG.info("Found service {} as active service.", serverInstance); break; } } if (activeServerAddress != null) return activeServerAddress; else throw new AtlasServiceException(STATUS, new RuntimeException("Could not find any active instance")); }
private void printStandardHttpErrorDetails(AtlasServiceException e) { System.err.println("Error details: "); System.err.println("HTTP Status: " + e.getStatus().getStatusCode() + "," + e.getStatus().getReasonPhrase()); System.err.println("Exception message: " + e.getMessage()); }
private Referenceable getEntityReference(final String typeName, final String tblQualifiedName) throws AtlasServiceException { AtlasClient dgiClient = getAtlasClient(); try { return dgiClient.getEntity(typeName, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tblQualifiedName); } catch (AtlasServiceException e) { if(e.getStatus() == ClientResponse.Status.NOT_FOUND) { return null; } throw e; } }
private String selectActiveServerAddress(Client client, AtlasServerEnsemble serverEnsemble) throws AtlasServiceException { List<String> serverInstances = serverEnsemble.getMembers(); String activeServerAddress = null; for (String serverInstance : serverInstances) { LOG.info("Trying with address {}", serverInstance); activeServerAddress = getAddressIfActive(client, serverInstance); if (activeServerAddress != null) { LOG.info("Found service {} as active service.", serverInstance); break; } } if (activeServerAddress != null) return activeServerAddress; else throw new AtlasServiceException(API_STATUS, new RuntimeException("Could not find any active instance")); }
logger.debug("mutation response={}", mutationResponse); } catch (AtlasServiceException e) { if (e.getStatus().getStatusCode() == AtlasErrorCode.INSTANCE_NOT_FOUND.getHttpCode().getStatusCode() && e.getMessage().contains(AtlasErrorCode.INSTANCE_NOT_FOUND.getErrorCode())) {
public boolean isServerReady() throws AtlasServiceException { WebResource resource = getResource(API_VERSION.getNormalizedPath()); try { callAPIWithResource(API_VERSION, resource, null, ObjectNode.class); return true; } catch (ClientHandlerException che) { return false; } catch (AtlasServiceException ase) { if (ase.getStatus() != null && ase.getStatus().equals(ClientResponse.Status.SERVICE_UNAVAILABLE)) { LOG.warn("Received SERVICE_UNAVAILABLE, server is not yet ready"); return false; } throw ase; } }
private String selectActiveServerAddress(Client client, AtlasServerEnsemble serverEnsemble) throws AtlasServiceException { List<String> serverInstances = serverEnsemble.getMembers(); String activeServerAddress = null; for (String serverInstance : serverInstances) { LOG.info("Trying with address {}", serverInstance); activeServerAddress = getAddressIfActive(client, serverInstance); if (activeServerAddress != null) { LOG.info("Found service {} as active service.", serverInstance); break; } } if (activeServerAddress != null) return activeServerAddress; else throw new AtlasServiceException(API_STATUS, new RuntimeException("Could not find any active instance")); }
public boolean isServerReady() throws AtlasServiceException { WebResource resource = getResource(API_VERSION.getNormalizedPath()); try { callAPIWithResource(API_VERSION, resource, null, ObjectNode.class); return true; } catch (ClientHandlerException che) { return false; } catch (AtlasServiceException ase) { if (ase.getStatus() != null && ase.getStatus().equals(ClientResponse.Status.SERVICE_UNAVAILABLE)) { LOG.warn("Received SERVICE_UNAVAILABLE, server is not yet ready"); return false; } throw ase; } }
/** * Create the given entity * @param entitiesAsJson entity(type instance) as json * @return json array of guids * @throws AtlasServiceException */ public List<String> createEntity(String... entitiesAsJson) throws AtlasServiceException { try { return createEntity(AtlasJson.parseToV1ArrayNode(Arrays.asList(entitiesAsJson))); } catch (IOException excp) { throw new AtlasServiceException(excp); } }
return qualifiedName; } catch (AtlasServiceException e) { if (ClientResponse.Status.NOT_FOUND.equals(e.getStatus())) { logger.warn("{} entity was not found for guid {}", typeName, guid); } else {