You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Roman Coedo <no...@github.com> on 2014/07/15 23:12:04 UTC
[jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Now the job status is stored as an enum instead of
a String. This is useful when comparing the status to
check if a job is completed, failed or still in progress.
You can merge this Pull Request by running:
git pull https://github.com/rcoedo/jclouds-labs-aws jobstatus
Or you can view, comment on it, or merge it online at:
https://github.com/jclouds/jclouds-labs-aws/pull/38
-- Commit Summary --
* JCLOUDS-457: JobStatus has been added
-- File Changes --
M glacier/src/main/java/org/jclouds/glacier/domain/JobMetadata.java (6)
A glacier/src/main/java/org/jclouds/glacier/domain/JobStatus.java (48)
-- Patch Links --
https://github.com/jclouds/jclouds-labs-aws/pull/38.patch
https://github.com/jclouds/jclouds-labs-aws/pull/38.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by Roman Coedo <no...@github.com>.
> +import java.util.Map;
> +
> +import com.google.common.collect.ImmutableMap;
> +
> +public enum JobStatus {
> + SUCCEEDED("Succeeded"),
> + FAILED("Failed"),
> + IN_PROGRESS("InProgress");
> +
> + private final String value;
> +
> + private static final Map<String, JobStatus> stringToEnum = ImmutableMap.of("Succeeded", SUCCEEDED,
> + "Failed", FAILED, "InProgress", IN_PROGRESS);
> +
> + public static JobStatus fromString(String symbol) {
> + return stringToEnum.get(symbol);
Is there a guava class for each problem in life? Thanks Andrew, I'll fix this :)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38/files#r14964523
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-aws-pull-requests #84](https://jclouds.ci.cloudbees.com/job/jclouds-labs-aws-pull-requests/84/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38#issuecomment-49099926
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by Andrew Gaul <no...@github.com>.
> +import java.util.Map;
> +
> +import com.google.common.collect.ImmutableMap;
> +
> +public enum JobStatus {
> + SUCCEEDED("Succeeded"),
> + FAILED("Failed"),
> + IN_PROGRESS("InProgress");
> +
> + private final String value;
> +
> + private static final Map<String, JobStatus> stringToEnum = ImmutableMap.of("Succeeded", SUCCEEDED,
> + "Failed", FAILED, "InProgress", IN_PROGRESS);
> +
> + public static JobStatus fromString(String symbol) {
> + return stringToEnum.get(symbol);
Sorry again, you also might be able to use `JobStatus.valueOf(String)`.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38/files#r14964557
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by Andrew Gaul <no...@github.com>.
> +import java.util.Map;
> +
> +import com.google.common.collect.ImmutableMap;
> +
> +public enum JobStatus {
> + SUCCEEDED("Succeeded"),
> + FAILED("Failed"),
> + IN_PROGRESS("InProgress");
> +
> + private final String value;
> +
> + private static final Map<String, JobStatus> stringToEnum = ImmutableMap.of("Succeeded", SUCCEEDED,
> + "Failed", FAILED, "InProgress", IN_PROGRESS);
> +
> + public static JobStatus fromString(String symbol) {
> + return stringToEnum.get(symbol);
Can you call `CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, symbol)` instead?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38/files#r14963919
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs-aws #1140](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs-aws/1140/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38#issuecomment-49094063
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by Andrew Gaul <no...@github.com>.
Pushed to master as 7165bf46d0499607e07ba244baf1451c81da6291.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38#issuecomment-49100173
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by Andrew Gaul <no...@github.com>.
> + "Failed", FAILED, "InProgress", IN_PROGRESS);
> +
> + public static JobStatus fromString(String symbol) {
> + return stringToEnum.get(symbol);
> + }
> +
> + public String getValue() {
> + return this.value;
> + }
> +
> + public String toString() {
> + return this.value;
> + }
> +
> + JobStatus(String value) {
> + this.value = value;
Do you need to store value at all if you use `CaseFormat`?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38/files#r14963958
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by Andrew Gaul <no...@github.com>.
> +import java.util.Map;
> +
> +import com.google.common.collect.ImmutableMap;
> +
> +public enum JobStatus {
> + SUCCEEDED("Succeeded"),
> + FAILED("Failed"),
> + IN_PROGRESS("InProgress");
> +
> + private final String value;
> +
> + private static final Map<String, JobStatus> stringToEnum = ImmutableMap.of("Succeeded", SUCCEEDED,
> + "Failed", FAILED, "InProgress", IN_PROGRESS);
> +
> + public static JobStatus fromString(String symbol) {
> + return stringToEnum.get(symbol);
Sorry I see what you are doing here. Instead you can build up the `Map` via:
```
private static final Map<String, JobStatus> STRING_TO_ENUM;
static {
ImmutableMap.Builder<String, JobStatus> builder = ImmutableMap.builder();
for (JobStatus status : values()) {
builder.add(CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, status.toString(), status);
}
STRING_TO_ENUM = builder.build();
}
```
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38/files#r14964298
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs-aws #1141](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs-aws/1141/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38#issuecomment-49099945
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by Andrew Gaul <no...@github.com>.
Closed #38.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38#event-141930417
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by Andrew Gaul <no...@github.com>.
Nit: active voice in commit messages, e.g., "Add JobStatus" is more clear and succinct.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38#issuecomment-49094018
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-aws-pull-requests #83](https://jclouds.ci.cloudbees.com/job/jclouds-labs-aws-pull-requests/83/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38#issuecomment-49094211
Re: [jclouds-labs-aws] JCLOUDS-457: JobStatus has been added (#38)
Posted by Andrew Gaul <no...@github.com>.
> + * limitations under the License.
> + */
> +package org.jclouds.glacier.domain;
> +
> +import java.util.Map;
> +
> +import com.google.common.collect.ImmutableMap;
> +
> +public enum JobStatus {
> + SUCCEEDED("Succeeded"),
> + FAILED("Failed"),
> + IN_PROGRESS("InProgress");
> +
> + private final String value;
> +
> + private static final Map<String, JobStatus> stringToEnum = ImmutableMap.of("Succeeded", SUCCEEDED,
Rename to `STRING_TO_ENUM` since this is a constant?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38/files#r14964324