/*
 * Copyright to the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.rioproject.resolver;

import java.io.Serializable;

/**
 * Representation of a remote repository.
 */
public class RemoteRepository implements Serializable {
    static final long serialVersionUID = 1L;
    private String id;
    private String name;
    private String url;
    private boolean snapshots = true;
    private boolean releases = true;
    private String releaseChecksumPolicy = "fail";
    private String snapshotChecksumPolicy = "fail";
    private String releaseUpdatePolicy = "daily";
    private String snapshotUpdatePolicy = "daily";
    private boolean mirrored;

    public boolean supportsSnapshots() {
        return snapshots;
    }

    public boolean supportsReleases() {
        return releases;
    }

    public boolean isMirrored() {
        return mirrored;
    }

    public void setMirrored(boolean mirrored) {
        this.mirrored = mirrored;
    }

    public void setSnapshots(boolean snapshots) {
        this.snapshots = snapshots;
    }

    public void setReleases(boolean releases) {
        this.releases = releases;
    }

    public String getReleaseUpdatePolicy() {
        return releaseUpdatePolicy;
    }

    public void setReleaseUpdatePolicy(String releaseUpdatePolicy) {
        this.releaseUpdatePolicy = releaseUpdatePolicy;
    }

    public String getSnapshotUpdatePolicy() {
        return snapshotUpdatePolicy;
    }

    public void setSnapshotUpdatePolicy(String snapshotUpdatePolicy) {
        this.snapshotUpdatePolicy = snapshotUpdatePolicy;
    }

    public String getSnapshotChecksumPolicy() {
        return snapshotChecksumPolicy;
    }

    public void setSnapshotChecksumPolicy(String snapshotChecksumPolicy) {
        this.snapshotChecksumPolicy = snapshotChecksumPolicy;
    }

    public String getReleaseChecksumPolicy() {
        return releaseChecksumPolicy;
    }

    public void setReleaseChecksumPolicy(String releaseChecksumPolicy) {
        this.releaseChecksumPolicy = releaseChecksumPolicy;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getName() {
        return name;
    }

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

    public String getId() {
        return id;
    }

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

    @Override public String toString() {
        return "RemoteRepository{" +
               "id='" + id + '\'' +
               ", name='" + name + '\'' +
               ", url='" + url + '\'' +
               ", snapshots=" + snapshots +
               ", releases=" + releases +
               ", releaseChecksumPolicy='" + releaseChecksumPolicy + '\'' +
               ", snapshotChecksumPolicy='" + snapshotChecksumPolicy + '\'' +
               ", releaseUpdatePolicy='" + releaseUpdatePolicy + '\'' +
               ", snapshotUpdatePolicy='" + snapshotUpdatePolicy + '\'' +
               ", mirrored=" + mirrored +
               '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        RemoteRepository that = (RemoteRepository) o;

        if (id != null ? !id.equals(that.id) : that.id != null)
            return false;
        if (url != null ? !url.equals(that.url) : that.url != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (url != null ? url.hashCode() : 0);
        return result;
    }
}

@@ -721,16 +721,44 @@
 ry.%0A */%0A
+@SuppressWarnings(%22unused%22)%0A
 public c
@@ -1032,38 +1032,52 @@
 hecksumPolicy = 
-%22fail%22
+CHECKSUM_POLICY_FAIL
 ;%0A    private St
@@ -1110,14 +1110,28 @@
 y = 
-%22fail%22
+CHECKSUM_POLICY_FAIL
 ;%0A  
@@ -1161,39 +1161,51 @@
 eUpdatePolicy = 
-%22daily%22
+UPDATE_POLICY_DAILY
 ;%0A    private St
@@ -1236,45 +1236,982 @@
 y = 
-%22daily%22;%0A    private boolean mirrored
+UPDATE_POLICY_DAILY;%0A    private boolean mirrored;%0A    /**%0A     * Verify checksums and fail the resolution if they do not match.%0A     */%0A    public static final String CHECKSUM_POLICY_FAIL = %22fail%22;%0A%0A    /**%0A     * Verify checksums and warn if they do not match.%0A     */%0A    public static final String CHECKSUM_POLICY_WARN = %22warn%22;%0A%0A    /**%0A     * Do not verify checksums.%0A     */%0A    public static final String CHECKSUM_POLICY_IGNORE = %22ignore%22;%0A    /**%0A     * Never update locally cached data.%0A     */%0A    public static final String UPDATE_POLICY_NEVER = %22never%22;%0A%0A    /**%0A     * Always update locally cached data.%0A     */%0A    public static final String UPDATE_POLICY_ALWAYS = %22always%22;%0A%0A    /**%0A     * Update locally cached data once a day.%0A     */%0A    public static final String UPDATE_POLICY_DAILY = %22daily%22;%0A%0A    /**%0A     * Update locally cached data every X minutes as given by %22interval:X%22.%0A     */%0A    public static final String UPDATE_POLICY_INTERVAL = %22interval%22
 ;%0A%0A 

Add repository release and snapshot checksum policy literals