001/*
002 * (C) Copyright 2006-2008 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Razvan Caraghin
018 *     Thierry Delprat
019 *     Florent Guillaume
020 */
021
022package org.nuxeo.ecm.platform.util;
023
024import java.io.Serializable;
025
026/**
027 * Represents a repository location. TODO: move to another package.
028 *
029 * @author Razvan Caraghin
030 * @author Thierry Delprat
031 * @author Florent Guillaume
032 */
033public class RepositoryLocation implements Serializable, Comparable<RepositoryLocation> {
034
035    private static final long serialVersionUID = -4802281621945117577L;
036
037    protected final String name;
038
039    public RepositoryLocation(String name) {
040        if (name == null) {
041            throw new IllegalArgumentException("Null repository location");
042        }
043        this.name = name;
044    }
045
046    public String getName() {
047        return name;
048    }
049
050    public int compareTo(RepositoryLocation o) {
051        return name.compareTo(o.name);
052    }
053
054    @Override
055    public boolean equals(Object other) {
056        if (this == other) {
057            return true;
058        }
059        if (!(other instanceof RepositoryLocation)) {
060            return false;
061        }
062        return name.equals(((RepositoryLocation) other).name);
063    }
064
065    @Override
066    public int hashCode() {
067        return this.name.hashCode();
068    }
069
070    /**
071     * @deprecated Unused
072     */
073    @Deprecated
074    public Boolean getEnabled() {
075        return Boolean.FALSE;
076    }
077
078    /**
079     * @deprecated Unused
080     */
081    @Deprecated
082    public void setEnabled(Boolean enabled) {
083    }
084}