• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EnvironmentImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl的典型用法代码示例。如果您正苦于以下问题:Java EnvironmentImpl类的具体用法?Java EnvironmentImpl怎么用?Java EnvironmentImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EnvironmentImpl类属于org.eclipse.che.api.workspace.server.model.impl包,在下文中一共展示了EnvironmentImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
  devExtendedMachine = new ExtendedMachineImpl();
  extendedMachine = new ExtendedMachineImpl();
  environment = new EnvironmentImpl();
  cheService = new CheServiceImpl();
  CheServiceImpl devCheService = new CheServiceImpl();
  internalEnv = new CheServicesEnvironmentImpl();

  provisioner =
      new CodenvyInContainerInfrastructureProvisioner(
          agentConfigApplier, SYNC_KEY, TEST_PROJECTS_FOLDER);

  Map<String, ExtendedMachineImpl> extendedMachines = new HashMap<>();
  extendedMachines.put(NON_DEV_MACHINE_NAME, extendedMachine);
  extendedMachines.put(DEV_MACHINE_NAME, devExtendedMachine);
  environment.setMachines(extendedMachines);
  Map<String, CheServiceImpl> services = new HashMap<>();
  services.put(NON_DEV_MACHINE_NAME, cheService);
  services.put(DEV_MACHINE_NAME, devCheService);
  internalEnv.setServices(services);
  devExtendedMachine.setAgents(
      asList("org.eclipse.che.exec", "org.eclipse.che.terminal", "org.eclipse.che.ws-agent"));
  extendedMachine.setAgents(
      asList("org.eclipse.che.ws-agent2", "not.che.ws-agent", "org.eclipse.che.terminal"));
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:27,代码来源:CodenvyInContainerInfrastructureProvisionerTest.java


示例2: setUp

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
  scheduler =
      spy(
          new WorkspaceFsBackupScheduler(
              Collections.singletonMap(ENV_TYPE, backupManager),
              workspaceRuntimes,
              BACKUP_TIMEOUT,
              workspaceManager));

  EnvironmentImpl environment = new EnvironmentImpl();
  EnvironmentRecipeImpl environmentRecipe = new EnvironmentRecipeImpl();
  environmentRecipe.setType(ENV_TYPE);
  environment.setRecipe(environmentRecipe);
  WorkspaceConfigImpl workspaceConfig = new WorkspaceConfigImpl();
  workspaceConfig.setEnvironments(Collections.singletonMap(ACTIVE_ENV, environment));
  this.workspaceConfig = spy(workspaceConfig);

  ids = new LinkedHashSet<>();
  addWorkspace(WORKSPACE_ID_1);
  addWorkspace(WORKSPACE_ID_2);
  when(workspaceRuntimes.getRuntimesIds()).thenReturn(ids);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:24,代码来源:WorkspaceFsBackupSchedulerTest.java


示例3: createWorkspace

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
/** Creates users workspace object based on the status and machines RAM. */
private static WorkspaceImpl createWorkspace(WorkspaceStatus status, Integer... machineRams) {
  final Map<String, MachineImpl> machines = new HashMap<>(machineRams.length - 1);
  final Map<String, MachineConfigImpl> machineConfigs = new HashMap<>(machineRams.length - 1);
  byte i = 1;
  for (Integer machineRam : machineRams) {
    final String machineName = "machine_" + i++;
    machines.put(machineName, createMachine(machineRam));
    machineConfigs.put(machineName, createMachineConfig(machineRam));
  }
  return WorkspaceImpl.builder()
      .setConfig(
          WorkspaceConfigImpl.builder()
              .setEnvironments(
                  ImmutableBiMap.of(ACTIVE_ENV_NAME, new EnvironmentImpl(null, machineConfigs)))
              .build())
      .setRuntime(new RuntimeImpl(ACTIVE_ENV_NAME, machines, null))
      .setStatus(status)
      .build();
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:RamResourceUsageTrackerTest.java


示例4: createEnv

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
public static EnvironmentImpl createEnv() {
  final RecipeImpl newRecipe = new RecipeImpl();
  newRecipe.setLocation("new-location");
  newRecipe.setType("new-type");
  newRecipe.setContentType("new-content-type");
  newRecipe.setContent("new-content");

  final MachineConfigImpl newMachine = new MachineConfigImpl();
  final ServerConfigImpl serverConf1 =
      new ServerConfigImpl("2265", "http", "/path1", singletonMap("key", "value"));
  final ServerConfigImpl serverConf2 =
      new ServerConfigImpl("2266", "ftp", "/path2", singletonMap("key", "value"));
  newMachine.setServers(ImmutableMap.of("ref1", serverConf1, "ref2", serverConf2));
  newMachine.setInstallers(ImmutableList.of("agent5", "agent4"));
  newMachine.setAttributes(singletonMap("att1", "val"));
  newMachine.setEnv(singletonMap("CHE_ENV", "value"));

  final EnvironmentImpl newEnv = new EnvironmentImpl();
  newEnv.setMachines(ImmutableMap.of("new-machine", newMachine));
  newEnv.setRecipe(newRecipe);
  return newEnv;
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:TestObjectsFactory.java


示例5: createEnvDto

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
private static EnvironmentDto createEnvDto() {
  final RecipeImpl environmentRecipe = new RecipeImpl();
  environmentRecipe.setType("type");
  environmentRecipe.setContent("content");
  environmentRecipe.setContentType("compose");
  environmentRecipe.setLocation("location");
  final EnvironmentImpl env = new EnvironmentImpl();
  final MachineConfigImpl extendedMachine = new MachineConfigImpl();
  extendedMachine.setInstallers(singletonList("agent"));
  extendedMachine.setAttributes(singletonMap("att1", "value"));
  extendedMachine.setServers(
      singletonMap(
          "agent", new ServerConfigImpl("5555", "https", "path", singletonMap("key", "value"))));
  env.setRecipe(environmentRecipe);
  env.setMachines(singletonMap("machine1", extendedMachine));
  return org.eclipse.che.api.workspace.server.DtoConverter.asDto(env);
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:FactoryServiceTest.java


示例6: shouldDeleteEnvironment

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@Test
public void shouldDeleteEnvironment() throws Exception {
  final WorkspaceImpl workspace = createWorkspace(createConfigDto());
  when(wsManager.getWorkspace(workspace.getId())).thenReturn(workspace);
  Map.Entry<String, EnvironmentImpl> envEntry =
      workspace.getConfig().getEnvironments().entrySet().iterator().next();

  final Response response =
      given()
          .auth()
          .basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD)
          .when()
          .delete(
              SECURE_PATH
                  + "/workspace/"
                  + workspace.getId()
                  + "/environment/"
                  + envEntry.getKey());

  assertEquals(response.getStatusCode(), 204);
  verify(wsManager).updateWorkspace(any(), any());
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:WorkspaceServiceTest.java


示例7: shouldUseRetrievedRecipeWhileInternalEnvironmentCreation

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@Test
public void shouldUseRetrievedRecipeWhileInternalEnvironmentCreation() throws Exception {
  // given
  RecipeImpl recipe = new RecipeImpl("type", "contentType", "content", "location");
  InternalRecipe retrievedRecipe = mock(InternalRecipe.class);
  doReturn(retrievedRecipe).when(recipeRetriever).getRecipe(any());

  EnvironmentImpl env = new EnvironmentImpl(recipe, null);

  // when
  environmentFactory.create(env);

  // then
  verify(recipeRetriever).getRecipe(recipe);
  verify(environmentFactory).doCreate(eq(retrievedRecipe), any(), any());
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:InternalEnvironmentFactoryTest.java


示例8: shouldUseRetrievedInstallerWhileInternalEnvironmentCreation

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@Test
public void shouldUseRetrievedInstallerWhileInternalEnvironmentCreation() throws Exception {
  // given
  List<Installer> installersToRetrieve = singletonList(mock(Installer.class));
  doReturn(installersToRetrieve).when(installerRegistry).getOrderedInstallers(anyList());

  List<String> sourceInstallers = singletonList("ws-agent");
  MachineConfigImpl machineConfig = new MachineConfigImpl().withInstallers(sourceInstallers);
  EnvironmentImpl env = new EnvironmentImpl(null, ImmutableMap.of("machine", machineConfig));

  // when
  environmentFactory.create(env);

  // then
  verify(installerRegistry).getOrderedInstallers(sourceInstallers);
  verify(environmentFactory).doCreate(any(), machinesCaptor.capture(), any());
  Map<String, InternalMachineConfig> internalMachines = machinesCaptor.getValue();
  assertEquals(internalMachines.get("machine").getInstallers(), installersToRetrieve);
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:InternalEnvironmentFactoryTest.java


示例9: shouldUseNormalizedServersWhileInternalEnvironmentCreation

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@Test
public void shouldUseNormalizedServersWhileInternalEnvironmentCreation() throws Exception {
  // given
  ServerConfigImpl server =
      new ServerConfigImpl("8080", "http", "/api", singletonMap("key", "value"));

  Map<String, ServerConfig> normalizedServers =
      ImmutableMap.of("server", mock(ServerConfig.class));
  doReturn(normalizedServers).when(environmentFactory).normalizeServers(any());

  ImmutableMap<String, ServerConfigImpl> sourceServers = ImmutableMap.of("server", server);
  MachineConfigImpl machineConfig = new MachineConfigImpl(null, sourceServers, null, null, null);

  EnvironmentImpl env = new EnvironmentImpl(null, ImmutableMap.of("machine", machineConfig));

  // when
  environmentFactory.create(env);

  // then
  verify(environmentFactory).normalizeServers(sourceServers);
  verify(environmentFactory).doCreate(any(), machinesCaptor.capture(), any());
  Map<String, InternalMachineConfig> internalMachines = machinesCaptor.getValue();
  assertEquals(internalMachines.get("machine").getServers(), normalizedServers);
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:InternalEnvironmentFactoryTest.java


示例10: mockWorkspace

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
private WorkspaceImpl mockWorkspace(RuntimeIdentity identity)
    throws NotFoundException, ServerException {
  EnvironmentImpl environment = mock(EnvironmentImpl.class);
  when(environment.getRecipe())
      .thenReturn(new RecipeImpl(TEST_ENVIRONMENT_TYPE, "contentType1", "content1", null));

  WorkspaceConfigImpl config = mock(WorkspaceConfigImpl.class);
  when(config.getEnvironments()).thenReturn(ImmutableMap.of(identity.getEnvName(), environment));

  WorkspaceImpl workspace = mock(WorkspaceImpl.class);
  when(workspace.getConfig()).thenReturn(config);
  when(workspace.getId()).thenReturn(identity.getWorkspaceId());
  when(workspace.getAttributes()).thenReturn(new HashMap<>());

  when(workspaceDao.get(identity.getWorkspaceId())).thenReturn(workspace);

  return workspace;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:WorkspaceRuntimesTest.java


示例11: createConfig

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
private static WorkspaceConfigImpl createConfig() {
  MachineConfigImpl machineConfig =
      new MachineConfigImpl(
          singletonList("org.eclipse.che.ws-agent"),
          null,
          singletonMap("CHE_ENV", "value"),
          singletonMap(MEMORY_LIMIT_ATTRIBUTE, "10000"),
          emptyMap());
  EnvironmentImpl environment =
      new EnvironmentImpl(
          new RecipeImpl("type", "contentType", "content", null),
          singletonMap("dev-machine", machineConfig));
  return WorkspaceConfigImpl.builder()
      .setName("dev-workspace")
      .setDefaultEnv("dev-env")
      .setEnvironments(singletonMap("dev-env", environment))
      .build();
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:WorkspaceManagerTest.java


示例12: configure

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClasses(
              OrganizationImpl.class,
              AccountImpl.class,
              WorkspaceImpl.class,
              WorkspaceConfigImpl.class,
              ProjectConfigImpl.class,
              EnvironmentImpl.class,
              ExtendedMachineImpl.class,
              CommandImpl.class,
              SourceStorageImpl.class,
              ServerConf2Impl.class,
              SnapshotImpl.class,
              InviteImpl.class)
          .addEntityClass(
              "org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute")
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());
  bind(DBInitializer.class).asEagerSingleton();
  bind(SchemaInitializer.class)
      .toInstance(
          new FlywaySchemaInitializer(server.getDataSource(), "che-schema", "codenvy-schema"));
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(new TypeLiteral<TckRepository<InviteImpl>>() {})
      .toInstance(new JpaTckRepository<>(InviteImpl.class));
  bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {})
      .toInstance(new JpaTckRepository<>(OrganizationImpl.class));
  bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {})
      .toInstance(new JpaTckRepository<>(WorkspaceImpl.class));

  bind(InviteDao.class).to(JpaInviteDao.class);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:40,代码来源:InviteJpaTckModule.java


示例13: provision

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@Override
public void provision(EnvironmentImpl envConfig, CheServicesEnvironmentImpl internalEnv)
    throws EnvironmentException {
  String devMachineName = getDevMachineName(envConfig);
  if (devMachineName == null) {
    throw new EnvironmentException("ws-machine is not found on agents applying");
  }
  CheServiceImpl devMachine = internalEnv.getServices().get(devMachineName);

  // dev-machine-only configuration
  HashMap<String, String> environmentVars = new HashMap<>(devMachine.getEnvironment());
  environmentVars.put(SYNC_KEY_ENV_VAR_NAME, pubSyncKey);
  // TODO is not used, but ws-agent doesn't start without it
  environmentVars.put(
      CheBootstrap.CHE_LOCAL_CONF_DIR, DockerExtConfBindingProvider.EXT_CHE_LOCAL_CONF_DIR);
  devMachine.setEnvironment(environmentVars);

  ExtendedMachineImpl extendedMachine = envConfig.getMachines().get(devMachineName);
  List<String> agents = new ArrayList<>(extendedMachine.getAgents());
  agents.add(agents.indexOf("org.eclipse.che.ws-agent"), "com.codenvy.rsync_in_machine");
  extendedMachine.setAgents(agents);

  List<String> volumes = new ArrayList<>(devMachine.getVolumes());
  volumes.add(projectFolder);
  devMachine.setVolumes(volumes);

  for (CheServiceImpl service : internalEnv.getServices().values()) {
    volumes = new ArrayList<>(service.getVolumes());
    volumes.addAll(
        SNAPSHOT_EXCLUDED_DIRECTORIES); // creates volume for each directory to exclude from a
    // snapshot
    service.setVolumes(volumes);
  }

  super.provision(envConfig, internalEnv);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:37,代码来源:CodenvyInContainerInfrastructureProvisioner.java


示例14: getUsedResource

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@Override
public Optional<Resource> getUsedResource(String accountId)
    throws NotFoundException, ServerException {
  final Account account = accountManager.getById(accountId);
  List<WorkspaceImpl> activeWorkspaces =
      Pages.stream(
              (maxItems, skipCount) ->
                  workspaceManagerProvider
                      .get()
                      .getByNamespace(account.getName(), true, maxItems, skipCount))
          .filter(ws -> STOPPED != ws.getStatus())
          .collect(Collectors.toList());
  long currentlyUsedRamMB = 0;
  for (WorkspaceImpl activeWorkspace : activeWorkspaces) {
    if (WorkspaceStatus.STARTING.equals(activeWorkspace.getStatus())) {
      // starting workspace may not have all machine in runtime
      // it is need to calculate ram from environment config
      final EnvironmentImpl startingEnvironment =
          activeWorkspace
              .getConfig()
              .getEnvironments()
              .get(activeWorkspace.getRuntime().getActiveEnv());
      currentlyUsedRamMB += environmentRamCalculator.calculate(startingEnvironment);
    } else {
      currentlyUsedRamMB += environmentRamCalculator.calculate(activeWorkspace.getRuntime());
    }
  }

  if (currentlyUsedRamMB > 0) {
    return Optional.of(
        new ResourceImpl(RamResourceType.ID, currentlyUsedRamMB, RamResourceType.UNIT));
  } else {
    return Optional.empty();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:36,代码来源:RamResourceUsageTracker.java


示例15: createEnvironment

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
public static EnvironmentImpl createEnvironment(String devMachineRam, String... machineRams)
    throws Exception {
  return null; /*
               Map<String, ExtendedMachineImpl> machines = new HashMap<>();
               machines.put(
                   "dev-machine",
                   new ExtendedMachineImpl(
                       singletonList("org.eclipse.che.ws-agent"),
                       emptyMap(),
                       singletonMap("memoryLimitBytes", Long.toString(Size.parseSize(devMachineRam)))));
               HashMap<String, ComposeServiceImpl> services = new HashMap<>(1 + machineRams.length);
               services.put("dev-machine", createService());
               for (int i = 0; i < machineRams.length; i++) {
                 services.put("machine" + i, createService());
                 // null is allowed to reproduce situation with default RAM size
                 if (machineRams[i] != null) {
                   machines.put(
                       "machine" + i,
                       new ExtendedMachineImpl(
                           null,
                           null,
                           singletonMap("memoryLimitBytes", Long.toString(Size.parseSize(machineRams[i])))));
                 }
               }
               ComposeEnvironment composeEnvironment = new ComposeEnvironment();
               composeEnvironment.setServices(services);
               String yaml = YAML_PARSER.writeValueAsString(composeEnvironment);
               EnvironmentRecipeImpl recipe =
                   new EnvironmentRecipeImpl("compose", "application/x-yaml", yaml, null);

               return new EnvironmentImpl(recipe, machines);*/
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:TestObjects.java


示例16: create

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@Override
public DockerImageEnvironment create(Environment sourceEnv)
    throws InfrastructureException, ValidationException {
  if (sourceEnv.getRecipe().getLocation() != null) {
    // move image from location to content
    EnvironmentImpl envCopy = new EnvironmentImpl(sourceEnv);
    envCopy.getRecipe().setContent(sourceEnv.getRecipe().getLocation());
    envCopy.getRecipe().setLocation(null);
    return super.create(envCopy);
  }
  return super.create(sourceEnv);
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:DockerImageEnvironmentFactory.java


示例17: createWorkspaceConfig

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
private static WorkspaceConfig createWorkspaceConfig(String type, String location) {
  return WorkspaceConfigImpl.builder()
      .setName(WORKSPACE_NAME)
      .setEnvironments(singletonMap("env1", new EnvironmentImpl(createEnvDto())))
      .setProjects(createProjects(type, location))
      .build();
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:FactoryServiceTest.java


示例18: addEnvironment

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@POST
@Path("/{id}/environment")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(
  value = "Add a new environment to the workspace",
  notes = "This operation can be performed only by the workspace owner"
)
@ApiResponses({
  @ApiResponse(code = 200, message = "The workspace successfully updated"),
  @ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"),
  @ApiResponse(code = 403, message = "The user does not have access to add the environment"),
  @ApiResponse(code = 404, message = "The workspace not found"),
  @ApiResponse(code = 409, message = "Environment with such name already exists"),
  @ApiResponse(code = 500, message = "Internal server error occurred")
})
public WorkspaceDto addEnvironment(
    @ApiParam("The workspace id") @PathParam("id") String id,
    @ApiParam(value = "The new environment", required = true) EnvironmentDto newEnvironment,
    @ApiParam(value = "The name of the environment", required = true) @QueryParam("name")
        String envName)
    throws ServerException, BadRequestException, NotFoundException, ConflictException,
        ForbiddenException {
  requiredNotNull(newEnvironment, "New environment");
  requiredNotNull(envName, "New environment name");
  relativizeRecipeLinks(newEnvironment);
  WorkspaceImpl workspace = workspaceManager.getWorkspace(id);
  workspace.getConfig().getEnvironments().put(envName, new EnvironmentImpl(newEnvironment));
  return asDtoWithLinksAndToken(doUpdate(id, workspace));
}
 
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:WorkspaceService.java


示例19: updateEnvironment

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
@PUT
@Path("/{id}/environment/{name}")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(
  value = "Update the workspace environment by replacing it with a new one",
  notes = "This operation can be performed only by the workspace owner"
)
@ApiResponses({
  @ApiResponse(code = 200, message = "The environment successfully updated"),
  @ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"),
  @ApiResponse(code = 403, message = "The user does not have access to update the environment"),
  @ApiResponse(code = 404, message = "The workspace or the environment not found"),
  @ApiResponse(code = 500, message = "Internal server error occurred")
})
public WorkspaceDto updateEnvironment(
    @ApiParam("The workspace id") @PathParam("id") String id,
    @ApiParam("The name of the environment") @PathParam("name") String envName,
    @ApiParam(value = "The environment update", required = true) EnvironmentDto update)
    throws ServerException, BadRequestException, NotFoundException, ConflictException,
        ForbiddenException {
  requiredNotNull(update, "Environment description");
  relativizeRecipeLinks(update);
  final WorkspaceImpl workspace = workspaceManager.getWorkspace(id);
  EnvironmentImpl previous =
      workspace.getConfig().getEnvironments().put(envName, new EnvironmentImpl(update));
  if (previous == null) {
    throw new NotFoundException(
        format("Workspace '%s' doesn't contain environment '%s'", id, envName));
  }
  return asDtoWithLinksAndToken(doUpdate(id, workspace));
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:WorkspaceService.java


示例20: copyEnv

import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl; //导入依赖的package包/类
private static EnvironmentImpl copyEnv(Workspace workspace, String envName) {

    requireNonNull(workspace, "Workspace should not be null.");
    requireNonNull(envName, "Environment name should not be null.");
    final Environment environment = workspace.getConfig().getEnvironments().get(envName);
    if (environment == null) {
      throw new IllegalArgumentException(
          format("Workspace '%s' doesn't contain environment '%s'", workspace.getId(), envName));
    }
    return new EnvironmentImpl(environment);
  }
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:WorkspaceRuntimes.java



注:本文中的org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TestJPF类代码示例发布时间:2022-05-16
下一篇:
Java SQLObjectRuntimeException类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap