All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.deepsense.neptune.clientlibrary.models.impl.context.NeptuneOfflineContext Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
/**
 * Copyright (c) 2016, CodiLime Inc.
 */

package io.deepsense.neptune.clientlibrary.models.impl.context;

import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import io.deepsense.neptune.clientlibrary.models.*;
import io.deepsense.neptune.clientlibrary.models.impl.job.OfflineJob;

import java.net.URI;
import java.util.Optional;
import java.util.UUID;

public class NeptuneOfflineContext implements NeptuneContext {

    private final Job job;
    private final JobParameters params;

    public NeptuneOfflineContext(UUID jobId, JobParameters jobParameters,
                                 JobProperties jobProperties, Tags tags) {
        this.job = new OfflineJob(Preconditions.checkNotNull(jobId),
                Preconditions.checkNotNull(jobProperties),
                Preconditions.checkNotNull(tags));
        this.params = Preconditions.checkNotNull(jobParameters);
    }

    @Override
    public Job getJob() {
        return job;
    }

    @Override
    public URI getStorageUrl() {
        return URI.create(System.getProperty("user.dir"));
    }

    @Override
    public JobParameters getParams() {
        return params;
    }

    @Override
    public Optional getMetric() {
        return Optional.empty();
    }

    @Override
    public void dispose() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        NeptuneOfflineContext that = (NeptuneOfflineContext) o;
        return Objects.equal(job, that.job)
                && Objects.equal(params, that.params);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(job, params);
    }

    @Override
    public String toString() {
        return "NeptuneOfflineContext{"
                + "job=" + job
                + ", params=" + params
                + '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy