Tabnine Logo
AtmosError.getCode
Code IndexAdd Tabnine to your IDE (free)

How to use
getCode
method
in
org.jclouds.atmos.domain.AtmosError

Best Java code snippets using org.jclouds.atmos.domain.AtmosError.getCode (Showing top 20 results out of 315)

origin: com.amysta.jclouds.api/atmos

  @Override
  public Boolean createOrPropagate(Throwable t) throws Exception {
   if (HttpUtils.contains404(t)) {
     return true;
   }
   AtmosResponseException exception = getFirstThrowableOfType(t, AtmosResponseException.class);
   if (exception != null && exception.getError().getCode() == AtmosErrorCode.DIRECTORY_NOT_EMPTY.getCode()) {
     return false;
   }
   throw propagate(t);
  }
}
origin: org.apache.jclouds.api/atmos

  @Override
  public Boolean createOrPropagate(Throwable t) throws Exception {
   if (HttpUtils.contains404(t)) {
     return true;
   }
   AtmosResponseException exception = getFirstThrowableOfType(t, AtmosResponseException.class);
   if (exception != null && exception.getError().getCode() == AtmosErrorCode.DIRECTORY_NOT_EMPTY.getCode()) {
     return false;
   }
   throw propagate(t);
  }
}
origin: Nextdoor/bender

  @Override
  public Boolean createOrPropagate(Throwable t) throws Exception {
   if (HttpUtils.contains404(t)) {
     return true;
   }
   AtmosResponseException exception = getFirstThrowableOfType(t, AtmosResponseException.class);
   if (exception != null && exception.getError().getCode() == AtmosErrorCode.DIRECTORY_NOT_EMPTY.getCode()) {
     return false;
   }
   throw propagate(t);
  }
}
origin: apache/jclouds

  @Override
  public Boolean createOrPropagate(Throwable t) throws Exception {
   if (HttpUtils.contains404(t)) {
     return true;
   }
   AtmosResponseException exception = getFirstThrowableOfType(t, AtmosResponseException.class);
   if (exception != null && exception.getError().getCode() == AtmosErrorCode.DIRECTORY_NOT_EMPTY.getCode()) {
     return false;
   }
   throw propagate(t);
  }
}
origin: org.jclouds.api/atmos

public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content)
    throws HttpException {
 AtmosError error = factory.create(errorHandlerProvider.get()).parse(content);
 if (error.getCode() == 1032) {
   error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
 }
 return error;
}
origin: jclouds/legacy-jclouds

public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content)
    throws HttpException {
 AtmosError error = factory.create(errorHandlerProvider.get()).parse(content);
 if (error.getCode() == 1032) {
   error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
 }
 return error;
}
origin: jclouds/legacy-jclouds

  public void testApplyInputStream() {
   InputStream is = getClass().getResourceAsStream("/error.xml");
   ParseSax<AtmosError> parser = createParser();
   AtmosError result = parser.parse(is);
   assertEquals(result.getCode(), 1003);
  }
}
origin: io.cloudsoft.jclouds.api/atmos

public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content)
    throws HttpException {
 AtmosError error = factory.create(errorHandlerProvider.get()).parse(content);
 if (error.getCode() == 1032) {
   error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
 }
 return error;
}
origin: org.apache.jclouds.api/atmos

public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content)
    throws HttpException {
 AtmosError error = factory.create(errorHandlerProvider.get()).parse(content);
 if (error.getCode() == AtmosErrorCode.SIGNATURE_MISMATCH.getCode()) {
   error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
 }
 return error;
}
origin: com.amysta.jclouds.api/atmos

public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content)
    throws HttpException {
 AtmosError error = factory.create(errorHandlerProvider.get()).parse(content);
 if (error.getCode() == AtmosErrorCode.SIGNATURE_MISMATCH.getCode()) {
   error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
 }
 return error;
}
origin: Nextdoor/bender

public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content)
    throws HttpException {
 AtmosError error = factory.create(errorHandlerProvider.get()).parse(content);
 if (error.getCode() == AtmosErrorCode.SIGNATURE_MISMATCH.getCode()) {
   error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
 }
 return error;
}
origin: apache/jclouds

public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content)
    throws HttpException {
 AtmosError error = factory.create(errorHandlerProvider.get()).parse(content);
 if (error.getCode() == AtmosErrorCode.SIGNATURE_MISMATCH.getCode()) {
   error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
 }
 return error;
}
origin: apache/jclouds

  public void testApplyInputStream() {
   InputStream is = getClass().getResourceAsStream("/error.xml");
   ParseSax<AtmosError> parser = createParser();
   AtmosError result = parser.parse(is);
   assertEquals(result.getCode(), AtmosErrorCode.OBJECT_NOT_FOUND.getCode());
  }
}
origin: io.cloudsoft.jclouds.api/atmos

public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
 if (command.getFailureCount() > retryCountLimit) {
   return false;
 }
 if (response.getStatusCode() == 500) {
   byte[] content = HttpUtils.closeClientButKeepContentStream(response);
   // Content can be null in the case of HEAD requests
   if (content != null) {
    try {
      AtmosError error = utils.parseAtmosErrorFromContent(command, response,
          new String(content));
      if (error.getCode() == 1040) {  // The server is busy. Please try again.
       return backoffHandler.shouldRetryRequest(command, response);
      }
      // don't increment count before here, since backoff handler does already
      command.incrementFailureCount();
    } catch (HttpException e) {
      logger.warn(e, "error parsing response: %s", new String(content));
    }
   } else {
    command.incrementFailureCount();
   }
   return false;
 }
 return false;
}
origin: jclouds/legacy-jclouds

public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
 if (command.getFailureCount() > retryCountLimit)
   return false;
 if (response.getStatusCode() == 404 && command.getCurrentRequest().getMethod().equals("DELETE")) {
   command.incrementFailureCount();
   return true;
 } else if (response.getStatusCode() == 409) {
   byte[] content = HttpUtils.closeClientButKeepContentStream(response);
   // Content can be null in the case of HEAD requests
   if (content != null) {
    try {
      AtmosError error = utils.parseAtmosErrorFromContent(command, response,
          new String(content));
      if (error.getCode() == 1006) {
       return backoffHandler.shouldRetryRequest(command, response);
      }
      // don't increment count before here, since backoff handler does already
      command.incrementFailureCount();
    } catch (HttpException e) {
      logger.warn(e, "error parsing response: %s", new String(content));
    }
   } else {
    command.incrementFailureCount();
   }
   return true;
 }
 return false;
}
origin: org.jclouds.api/atmos

public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
 if (command.getFailureCount() > retryCountLimit)
   return false;
 if (response.getStatusCode() == 404 && command.getCurrentRequest().getMethod().equals("DELETE")) {
   command.incrementFailureCount();
   return true;
 } else if (response.getStatusCode() == 409) {
   byte[] content = HttpUtils.closeClientButKeepContentStream(response);
   // Content can be null in the case of HEAD requests
   if (content != null) {
    try {
      AtmosError error = utils.parseAtmosErrorFromContent(command, response,
          new String(content));
      if (error.getCode() == 1006) {
       return backoffHandler.shouldRetryRequest(command, response);
      }
      // don't increment count before here, since backoff handler does already
      command.incrementFailureCount();
    } catch (HttpException e) {
      logger.warn(e, "error parsing response: %s", new String(content));
    }
   } else {
    command.incrementFailureCount();
   }
   return true;
 }
 return false;
}
origin: Nextdoor/bender

public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
 if (command.getFailureCount() > retryCountLimit) {
   return false;
 }
 if (response.getStatusCode() == 500) {
   byte[] content = HttpUtils.closeClientButKeepContentStream(response);
   // Content can be null in the case of HEAD requests
   if (content != null) {
    try {
      AtmosError error = utils.parseAtmosErrorFromContent(command, response,
          new String(content));
      if (error.getCode() == AtmosErrorCode.SERVER_BUSY.getCode()) {
       return backoffHandler.shouldRetryRequest(command, response);
      }
      // don't increment count before here, since backoff handler does already
      command.incrementFailureCount();
    } catch (HttpException e) {
      logger.warn(e, "error parsing response: %s", new String(content));
    }
   } else {
    command.incrementFailureCount();
   }
   return false;
 }
 return false;
}
origin: com.amysta.jclouds.api/atmos

public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
 if (command.getFailureCount() > retryCountLimit) {
   return false;
 }
 if (response.getStatusCode() == 500) {
   byte[] content = HttpUtils.closeClientButKeepContentStream(response);
   // Content can be null in the case of HEAD requests
   if (content != null) {
    try {
      AtmosError error = utils.parseAtmosErrorFromContent(command, response,
          new String(content));
      if (error.getCode() == AtmosErrorCode.SERVER_BUSY.getCode()) {
       return backoffHandler.shouldRetryRequest(command, response);
      }
      // don't increment count before here, since backoff handler does already
      command.incrementFailureCount();
    } catch (HttpException e) {
      logger.warn(e, "error parsing response: %s", new String(content));
    }
   } else {
    command.incrementFailureCount();
   }
   return false;
 }
 return false;
}
origin: Nextdoor/bender

public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
 if (command.getFailureCount() > retryCountLimit)
   return false;
 if (response.getStatusCode() == 404 && command.getCurrentRequest().getMethod().equals("DELETE")) {
   command.incrementFailureCount();
   return true;
 } else if (response.getStatusCode() == 409) {
   byte[] content = HttpUtils.closeClientButKeepContentStream(response);
   // Content can be null in the case of HEAD requests
   if (content != null) {
    try {
      AtmosError error = utils.parseAtmosErrorFromContent(command, response,
          new String(content));
      if (error.getCode() == AtmosErrorCode.CONFLICTING_OPERATION.getCode()) {
       return backoffHandler.shouldRetryRequest(command, response);
      }
      // don't increment count before here, since backoff handler does already
      command.incrementFailureCount();
    } catch (HttpException e) {
      logger.warn(e, "error parsing response: %s", new String(content));
    }
   } else {
    command.incrementFailureCount();
   }
   return true;
 }
 return false;
}
origin: apache/jclouds

public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
 if (command.getFailureCount() > retryCountLimit) {
   return false;
 }
 if (response.getStatusCode() == 500) {
   byte[] content = HttpUtils.closeClientButKeepContentStream(response);
   // Content can be null in the case of HEAD requests
   if (content != null) {
    try {
      AtmosError error = utils.parseAtmosErrorFromContent(command, response,
          new String(content));
      if (error.getCode() == AtmosErrorCode.SERVER_BUSY.getCode()) {
       return backoffHandler.shouldRetryRequest(command, response);
      }
      // don't increment count before here, since backoff handler does already
      command.incrementFailureCount();
    } catch (HttpException e) {
      logger.warn(e, "error parsing response: %s", new String(content));
    }
   } else {
    command.incrementFailureCount();
   }
   return false;
 }
 return false;
}
org.jclouds.atmos.domainAtmosErrorgetCode

Popular methods of AtmosError

  • <init>
  • getMessage
  • setStringSigned
  • toString

Popular in Java

  • Creating JSON documents from java classes using gson
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Path (java.nio.file)
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now