001package org.apache.maven.wagon.providers.ssh.knownhost;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022public class KnownHostEntry
023{
024
025    private String hostName;
026
027    private String keyType;
028
029    private String keyValue;
030
031    public KnownHostEntry()
032    {
033    }
034
035    public KnownHostEntry( String hostName, String keyType, String keyValue )
036    {
037        this.hostName = hostName;
038        this.keyType = keyType;
039        this.keyValue = keyValue;
040    }
041
042    public String getHostName()
043    {
044        return hostName;
045    }
046
047    public void setHostName( String hostName )
048    {
049        this.hostName = hostName;
050    }
051
052    public String getKeyType()
053    {
054        return keyType;
055    }
056
057    public void setKeyType( String keyType )
058    {
059        this.keyType = keyType;
060    }
061
062    public String getKeyValue()
063    {
064        return keyValue;
065    }
066
067    public void setKeyValue( String keyValue )
068    {
069        this.keyValue = keyValue;
070    }
071
072    public int hashCode()
073    {
074        final int prime = 31;
075        int result = 1;
076        result = prime * result + ( ( hostName == null ) ? 0 : hostName.hashCode() );
077        result = prime * result + ( ( keyType == null ) ? 0 : keyType.hashCode() );
078        result = prime * result + ( ( keyValue == null ) ? 0 : keyValue.hashCode() );
079        return result;
080    }
081
082    public boolean equals( Object obj )
083    {
084        if ( this == obj )
085        {
086            return true;
087        }
088
089        if ( obj == null )
090        {
091            return false;
092        }
093
094        if ( getClass() != obj.getClass() )
095        {
096            return false;
097        }
098
099        KnownHostEntry other = (KnownHostEntry) obj;
100        if ( hostName == null )
101        {
102            if ( other.hostName != null )
103            {
104                return false;
105            }
106        }
107        else if ( !hostName.equals( other.hostName ) )
108        {
109            return false;
110        }
111
112        if ( keyType == null )
113        {
114            if ( other.keyType != null )
115            {
116                return false;
117            }
118        }
119        else if ( !keyType.equals( other.keyType ) )
120        {
121            return false;
122        }
123
124        if ( keyValue == null )
125        {
126            if ( other.keyValue != null )
127            {
128                return false;
129            }
130        }
131        else if ( !keyValue.equals( other.keyValue ) )
132        {
133            return false;
134        }
135        return true;
136    }
137
138}