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 { 025 protected static final StatusLogger LOGGER = StatusLogger.getLogger(); 026 027 private String location; 028 private String password; 029 030 public StoreConfiguration(String location, String password) { 031 this.location = location; 032 this.password = password; 033 } 034 035 public String getLocation() { 036 return location; 037 } 038 039 public void setLocation(String location) { 040 this.location = location; 041 } 042 043 public String getPassword() { 044 return password; 045 } 046 047 public char[] getPasswordAsCharArray() { 048 if (password == null) { 049 return null; 050 } else { 051 return password.toCharArray(); 052 } 053 } 054 055 public void setPassword(String password) { 056 this.password = password; 057 } 058 059 public boolean equals(StoreConfiguration config) { 060 if (config == null) { 061 return false; 062 } 063 064 boolean locationEquals = false; 065 boolean passwordEquals = false; 066 067 if (location != null) { 068 locationEquals = location.equals(config.location); 069 } else { 070 locationEquals = location == config.location; 071 } 072 073 if (password != null) { 074 passwordEquals = password.equals(config.password); 075 } else { 076 passwordEquals = password == config.password; 077 } 078 079 return locationEquals && passwordEquals; 080 } 081 082 protected void load() throws StoreConfigurationException { 083 } 084}