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
022/**
023 * 
024 */
025public class KnownHostEntry
026{
027
028    private String hostName;
029
030    private String keyType;
031
032    private String keyValue;
033
034    public KnownHostEntry()
035    {
036    }
037
038    public KnownHostEntry( String hostName, String keyType, String keyValue )
039    {
040        this.hostName = hostName;
041        this.keyType = keyType;
042        this.keyValue = keyValue;
043    }
044
045    public String getHostName()
046    {
047        return hostName;
048    }
049
050    public void setHostName( String hostName )
051    {
052        this.hostName = hostName;
053    }
054
055    public String getKeyType()
056    {
057        return keyType;
058    }
059
060    public void setKeyType( String keyType )
061    {
062        this.keyType = keyType;
063    }
064
065    public String getKeyValue()
066    {
067        return keyValue;
068    }
069
070    public void setKeyValue( String keyValue )
071    {
072        this.keyValue = keyValue;
073    }
074
075    public int hashCode()
076    {
077        final int prime = 31;
078        int result = 1;
079        result = prime * result + ( ( hostName == null ) ? 0 : hostName.hashCode() );
080        result = prime * result + ( ( keyType == null ) ? 0 : keyType.hashCode() );
081        result = prime * result + ( ( keyValue == null ) ? 0 : keyValue.hashCode() );
082        return result;
083    }
084
085    public boolean equals( Object obj )
086    {
087        if ( this == obj )
088        {
089            return true;
090        }
091
092        if ( obj == null )
093        {
094            return false;
095        }
096
097        if ( getClass() != obj.getClass() )
098        {
099            return false;
100        }
101
102        KnownHostEntry other = (KnownHostEntry) obj;
103        if ( hostName == null )
104        {
105            if ( other.hostName != null )
106            {
107                return false;
108            }
109        }
110        else if ( !hostName.equals( other.hostName ) )
111        {
112            return false;
113        }
114
115        if ( keyType == null )
116        {
117            if ( other.keyType != null )
118            {
119                return false;
120            }
121        }
122        else if ( !keyType.equals( other.keyType ) )
123        {
124            return false;
125        }
126
127        if ( keyValue == null )
128        {
129            if ( other.keyValue != null )
130            {
131                return false;
132            }
133        }
134        else if ( !keyValue.equals( other.keyValue ) )
135        {
136            return false;
137        }
138        return true;
139    }
140
141}