Package com.sun.jersey.api

Examples of com.sun.jersey.api.NotFoundException


    this.manager = manager;
  }

  public void removeDead(String objectId) {
    if (manager.removeDead(objectId) ==  SingularityDeleteResult.DIDNT_EXIST) {
      throw new NotFoundException(String.format("Couldn't find dead %s with id %s", getObjectTypeString(), objectId));
    }
  }
View Full Code Here


    }
  }

  public void removeDecomissioning(String objectId) {
    if (manager.removeDecomissioning(objectId) ==  SingularityDeleteResult.DIDNT_EXIST) {
      throw new NotFoundException(String.format("Couldn't find decomissioning %s with id %s", getObjectTypeString(), objectId));
    }
  }
View Full Code Here

  public void decomission(String objectId, Optional<String> user) {
    DecomissionResult result = manager.decomission(objectId, user);

    if (result == DecomissionResult.FAILURE_NOT_FOUND || result == DecomissionResult.FAILURE_DEAD) {
      throw new NotFoundException(String.format("Couldn't find an active %s with id %s (result: %s)", getObjectTypeString(), objectId, result.name()));
    } else if (result == DecomissionResult.FAILURE_ALREADY_DECOMISSIONING) {
      throw new ConflictException(String.format("%s %s is already in decomissioning state", getObjectTypeString(), objectId));
    }
  }
View Full Code Here

    SingularityPendingTask pendingTask = taskManager.getPendingTask(getTaskIdFromStr(pendingTaskIdStr));

    List<SingularityTaskRequest> taskRequestList = taskRequestManager.getTaskRequests(Collections.singletonList(pendingTask));

    if (taskRequestList.isEmpty()) {
      throw new NotFoundException("Couldn't find: " + pendingTaskIdStr);
    }

    return Iterables.getFirst(taskRequestList, null);
  }
View Full Code Here

    if (!maybeSlave.isPresent()) {
      maybeSlave = slaveManager.getDeadObject(slaveId);
    }

    if (!maybeSlave.isPresent()) {
      throw new NotFoundException(String.format("Couldn't find a slave in any state with id %s", slaveId));
    }

    return taskManager.getTasksOnSlave(taskManager.getActiveTaskIds(), maybeSlave.get());
  }
View Full Code Here

  @ApiOperation("Retrieve information about a specific active task.")
  public SingularityTask getActiveTask(@PathParam("taskId") String taskId) {
    Optional<SingularityTask> task = taskManager.getActiveTask(taskId);

    if (!task.isPresent()) {
      throw new NotFoundException(String.format("No active task with id %s", taskId));
    }

    return task.get();
  }
View Full Code Here

  @ApiOperation("Retrieve statistics about a specific active task.")
  public MesosTaskStatisticsObject getTaskStatistics(@PathParam("taskId") String taskId) {
    Optional<SingularityTask> task = taskManager.getActiveTask(taskId);

    if (!task.isPresent()) {
      throw new NotFoundException(String.format("No active task found in Singularity with id %s", taskId));
    }

    String executorIdToMatch = null;

    if (task.get().getMesosTask().getExecutor().hasExecutorId()) {
      executorIdToMatch = task.get().getMesosTask().getExecutor().getExecutorId().getValue();
    } else {
      executorIdToMatch = taskId;
    }

    for (MesosTaskMonitorObject taskMonitor : mesosClient.getSlaveResourceUsage(task.get().getOffer().getHostname())) {
      if (taskMonitor.getExecutorId().equals(executorIdToMatch)) {
        return taskMonitor.getStatistics();
      }
    }

    throw new NotFoundException(String.format("Couldn't find executor %s for %s on slave %s", executorIdToMatch, taskId, task.get().getOffer().getHostname()));
  }
View Full Code Here

  @ApiOperation("Kill a specific active task.")
  public SingularityTaskCleanupResult killTask(@PathParam("taskId") String taskId, @QueryParam("user") Optional<String> user) {
    Optional<SingularityTask> task = taskManager.getActiveTask(taskId);

    if (!task.isPresent()) {
      throw new NotFoundException(String.format("Couldn't find active task with id %s", taskId));
    }

    final SingularityTaskCleanup taskCleanup = new SingularityTaskCleanup(user, TaskCleanupType.USER_REQUESTED, System.currentTimeMillis(), task.get().getTaskId());

    final SingularityCreateResult result = taskManager.createCleanupTask(taskCleanup);
View Full Code Here

    public Response getItem() {
        System.out.println("GET ITEM " + container + " " + item);
       
        Item i = MemoryStore.MS.getItem(container, item);
        if (i == null)
            throw new NotFoundException("Item not found");
        Date lastModified = i.getLastModified().getTime();
        EntityTag et = new EntityTag(i.getDigest());
        ResponseBuilder rb = request.evaluatePreconditions(lastModified, et);
        if (rb != null)
            return rb.build();
View Full Code Here

    public Container getContainer(@QueryParam("search") String search) {
        System.out.println("GET CONTAINER " + container + ", search = " + search);

        Container c = MemoryStore.MS.getContainer(container);
        if (c == null)
            throw new NotFoundException("Container not found");
       
       
        if (search != null) {
            c = c.clone();
            Iterator<Item> i = c.getItem().iterator();
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.NotFoundException

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.