gpt4 book ai didi

org.eclipse.che.api.core.model.workspace.Workspace.getStatus()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 13:17:05 27 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.che.api.core.model.workspace.Workspace.getStatus()方法的一些代码示例,展示了Workspace.getStatus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Workspace.getStatus()方法的具体详情如下:
包路径:org.eclipse.che.api.core.model.workspace.Workspace
类名称:Workspace
方法名:getStatus

Workspace.getStatus介绍

[英]Returns the status of the current workspace instance.

All the workspaces which are stopped have runtime are considered WorkspaceStatus#STOPPED.
[中]返回当前工作区实例的状态。
所有停止运行的工作区都被视为工作区状态#已停止。

代码示例

代码示例来源:origin: org.eclipse.che.selenium/che-selenium-core

/**
 * Ensure workspace has running status, or throw IllegalStateException.
 *
 * @param workspace workspace description to get status and id.
 * @throws IllegalStateException if workspace with certain workspaceId doesn't have RUNNING
 *     status.
 */
@Override
public void ensureRunningStatus(Workspace workspace) throws IllegalStateException {
 if (workspace.getStatus() != WorkspaceStatus.RUNNING) {
  throw new IllegalStateException(
    format(
      "Workspace with id='%s' should has '%s' status, but its actual state='%s'",
      workspace.getId(), WorkspaceStatus.RUNNING, workspace.getStatus()));
 }
}

代码示例来源:origin: org.eclipse.che.selenium/che-selenium-core

public void waitStatus(
  String workspaceName, String userName, WorkspaceStatus expectedStatus, int timeoutSeconds)
  throws Exception {
 WaitUtils.waitSuccessCondition(
   () -> {
    try {
     if (getByName(workspaceName, userName).getStatus() == expectedStatus) {
      return true;
     }
    } catch (Exception e) {
     throw new RuntimeException(e.getMessage(), e);
    }
    return false;
   },
   timeoutSeconds,
   1000,
   TimeUnit.SECONDS);
}

代码示例来源:origin: org.eclipse.che.selenium/che-selenium-core

/** Waits workspace is started. */
@Override
public void waitWorkspaceStart(String workspaceName, String userName) throws Exception {
 WaitUtils.sleepQuietly(5); // delay 5 secs to obtain starting status for sure
 WaitUtils.waitSuccessCondition(
   () -> {
    WorkspaceStatus status;
    try {
     status = getByName(workspaceName, userName).getStatus();
    } catch (Exception e) {
     throw new RuntimeException(e.getMessage(), e);
    }
    switch (status) {
     case RUNNING:
      return true;
     case STARTING:
      return false;
     default:
      throw new RuntimeException(
        format("Workspace with name '%s' didn't start", workspaceName));
    }
   },
   600,
   1000,
   TimeUnit.SECONDS);
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

private boolean isSshServerIsRunning(String machineName) {
 Workspace workspace = appContext.getWorkspace();
 Runtime runtime = workspace.getRuntime();
 if (runtime == null) {
  return false;
 }
 Machine machine = runtime.getMachines().get(machineName);
 if (machine == null) {
  return false;
 }
 Server server = machine.getServers().get(SERVER_SSH_REFERENCE);
 if (server == null) {
  return false;
 }
 return workspace.getStatus() == WorkspaceStatus.RUNNING;
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-api

/** {@inheritDoc} */
@Override
public final void update(@NotNull ActionEvent event) {
 Presentation presentation = event.getPresentation();
 boolean isWorkspaceRunning = false;
 if (appContext.get() != null) {
  Workspace workspace = appContext.get().getWorkspace();
  isWorkspaceRunning =
    workspace != null && WorkspaceStatus.RUNNING.equals(workspace.getStatus());
 }
 boolean inPerspective =
   perspectives == null || perspectives.isEmpty()
     ? true
     : perspectives.contains(perspectiveManager.get().getPerspectiveId());
 presentation.setEnabledAndVisible(inPerspective && isWorkspaceRunning);
 if (inPerspective && isWorkspaceRunning) {
  updateInPerspective(event);
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-api-workspace

/** Returns 'rel -> url' map of links for the given workspace. */
public Map<String, String> genLinks(Workspace 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.getConfig().getName())
     .build()
     .toString());
 if (workspace.getStatus() != WorkspaceStatus.STOPPED) {
  addRuntimeLinks(links, workspace.getId(), serviceContext);
 }
 return links;
}

代码示例来源:origin: org.eclipse.che.selenium/che-selenium-core

public WorkspaceStatus getWorkspaceStatusAssociatedWithFactory() throws Exception {
  return workspaceServiceClient
    .getByName(factoryDto.getWorkspace().getName(), owner.getName())
    .getStatus();
 }
}

代码示例来源:origin: org.eclipse.che.core/che-core-api-workspace

public WorkspaceImpl(Workspace workspace, Account account) {
 this(
   workspace.getId(),
   account,
   workspace.getConfig(),
   workspace.getRuntime(),
   workspace.getAttributes(),
   workspace.isTemporary(),
   workspace.getStatus());
}

代码示例来源:origin: org.eclipse.che.selenium/che-selenium-core

if (workspace.getStatus() == STOPPING) {
 waitStatus(workspaceName, userName, STOPPED);
} else if (workspace.getStatus() != STOPPED) {
 stop(workspaceName, userName);

代码示例来源:origin: org.eclipse.che.core/che-core-api-workspace

/** Converts {@link Workspace} to {@link WorkspaceDto}. */
public static WorkspaceDto asDto(Workspace workspace) {
 WorkspaceDto workspaceDto =
   newDto(WorkspaceDto.class)
     .withId(workspace.getId())
     .withStatus(workspace.getStatus())
     .withNamespace(workspace.getNamespace())
     .withTemporary(workspace.isTemporary())
     .withAttributes(workspace.getAttributes())
     .withConfig(asDto(workspace.getConfig()));
 if (workspace.getRuntime() != null) {
  RuntimeDto runtime = asDto(workspace.getRuntime());
  workspaceDto.setRuntime(runtime);
 }
 return workspaceDto;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com