summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/virtualization/configuration/container/ContainerBindMount.java
blob: 0c1788ed0fe964565f0fc91a65bca3fa3a02a5ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package org.openslx.virtualization.configuration.container;

import java.util.Objects;

/**
 * This class implements a model for a bind mount entry in the docker context
 * (eg. docker run  ... --mount type=bind,source=source,target=target,options ... ). A list of objects of this class is stored in
 * {@link ContainerMeta}.
 */
public class ContainerBindMount {

	public enum ContainerMountType {
		DEFAULT,
		CONTAINER_IMAGE
	}

	private ContainerMountType mount_type = ContainerMountType.DEFAULT;
	private String source = "";
	private String target = "";
	private String options = "";

	public ContainerBindMount() {
	}

	public ContainerBindMount(String source, String target, String options) {
		this(ContainerMountType.DEFAULT,source,target,options);
	}

	public ContainerBindMount(ContainerMountType mount_type, String source, String target, String options) {
		this.mount_type = mount_type;
		this.source = source;
		this.target = target;
		this.options = options;
	}

	public String getSource() {
		return source;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public String getOptions() {
		return options;
	}

	public void setOptions(String options) {
		this.options = options;
	}

	public ContainerMountType getMountType() {
		return this.mount_type;
	}


	@Override public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;
		ContainerBindMount that = (ContainerBindMount) o;
		return Objects.equals(source, that.source) && Objects.equals(mount_type, that.mount_type)
				&& Objects.equals(target, that.target) && Objects.equals(options, that.options);
	}

	@Override public int hashCode() {
		return Objects.hash(source, target, options);
	}
}