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      public void setPassword(String password) {
55          this.password = password;
56      }
57  
58      public boolean equals(StoreConfiguration config) {
59          if (config == null)
60              return false;
61  
62          boolean locationEquals = false;
63          boolean passwordEquals = false;
64  
65          if (location != null)
66              locationEquals = location.equals(config.location);
67          else
68              locationEquals = location == config.location;
69  
70          if (password != null)
71              passwordEquals = password.equals(config.password);
72          else
73              passwordEquals = password == config.password;
74  
75          return locationEquals && passwordEquals;
76      }
77  
78      protected void load() throws StoreConfigurationException {
79      }
80  }