001/*
002 * (C) Copyright 2010 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 *     Robert Browning - initial implementation
016 *     Nuxeo - code review and integration
017 */
018package org.nuxeo.ecm.directory.ldap;
019
020import org.nuxeo.common.xmap.annotation.XNode;
021import org.nuxeo.common.xmap.annotation.XObject;
022import org.nuxeo.ecm.directory.ldap.dns.DNSServiceResolver;
023
024@XObject
025public class LDAPUrlDescriptor {
026
027    @XNode(value = "@srvPrefix")
028    private String srvPrefix = DNSServiceResolver.LDAP_SERVICE_PREFIX;
029
030    @XNode
031    private String value;
032
033    @Override
034    public boolean equals(Object obj) {
035        if (obj instanceof LDAPUrlDescriptor) {
036            return value.equals(((LDAPUrlDescriptor) obj).value)
037                    && srvPrefix.equals(((LDAPUrlDescriptor) obj).srvPrefix);
038        }
039        return false;
040    }
041
042    @Override
043    public int hashCode() {
044        return (srvPrefix + value).hashCode();
045    }
046
047    public String getSrvPrefix() {
048        return srvPrefix;
049    }
050
051    public String getValue() {
052        return value;
053    }
054
055    public void setSrvPrefix(String srvPrefix) {
056        this.srvPrefix = srvPrefix;
057    }
058
059    public void setValue(String value) {
060        this.value = value;
061    }
062}