001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache license, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the license for the specific language governing permissions and
015 * limitations under the license.
016 */
017package org.apache.logging.log4j.core.net.ssl;
018
019import org.apache.logging.log4j.status.StatusLogger;
020
021/**
022 *
023 */
024public class StoreConfiguration<T> {
025    protected static final StatusLogger LOGGER = StatusLogger.getLogger();
026
027    private String location;
028    private String password;
029
030    public StoreConfiguration(final String location, final String password) {
031        this.location = location;
032        this.password = password;
033    }
034
035    public String getLocation() {
036        return this.location;
037    }
038
039    public void setLocation(final String location) {
040        this.location = location;
041    }
042
043    public String getPassword() {
044        return this.password;
045    }
046
047    public char[] getPasswordAsCharArray() {
048        return this.password == null ? null : this.password.toCharArray();
049    }
050
051    public void setPassword(final String password) {
052        this.password = password;
053    }
054
055    protected T load() throws StoreConfigurationException {
056        return null;
057    }
058
059    @Override
060    public int hashCode() {
061        final int prime = 31;
062        int result = 1;
063        result = prime * result + ((this.location == null) ? 0 : this.location.hashCode());
064        result = prime * result + ((this.password == null) ? 0 : this.password.hashCode());
065        return result;
066    }
067
068    @Override
069    public boolean equals(final Object obj) {
070        if (this == obj) {
071            return true;
072        }
073        if (obj == null) {
074            return false;
075        }
076        if (!(obj instanceof StoreConfiguration)) {
077            return false;
078        }
079        final StoreConfiguration<?> other = (StoreConfiguration<?>) obj;
080        if (this.location == null) {
081            if (other.location != null) {
082                return false;
083            }
084        } else if (!this.location.equals(other.location)) {
085            return false;
086        }
087        if (this.password == null) {
088            if (other.password != null) {
089                return false;
090            }
091        } else if (!this.password.equals(other.password)) {
092            return false;
093        }
094        return true;
095    }    
096}