Package org.jclouds.rest

Examples of org.jclouds.rest.ResourceNotFoundException


                  if (matcher.find()) {
                     message = String.format("%s %s not found", matcher.group(1), matcher.group(2));
                  } else {
                     message = path;
                  }
                  exception = new ResourceNotFoundException(message);
               }
               break;
            case 409:
               exception = new IllegalStateException(content);
               break;
View Full Code Here


               response.getStatusLine());
         switch (response.getStatusCode()) {
         case 400:
            if ((command.getCurrentRequest().getEndpoint().getPath().endsWith("/info"))
                  || (message != null && message.indexOf("could not be found") != -1))
               exception = new ResourceNotFoundException(message, exception);
            else
               exception = new IllegalArgumentException(message, exception);
            break;
         case 401:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 405:
            exception = new IllegalArgumentException(message, exception);
            break;
View Full Code Here

      Image image = createNiceMock(Image.class);
      Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);

      expect(caller.getAMIApi()).andReturn((Optional) Optional.of(client)).atLeastOnce();
      expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
      expect(parser.apply(ec2Image)).andThrow(new ResourceNotFoundException());

      replay(caller);
      replay(image);
      replay(parser);
      replay(client);
View Full Code Here

         case 403:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
      }
      command.setException(exception);
   }
View Full Code Here

      case 403:
         exception = new AuthorizationException(message, exception);
         break;
      case 404:
         if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
            exception = new ResourceNotFoundException(message, exception);
         }
         break;
      case 413:
         exception = new InsufficientResourcesException(message, exception);
         break;
View Full Code Here

   protected Exception refineException(HttpCommand command, HttpResponse response, Exception exception,
            AzureStorageError error, String message) {
      switch (response.getStatusCode()) {
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
               List<String> parts = Lists.newArrayList(Splitter.on('/').split(
                        command.getCurrentRequest().getEndpoint().getPath()));
               parts.remove("");
               if (parts.size() > 0) {
                  String container = parts.remove(0);
View Full Code Here

               response.getStatusLine());
         switch (response.getStatusCode()) {
         case 400:
            if ((command.getCurrentRequest().getEndpoint().getPath().endsWith("/info"))
                  || (message != null && message.indexOf("could not be found") != -1))
               exception = new ResourceNotFoundException(message, exception);
            else if (message != null && message.indexOf("currently in use") != -1)
               exception = new IllegalStateException(message, exception);
            else
               exception = new IllegalArgumentException(message, exception);
            break;
         case 401:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 405:
            exception = new IllegalArgumentException(message, exception);
            break;
View Full Code Here

   @Override
   public void rebootNode(String id) {
      NodeMetadata node = nodes.get(id);
      if (node == null)
         throw new ResourceNotFoundException("node not found: " + id);
      setStateOnNode(Status.PENDING, node);
      setStateOnNodeAfterDelay(Status.RUNNING, node, 50);
   }
View Full Code Here

   @Override
   public void resumeNode(String id) {
      NodeMetadata node = nodes.get(id);
      if (node == null)
         throw new ResourceNotFoundException("node not found: " + id);
      if (node.getStatus() == Status.RUNNING)
         return;
      if (node.getStatus() != Status.SUSPENDED)
         throw new IllegalStateException("to resume a node, it must be in suspended status, not: " + formatStatus(node));
      setStateOnNode(Status.PENDING, node);
View Full Code Here

   @Override
   public void suspendNode(String id) {
      NodeMetadata node = nodes.get(id);
      if (node == null)
         throw new ResourceNotFoundException("node not found: " + id);
      if (node.getStatus() == Status.SUSPENDED)
         return;
      if (node.getStatus() != Status.RUNNING)
         throw new IllegalStateException("to suspend a node, it must be in running status, not: " + formatStatus(node));
      setStateOnNode(Status.PENDING, node);
View Full Code Here

TOP

Related Classes of org.jclouds.rest.ResourceNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.