001/*
002 * (C) Copyright 2006-2008 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Razvan Caraghin
016 *     Thierry Delprat
017 *     Florent Guillaume
018 */
019
020package org.nuxeo.ecm.platform.util;
021
022import java.io.Serializable;
023
024/**
025 * Represents a repository location. TODO: move to another package.
026 *
027 * @author Razvan Caraghin
028 * @author Thierry Delprat
029 * @author Florent Guillaume
030 */
031public class RepositoryLocation implements Serializable, Comparable<RepositoryLocation> {
032
033    private static final long serialVersionUID = -4802281621945117577L;
034
035    protected final String name;
036
037    public RepositoryLocation(String name) {
038        if (name == null) {
039            throw new IllegalArgumentException("Null repository location");
040        }
041        this.name = name;
042    }
043
044    public String getName() {
045        return name;
046    }
047
048    public int compareTo(RepositoryLocation o) {
049        return name.compareTo(o.name);
050    }
051
052    @Override
053    public boolean equals(Object other) {
054        if (this == other) {
055            return true;
056        }
057        if (!(other instanceof RepositoryLocation)) {
058            return false;
059        }
060        return name.equals(((RepositoryLocation) other).name);
061    }
062
063    @Override
064    public int hashCode() {
065        return this.name.hashCode();
066    }
067
068    /**
069     * @deprecated Unused
070     */
071    @Deprecated
072    public Boolean getEnabled() {
073        return Boolean.FALSE;
074    }
075
076    /**
077     * @deprecated Unused
078     */
079    @Deprecated
080    public void setEnabled(Boolean enabled) {
081    }
082}