Skip to content

Commit

Permalink
Bug 422288 - Use docker.io to enhance the Orion shell capability
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Hunter committed Nov 26, 2013
1 parent ad54c9b commit ef0f602
Show file tree
Hide file tree
Showing 7 changed files with 711 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/*******************************************************************************
* Copyright (c) 2013 IBM Corporation and others.
* 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.orion.internal.server.servlets.docker;

/**
* The response for container requests using the Docker Remote API.
*
* @author Anthony Hunter
*/
public class DockerContainer extends DockerResponse {

public static final String COMMAND = "Command";

public static final String CREATED = "Created";

public static final String ID = "Id";

public static final String IMAGE = "Image";

public static final String NAME = "Name";

public static final String NAMES = "Names";

public static final String PORTS = "Ports";

public static final String SIZE_ROOT_FS = "SizeRootFs";

public static final String SIZE_RW = "SizeRw";

public static final String STATUS = "Status";

private String command;

private String created;

private String id;

private String image;

private String name;

private String ports;

private int size;

private int sizeRootFs;

private String status;

public String getCommand() {
return command;
}

public String getCreated() {
return created;
}

public String getId() {
return id;
}

public String getImage() {
return image;
}

public String getName() {
return name;
}

public String getPorts() {
return ports;
}

public int getSize() {
return size;
}

public int getSizeRootFs() {
return sizeRootFs;
}

public String getStatus() {
return status;
}

public void setCommand(String command) {
this.command = command;
}

public void setCreated(String created) {
this.created = created;
}

public void setId(String id) {
this.id = id;
}

public void setImage(String image) {
this.image = image;
}

public void setName(String name) {
this.name = name;
}

public void setPorts(String ports) {
this.ports = ports;
}

public void setSize(int size) {
this.size = size;
}

public void setSizeRootFs(int sizeRootFs) {
this.sizeRootFs = sizeRootFs;
}

public void setStatus(String status) {
this.status = status;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2013 IBM Corporation and others.
* 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.orion.internal.server.servlets.docker;

import java.util.ArrayList;
import java.util.List;

/**
* The response for container list request using the Docker Remote API.
*
* @author Anthony Hunter
*/
public class DockerContainers extends DockerResponse {
private List<DockerContainer> containers;

public DockerContainers() {
super();
this.containers = new ArrayList<DockerContainer>();
}

public List<DockerContainer> getContainers() {
return containers;
}

public void addContainer(DockerContainer Container) {
this.containers.add(Container);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*******************************************************************************
* Copyright (c) 2013 IBM Corporation and others.
* 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.orion.internal.server.servlets.docker;

import java.util.ArrayList;
import java.util.List;

/**
* The response for image requests using the Docker Remote API.
*
* @author Anthony Hunter
*/
public class DockerImage extends DockerResponse {

public static final String CREATED = "Created";

public static final String ID = "Id";

public static final String REPOTAGS = "RepoTags";

public static final String SIZE = "Size";

public static final String VIRTUAL_SIZE = "VirtualSize";

private String created;

private String id;

private String repository;

private long size;

private List<String> tags;

private long virtualSize;

public DockerImage() {
super();
this.tags = new ArrayList<String>();
}

public void addTag(String repoTag) {
this.tags.add(repoTag);
}

public String getCreated() {
return created;
}

public String getId() {
return id;
}

public String getRepository() {
return repository;
}

public long getSize() {
return size;
}

public List<String> getTags() {
return tags;
}

public long getVirtualSize() {
return virtualSize;
}

public void setCreated(String created) {
this.created = created;
}

public void setId(String id) {
this.id = id;
}

public void setRepository(String repository) {
this.repository = repository;
}

public void setSize(long size) {
this.size = size;
}

public void setVirtualSize(long virtualSize) {
this.virtualSize = virtualSize;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2013 IBM Corporation and others.
* 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.orion.internal.server.servlets.docker;

import java.util.ArrayList;
import java.util.List;

/**
* The response for image list request using the Docker Remote API.
*
* @author Anthony Hunter
*/
public class DockerImages extends DockerResponse {
private List<DockerImage> images;

public DockerImages() {
super();
this.images = new ArrayList<DockerImage>();
}

public List<DockerImage> getImages() {
return images;
}

public void addImage(DockerImage image) {
this.images.add(image);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ public class DockerResponse {
/**
* Http status code returned from Docker
* 200 - no error, OK
* 201 - no error, created
* 400 - bad parameter
* 404 - no such image or container
* 500 - server error
*/
public enum StatusCode {
BAD_PARAMETER, OK, SERVER_ERROR
BAD_PARAMETER, CREATED, OK, SERVER_ERROR, NO_SUCH_CONTAINER, NO_SUCH_IMAGE
};

private StatusCode statusCode;
Expand Down
Loading

0 comments on commit ef0f602

Please sign in to comment.