Skip to content

Commit

Permalink
Merge branch 'master' into openshift_init_patch3
Browse files Browse the repository at this point in the history
Signed-off-by: James Drummond <james@devcomb.com>
  • Loading branch information
devcomb committed Jan 15, 2018
2 parents f851c2a + 4b0e2da commit 405f09a
Show file tree
Hide file tree
Showing 8,083 changed files with 14,840 additions and 10,242 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Eclipse Che - Eclipse Next-Generation IDE
[![Eclipse License](https://img.shields.io/badge/license-Eclipse-brightgreen.svg)](https://github.com/codenvy/che/blob/master/LICENSE)
[![Build Status](https://ci.codenvycorp.com/buildStatus/icon?job=che-ci-master)](https://ci.codenvycorp.com/job/che-ci-master)
[![Build Status](https://ci.codenvycorp.com/buildStatus/icon?job=che-master-ci)](https://ci.codenvycorp.com/job/che-master-ci)

https://www.eclipse.org/che/. Next-generation Eclipse platform, developer workspace server and cloud IDE. Che defines workspaces that include their dependencies including embedded containerized runtimes, Web IDE, and project code. This makes workspaces distributed, collaborative, and portable to run anywhere on a desktop or a server ... [Read More](https://www.eclipse.org/che/features/)

Expand Down
2 changes: 1 addition & 1 deletion agents/bootstrapper/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012-2017 Red Hat, Inc.
Copyright (c) 2012-2018 Red Hat, Inc.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
Expand Down
2 changes: 1 addition & 1 deletion agents/bootstrapper/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Copyright (c) 2012-2017 Red Hat, Inc.
Copyright (c) 2012-2018 Red Hat, Inc.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
Expand Down
50 changes: 50 additions & 0 deletions agents/exec/che-exec-agent-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012-2018 Red Hat, Inc.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Red Hat, Inc. - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>exec-agent-parent</artifactId>
<groupId>org.eclipse.che</groupId>
<version>6.0.0-M5-SNAPSHOT</version>
</parent>
<artifactId>che-exec-agent-client</artifactId>
<packaging>jar</packaging>
<name>Agent :: Exec :: Client</name>
<dependencies>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che</groupId>
<artifactId>che-exec-agent-shared</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-workspace</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.agent.exec.client;

import static org.eclipse.che.dto.server.DtoFactory.newDto;

import com.google.inject.assistedinject.Assisted;
import java.io.IOException;
import javax.inject.Inject;
import org.eclipse.che.agent.exec.shared.dto.GetProcessResponseDto;
import org.eclipse.che.agent.exec.shared.dto.ProcessKillResponseDto;
import org.eclipse.che.agent.exec.shared.dto.ProcessStartRequestDto;
import org.eclipse.che.agent.exec.shared.dto.ProcessStartResponseDto;
import org.eclipse.che.api.core.ApiException;
import org.eclipse.che.api.core.ServerException;
import org.eclipse.che.api.core.rest.HttpJsonRequestFactory;
import org.eclipse.che.api.workspace.server.token.MachineTokenException;
import org.eclipse.che.api.workspace.server.token.MachineTokenProvider;

/**
* Helps to interact with exec agent via REST.
*
* @author Max Shaposhnik (mshaposh@redhat.com)
*/
public class ExecAgentClient {

private final HttpJsonRequestFactory requestFactory;
private final MachineTokenProvider machineTokenProvider;
private final String serverEndpoint;

@Inject
public ExecAgentClient(
HttpJsonRequestFactory requestFactory,
MachineTokenProvider machineTokenProvider,
@Assisted String serverEndpoint) {
this.requestFactory = requestFactory;
this.machineTokenProvider = machineTokenProvider;
this.serverEndpoint = serverEndpoint;
}

/**
* Starts a process within a given command.
*
* @param workspaceId workspace to run command
* @param command command to execute
* @param name command name
* @param type command type
* @return start process response DTO
* @throws ServerException when submit of the process is failed
*/
public ProcessStartResponseDto startProcess(
String workspaceId, String command, String name, String type) throws ServerException {
ProcessStartRequestDto commandDto =
newDto(ProcessStartRequestDto.class).withCommandLine(command).withName(name).withType(type);
try {
return requestFactory
.fromUrl(serverEndpoint)
.addQueryParam("token", machineTokenProvider.getToken(workspaceId))
.setAuthorizationHeader("none") // to prevent sending KC token
.usePostMethod()
.setBody(commandDto)
.request()
.asDto(ProcessStartResponseDto.class);
} catch (IOException | ApiException | MachineTokenException e) {
throw new ServerException(e);
}
}

/**
* Gets information about started process.
*
* @param workspaceId workspace to get process
* @param pid pid of started process
* @return process response DTO
* @throws ServerException when get of the process is failed
*/
public GetProcessResponseDto getProcess(String workspaceId, int pid) throws ServerException {
try {
return requestFactory
.fromUrl(serverEndpoint + "/" + pid)
.addQueryParam("token", machineTokenProvider.getToken(workspaceId))
.setAuthorizationHeader("none") // to prevent sending KC token
.useGetMethod()
.request()
.asDto(GetProcessResponseDto.class);
} catch (IOException | ApiException | MachineTokenException e) {
throw new ServerException(e);
}
}

/**
* Kills started process.
*
* @param workspaceId workspace kill process
* @param pid pid of started process
* @return kill process response DTO
* @throws ServerException when kill of the process is failed
*/
public ProcessKillResponseDto killProcess(String workspaceId, int pid) throws ServerException {
try {
return requestFactory
.fromUrl(serverEndpoint + "/" + pid)
.useDeleteMethod()
.addQueryParam("token", machineTokenProvider.getToken(workspaceId))
.setAuthorizationHeader("none") // to prevent sending KC token
.request()
.asDto(ProcessKillResponseDto.class);
} catch (IOException | ApiException | MachineTokenException e) {
throw new ServerException(e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.agent.exec.client;

/**
* Creates instances of {@link ExecAgentClient} with given exec server endpoint.
*
* @author Max Shaposhnik (mshaposh@redhat.com)
*/
public interface ExecAgentClientFactory {

ExecAgentClient create(String serverEndpoint);
}
115 changes: 115 additions & 0 deletions agents/exec/che-exec-agent-shared/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012-2018 Red Hat, Inc.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Red Hat, Inc. - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>exec-agent-parent</artifactId>
<groupId>org.eclipse.che</groupId>
<version>6.0.0-M5-SNAPSHOT</version>
</parent>
<artifactId>che-exec-agent-shared</artifactId>
<packaging>jar</packaging>
<name>Agent :: Exec :: Shared</name>
<properties>
<dto-generator-out-directory>${project.build.directory}/generated-sources/dto/</dto-generator-out-directory>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-resource</id>
<phase>process-sources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${dto-generator-out-directory}/META-INF</directory>
<targetPath>META-INF</targetPath>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>add-source</id>
<phase>process-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${dto-generator-out-directory}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>pre-compile</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto-maven-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>server</id>
<phase>process-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dtoPackages>
<package>org.eclipse.che.agent.exec.shared.dto</package>
</dtoPackages>
<outputDirectory>${dto-generator-out-directory}</outputDirectory>
<genClassName>org.eclipse.che.agent.exec.shared.dto.server.DtoServerImpls</genClassName>
<impl>server</impl>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.eclipse.che</groupId>
<artifactId>che-exec-agent-shared</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* Copyright (c) 2012-2018 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.ide.api.command.exec.dto.event;
package org.eclipse.che.agent.exec.shared.dto;

public interface DtoWithPid {
int getPid();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* Copyright (c) 2012-2018 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -8,10 +8,9 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.ide.api.command.exec.dto;
package org.eclipse.che.agent.exec.shared.dto;

import org.eclipse.che.dto.shared.DTO;
import org.eclipse.che.ide.api.command.exec.dto.event.DtoWithPid;

@DTO
public interface GetProcessLogsRequestDto extends DtoWithPid {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* Copyright (c) 2012-2018 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.ide.api.command.exec.dto;
package org.eclipse.che.agent.exec.shared.dto;

import org.eclipse.che.dto.shared.DTO;

Expand Down
Loading

0 comments on commit 405f09a

Please sign in to comment.