2 * Copyright 2017-2018 Gregory Moyer and contributors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openhab.binding.lametrictime.api;
18 import org.openhab.binding.lametrictime.api.cloud.CloudConfiguration;
19 import org.openhab.binding.lametrictime.api.local.LocalConfiguration;
21 public class Configuration
23 private String deviceHost;
24 private String deviceApiKey;
26 private boolean ignoreDeviceCertificateValidation = true;
27 private boolean ignoreDeviceHostnameValidation = true;
29 private boolean logging = false;
30 private String logLevel = "INFO";
31 private int logMax = 104857600; // 100kb
33 public String getDeviceHost()
38 public void setDeviceHost(String deviceHost)
40 this.deviceHost = deviceHost;
43 public Configuration withDeviceHost(String deviceHost)
45 this.deviceHost = deviceHost;
49 public String getDeviceApiKey()
54 public void setDeviceApiKey(String deviceApiKey)
56 this.deviceApiKey = deviceApiKey;
59 public Configuration withDeviceApiKey(String deviceApiKey)
61 this.deviceApiKey = deviceApiKey;
65 public boolean isIgnoreDeviceCertificateValidation()
67 return ignoreDeviceCertificateValidation;
70 public void setIgnoreDeviceCertificateValidation(boolean ignoreDeviceCertificateValidation)
72 this.ignoreDeviceCertificateValidation = ignoreDeviceCertificateValidation;
75 public Configuration withIgnoreDeviceCertificateValidation(boolean ignoreDeviceCertificateValidation)
77 this.ignoreDeviceCertificateValidation = ignoreDeviceCertificateValidation;
81 public boolean isIgnoreDeviceHostnameValidation()
83 return ignoreDeviceHostnameValidation;
86 public void setIgnoreDeviceHostnameValidation(boolean ignoreDeviceHostnameValidation)
88 this.ignoreDeviceHostnameValidation = ignoreDeviceHostnameValidation;
91 public Configuration withIgnoreDeviceHostnameValidation(boolean ignoreDeviceHostnameValidation)
93 this.ignoreDeviceHostnameValidation = ignoreDeviceHostnameValidation;
97 public boolean isLogging()
102 public void setLogging(boolean logging)
104 this.logging = logging;
107 public Configuration withLogging(boolean logging)
109 this.logging = logging;
113 public String getLogLevel()
118 public void setLogLevel(String logLevel)
120 this.logLevel = logLevel;
123 public Configuration withLogLevel(String logLevel)
125 this.logLevel = logLevel;
129 public int getLogMax()
134 public void setLogMax(int logMax)
136 this.logMax = logMax;
139 public Configuration withLogMax(int logMax)
141 this.logMax = logMax;
145 public LocalConfiguration getLocalConfig()
147 return new LocalConfiguration().withHost(deviceHost)
148 .withApiKey(deviceApiKey)
149 .withIgnoreCertificateValidation(ignoreDeviceCertificateValidation)
150 .withIgnoreHostnameValidation(ignoreDeviceHostnameValidation)
151 .withLogging(logging)
152 .withLogLevel(logLevel)
156 public CloudConfiguration getCloudConfig()
158 return new CloudConfiguration().withLogging(logging)
159 .withLogLevel(logLevel)