Java Code Examples for org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl#getStatus()
The following examples show how to use
org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl#getStatus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorkspaceActivityService.java From che with Eclipse Public License 2.0 | 5 votes |
@PUT @Path("/{wsId}") @ApiOperation( value = "Notifies workspace activity", notes = "Notifies workspace activity to prevent stop by timeout when workspace is used.") @ApiResponses(@ApiResponse(code = 204, message = "Activity counted")) public void active(@ApiParam(value = "Workspace id") @PathParam("wsId") String wsId) throws ForbiddenException, NotFoundException, ServerException { final WorkspaceImpl workspace = workspaceManager.getWorkspace(wsId); if (workspace.getStatus() == RUNNING) { workspaceActivityManager.update(wsId, System.currentTimeMillis()); LOG.debug("Updated activity on workspace {}", wsId); } }
Example 2
Source File: WorkspaceLinksGenerator.java From che with Eclipse Public License 2.0 | 5 votes |
/** Returns 'rel -> url' map of links for the given workspace. */ public Map<String, String> genLinks(WorkspaceImpl workspace, ServiceContext serviceContext) throws ServerException { final UriBuilder uriBuilder = serviceContext.getServiceUriBuilder(); final LinkedHashMap<String, String> links = new LinkedHashMap<>(); links.put( LINK_REL_SELF, uriBuilder .clone() .path(WorkspaceService.class, "getByKey") .build(workspace.getId()) .toString()); links.put( LINK_REL_IDE_URL, uriBuilder .clone() .replacePath("") .path(workspace.getNamespace()) .path(workspace.getName()) .build() .toString()); if (workspace.getStatus() != WorkspaceStatus.STOPPED) { addRuntimeLinks(links, workspace.getId(), serviceContext); } links.putAll( previewUrlLinksVariableGenerator.genLinksMapAndUpdateCommands( workspace, uriBuilder.clone())); return links; }
Example 3
Source File: WorkspaceManager.java From che with Eclipse Public License 2.0 | 5 votes |
private void checkWorkspaceIsRunningOrStarting(WorkspaceImpl workspace) throws ConflictException { if (workspace.getStatus() != RUNNING && workspace.getStatus() != STARTING) { throw new ConflictException( format( "Could not stop the workspace '%s/%s' because its status is '%s'.", workspace.getNamespace(), workspace.getName(), workspace.getStatus())); } }