Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ability to specify cache on mesos artifact
- Loading branch information
Showing
4 changed files
with
118 additions
and
9 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
SingularityBase/src/main/java/com/hubspot/mesos/SingularityMesosArtifact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,85 @@ | |||
package com.hubspot.mesos; | |||
|
|||
import com.fasterxml.jackson.annotation.JsonCreator; | |||
import com.fasterxml.jackson.annotation.JsonProperty; | |||
|
|||
public class SingularityMesosArtifact { | |||
private final String uri; | |||
private final boolean cache; | |||
private final boolean executable; | |||
private final boolean extract; | |||
|
|||
@JsonCreator | |||
public static SingularityMesosArtifact fromString(String uri) { | |||
return new SingularityMesosArtifact(uri, false, false, false); | |||
} | |||
|
|||
@JsonCreator | |||
public SingularityMesosArtifact(@JsonProperty("uri") String uri, | |||
@JsonProperty("cache") boolean cache, | |||
@JsonProperty("executable") boolean executable, | |||
@JsonProperty("extract") boolean extract) { | |||
this.uri = uri; | |||
this.cache = cache; | |||
this.executable = executable; | |||
this.extract = extract; | |||
} | |||
|
|||
public String getUri() { | |||
return uri; | |||
} | |||
|
|||
public boolean isCache() { | |||
return cache; | |||
} | |||
|
|||
public boolean isExecutable() { | |||
return executable; | |||
} | |||
|
|||
public boolean isExtract() { | |||
return extract; | |||
} | |||
|
|||
@Override | |||
public boolean equals(Object o) { | |||
if (this == o) { | |||
return true; | |||
} | |||
if (o == null || getClass() != o.getClass()) { | |||
return false; | |||
} | |||
|
|||
SingularityMesosArtifact that = (SingularityMesosArtifact) o; | |||
|
|||
if (cache != that.cache) { | |||
return false; | |||
} | |||
if (executable != that.executable) { | |||
return false; | |||
} | |||
if (extract != that.extract) { | |||
return false; | |||
} | |||
return uri != null ? uri.equals(that.uri) : that.uri == null; | |||
} | |||
|
|||
@Override | |||
public int hashCode() { | |||
int result = uri != null ? uri.hashCode() : 0; | |||
result = 31 * result + (cache ? 1 : 0); | |||
result = 31 * result + (executable ? 1 : 0); | |||
result = 31 * result + (extract ? 1 : 0); | |||
return result; | |||
} | |||
|
|||
@Override | |||
public String toString() { | |||
return "SingularityMesosArtifact{" + | |||
"uri='" + uri + '\'' + | |||
", cache=" + cache + | |||
", executable=" + executable + | |||
", extract=" + extract + | |||
'}'; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters