gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-22 12:47:05 26 4
gpt4 key购买 nike

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

Workspace.getRuntime介绍

[英]Returns the runtime of this workspace instance. If status of this workspace instance is either WorkspaceStatus#RUNNING or WorkspaceStatus#STARTING, or WorkspaceStatus#STOPPING then returned value is not null, otherwise it is.
[中]返回此工作区实例的运行时。如果此工作区实例的状态为WorkspaceStatus#RUNNING或WorkspaceStatus#STARTING或WorkspaceStatus#STOPPING,则返回值不为null,否则为null。

代码示例

代码示例来源: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-app

/** Checks whether the server is running in the machine. */
private boolean isServerRunning(String machineName, String serverName) {
 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(serverName);
 if (server == null) {
  return false;
 }
 return server.getStatus() == ServerStatus.RUNNING;
}

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

/**
 * Return server URL related with defined port
 *
 * @deprecated use {@link #getServerFromDevMachineBySymbolicName(String, String)} to retrieve
 *     server URL from instead
 */
@Override
@Deprecated
@Nullable
public String getServerAddressByPort(String workspaceId, int port) throws Exception {
 Workspace workspace = getById(workspaceId);
 ensureRunningStatus(workspace);
 Map<String, ? extends Machine> machines = workspace.getRuntime().getMachines();
 for (Machine machine : machines.values()) {
  if (containsWsAgentServer(machine)) {
   return machine.getServers().get(valueOf(port) + "/tcp").getUrl();
  }
 }
 return null;
}

代码示例来源: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

/**
 * Return ServerDto object from runtime by it's symbolic name
 *
 * @param workspaceId workspace id of current user
 * @param serverName server name
 * @return ServerDto object
 */
@Override
@Nullable
public Server getServerFromDevMachineBySymbolicName(String workspaceId, String serverName)
  throws Exception {
 Workspace workspace =
   requestFactory.fromUrl(getIdBasedUrl(workspaceId)).request().asDto(WorkspaceDto.class);
 ensureRunningStatus(workspace);
 Map<String, ? extends Machine> machines = workspace.getRuntime().getMachines();
 for (Machine machine : machines.values()) {
  if (containsWsAgentServer(machine)) {
   return machine.getServers().get(serverName);
  }
 }
 return null;
}

代码示例来源: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;
}

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