com.adobe.platform.operation.internal.InternalClientConfig Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2019 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it. If you have received this file from a source other than Adobe,
* then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*/
package com.adobe.platform.operation.internal;
import com.adobe.platform.operation.ClientConfig;
public class InternalClientConfig extends ClientConfig {
private Integer connectTimeout;
private Integer socketTimeout;
private String opsCreateUri;
private String extractAnalyzerId;
public InternalClientConfig(Integer connectTimeout,
Integer socketTimeout,
String opsCreateUri,
String extractAnalyzerId) {
this.connectTimeout = connectTimeout != null ? connectTimeout : GlobalConfig.getConnectTimeout();
this.socketTimeout = socketTimeout != null ? socketTimeout : GlobalConfig.getSocketTimeout();
this.opsCreateUri = opsCreateUri != null ? opsCreateUri : GlobalConfig.getOpsCreateUri();
this.extractAnalyzerId = extractAnalyzerId != null ? extractAnalyzerId : GlobalConfig.getExtractOpsAnalyzerID();
}
public InternalClientConfig() {
this.connectTimeout = GlobalConfig.getConnectTimeout();
this.socketTimeout = GlobalConfig.getSocketTimeout();
this.opsCreateUri = GlobalConfig.getOpsCreateUri();
this.extractAnalyzerId = GlobalConfig.getExtractOpsAnalyzerID();
}
Integer getConnectTimeout() {
return connectTimeout;
}
Integer getSocketTimeout() {
return socketTimeout;
}
public String getOpsCreateUri() {
return opsCreateUri;
}
public String getExtractAnalyzerId() { return extractAnalyzerId; }
public void validate() {
if (this.socketTimeout <= 0) {
throw new IllegalArgumentException(String.format("Invalid value for socket timeout %s Must be valid integer greater than 0",
this.socketTimeout));
}
if (this.connectTimeout <= 0) {
throw new IllegalArgumentException(String.format("Invalid value for connect timeout %s Must be valid integer greater than 0",
this.connectTimeout));
}
}
}