Skip to content

Commit

Permalink
Moving docker runner to Che: Renaming java packages
Browse files Browse the repository at this point in the history
  • Loading branch information
sunix committed Apr 23, 2015
1 parent 1da3e49 commit 05dc5db
Show file tree
Hide file tree
Showing 44 changed files with 97 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,8 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker;

import com.codenvy.docker.json.ContainerConfig;
import com.codenvy.docker.json.ContainerCreated;
import com.codenvy.docker.json.ContainerExitStatus;
import com.codenvy.docker.json.ContainerInfo;
import com.codenvy.docker.json.ContainerProcesses;
import com.codenvy.docker.json.ContainerResource;
import com.codenvy.docker.json.ExecConfig;
import com.codenvy.docker.json.ExecCreated;
import com.codenvy.docker.json.ExecStart;
import com.codenvy.docker.json.HostConfig;
import com.codenvy.docker.json.Image;
import com.codenvy.docker.json.ImageInfo;
package org.eclipse.che.docker;

import com.google.common.io.ByteStreams;
import com.google.common.io.CharStreams;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
Expand All @@ -41,10 +29,23 @@
import org.eclipse.che.commons.lang.Pair;
import org.eclipse.che.commons.lang.Size;
import org.eclipse.che.commons.lang.TarUtils;
import org.eclipse.che.docker.json.ContainerConfig;
import org.eclipse.che.docker.json.ContainerCreated;
import org.eclipse.che.docker.json.ContainerExitStatus;
import org.eclipse.che.docker.json.ContainerInfo;
import org.eclipse.che.docker.json.ContainerProcesses;
import org.eclipse.che.docker.json.ContainerResource;
import org.eclipse.che.docker.json.ExecConfig;
import org.eclipse.che.docker.json.ExecCreated;
import org.eclipse.che.docker.json.ExecStart;
import org.eclipse.che.docker.json.HostConfig;
import org.eclipse.che.docker.json.Image;
import org.eclipse.che.docker.json.ImageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Singleton;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
Expand Down Expand Up @@ -343,7 +344,7 @@ public DockerConnector() {
* @return system-wide information
* @throws IOException
*/
public com.codenvy.docker.json.SystemInfo getSystemInfo() throws IOException {
public org.eclipse.che.docker.json.SystemInfo getSystemInfo() throws IOException {
final int fd = connect();
try {
final DockerResponse response = request(fd, "GET", "/info", Collections.<Pair<String, ?>>emptyList(), (String)null);
Expand All @@ -352,7 +353,7 @@ public com.codenvy.docker.json.SystemInfo getSystemInfo() throws IOException {
final String msg = CharStreams.toString(new InputStreamReader(response.getInputStream()));
throw new DockerException(String.format("Error response from docker API, status: %d, message: %s", status, msg), status);
}
return JsonHelper.fromJson(response.getInputStream(), com.codenvy.docker.json.SystemInfo.class, null, FIRST_LETTER_LOWERCASE);
return JsonHelper.fromJson(response.getInputStream(), org.eclipse.che.docker.json.SystemInfo.class, null, FIRST_LETTER_LOWERCASE);
} catch (JsonParseException e) {
throw new IOException(e.getMessage(), e);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker;
package org.eclipse.che.docker;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker;
package org.eclipse.che.docker;

import org.eclipse.che.api.core.ApiException;
import org.eclipse.che.api.core.rest.shared.dto.ServiceError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker;
package org.eclipse.che.docker;

import org.eclipse.che.commons.lang.Pair;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker;
package org.eclipse.che.docker;

import java.io.FileWriter;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker;
package org.eclipse.che.docker;

import org.eclipse.che.commons.lang.Pair;
import com.google.common.io.CharSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/**
* @author andrew00x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

import java.util.Arrays;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/** @author andrew00x */
public class ContainerExitStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

import java.util.Arrays;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/**
* @author andrew00x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/**
* @author andrew00x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/** @author andrew00x */
public class ContainerState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/**
* @author andrew00x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/**
* @author andrew00x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/**
* @author andrew00x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

import java.util.Arrays;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/** @author andrew00x */
public class Image {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

import java.util.Arrays;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/**
* @author andrew00x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/** @author andrew00x */
public class LxcConfParam {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/** @author andrew00x */
public class PortBinding {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

import org.eclipse.che.commons.lang.Size;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker.json;
package org.eclipse.che.docker.json;

/**
* @author andrew00x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker;
package org.eclipse.che.docker;

import org.eclipse.che.commons.lang.Pair;

import org.eclipse.che.docker.DockerImage;
import org.eclipse.che.docker.Dockerfile;
import org.eclipse.che.docker.DockerfileParser;
import org.junit.Test;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.docker;

import com.codenvy.docker.json.SystemInfo;
package org.eclipse.che.docker;

import org.eclipse.che.docker.json.SystemInfo;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.runner.docker;
package org.eclipse.che.runner.docker;

/**
* @author andrew00x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package com.codenvy.runner.docker;

import com.codenvy.docker.DockerConnector;
import com.codenvy.docker.DockerException;
import com.codenvy.docker.DockerFileException;
import com.codenvy.docker.DockerImage;
import com.codenvy.docker.Dockerfile;
import com.codenvy.docker.json.BuildImageStatus;
import com.codenvy.docker.json.ContainerConfig;
import com.codenvy.docker.json.ContainerCreated;
import com.codenvy.docker.json.ExposedPort;
import com.codenvy.docker.json.HostConfig;
import com.codenvy.docker.json.ImageInfo;
import com.codenvy.docker.json.PortBinding;
package org.eclipse.che.runner.docker;

import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.core.rest.shared.dto.Link;
Expand Down Expand Up @@ -53,6 +40,18 @@
import org.eclipse.che.commons.lang.Pair;
import org.eclipse.che.commons.lang.TarUtils;
import org.eclipse.che.commons.lang.ZipUtils;
import org.eclipse.che.docker.DockerConnector;
import org.eclipse.che.docker.DockerException;
import org.eclipse.che.docker.DockerFileException;
import org.eclipse.che.docker.DockerImage;
import org.eclipse.che.docker.Dockerfile;
import org.eclipse.che.docker.json.BuildImageStatus;
import org.eclipse.che.docker.json.ContainerConfig;
import org.eclipse.che.docker.json.ContainerCreated;
import org.eclipse.che.docker.json.ExposedPort;
import org.eclipse.che.docker.json.HostConfig;
import org.eclipse.che.docker.json.ImageInfo;
import org.eclipse.che.docker.json.PortBinding;
import org.eclipse.che.dto.server.DtoFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -176,13 +175,13 @@ public RunnerConfiguration createRunnerConfiguration(RunRequest request) throws
public List<RunnerMetric> getStats() throws RunnerException {
final List<RunnerMetric> stats = super.getStats();
try {
final com.codenvy.docker.json.SystemInfo systemInfo = dockerConnector.getSystemInfo();
final org.eclipse.che.docker.json.SystemInfo systemInfo = dockerConnector.getSystemInfo();
final DtoFactory dtoFactory = DtoFactory.getInstance();
final String dataSpaceTotal = systemInfo.statusField(com.codenvy.docker.json.SystemInfo.DRIVER_STATE_DATA_SPACE_TOTAL);
final String dataSpaceTotal = systemInfo.statusField(org.eclipse.che.docker.json.SystemInfo.DRIVER_STATE_DATA_SPACE_TOTAL);
if (dataSpaceTotal != null) {
stats.add(dtoFactory.createDto(RunnerMetric.class).withName(RunnerMetric.DISK_SPACE_TOTAL).withValue(dataSpaceTotal));
}
final String dataSpaceUsed = systemInfo.statusField(com.codenvy.docker.json.SystemInfo.DRIVER_STATE_DATA_SPACE_USED);
final String dataSpaceUsed = systemInfo.statusField(org.eclipse.che.docker.json.SystemInfo.DRIVER_STATE_DATA_SPACE_USED);
if (dataSpaceUsed != null) {
stats.add(dtoFactory.createDto(RunnerMetric.class).withName(RunnerMetric.DISK_SPACE_USED).withValue(dataSpaceUsed));
}
Expand Down
Loading

0 comments on commit 05dc5db

Please sign in to comment.