View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements. See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache license, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License. You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the license for the specific language governing permissions and
15   * limitations under the license.
16   */
17  package org.apache.logging.log4j.core.net.ssl;
18  
19  import org.apache.logging.log4j.status.StatusLogger;
20  
21  /**
22   *
23   */
24  public class StoreConfiguration {
25      protected static final StatusLogger LOGGER = StatusLogger.getLogger();
26  
27      private String location;
28      private String password;
29  
30      public StoreConfiguration(String location, String password) {
31          this.location = location;
32          this.password = password;
33      }
34  
35      public String getLocation() {
36          return location;
37      }
38  
39      public void setLocation(String location) {
40          this.location = location;
41      }
42  
43      public String getPassword() {
44          return password;
45      }
46  
47      public char[] getPasswordAsCharArray() {
48          if (password == null) {
49              return null;
50          } else {
51              return password.toCharArray();
52          }
53      }
54  
55      public void setPassword(String password) {
56          this.password = password;
57      }
58  
59      public boolean equals(StoreConfiguration config) {
60          if (config == null) {
61              return false;
62          }
63  
64          boolean locationEquals = false;
65          boolean passwordEquals = false;
66  
67          if (location != null) {
68              locationEquals = location.equals(config.location);
69          } else {
70              locationEquals = location == config.location;
71          }
72  
73          if (password != null) {
74              passwordEquals = password.equals(config.password);
75          } else {
76              passwordEquals = password == config.password;
77          }
78  
79          return locationEquals && passwordEquals;
80      }
81  
82      protected void load() throws StoreConfigurationException {
83      }
84  }