You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
package org.transdroid.connect; |
|
|
|
import com.burgstaller.okhttp.digest.Credentials; |
|
|
|
import org.transdroid.connect.clients.Client; |
|
import org.transdroid.connect.clients.ClientSpec; |
|
import org.transdroid.connect.util.StringUtil; |
|
|
|
public final class Configuration { |
|
|
|
private final Client client; |
|
private final String baseUrl; |
|
private final String endpoint; |
|
private final Credentials credentials; |
|
private final boolean loggingEnabled; |
|
|
|
public Configuration(Client client, String baseUrl, String endpoint, String user, String password, boolean loggingEnabled) { |
|
this.client = client; |
|
this.baseUrl = baseUrl; |
|
this.endpoint = endpoint; |
|
this.credentials = (!StringUtil.isEmpty(user) && password != null) ? new Credentials(user, password) : null; |
|
this.loggingEnabled = loggingEnabled; |
|
} |
|
|
|
public String baseUrl() { |
|
return baseUrl; |
|
} |
|
|
|
public String endpoint() { |
|
return endpoint; |
|
} |
|
|
|
public boolean loggingEnabled() { |
|
return loggingEnabled; |
|
} |
|
|
|
public Credentials credentials() { |
|
return credentials; |
|
} |
|
|
|
public ClientSpec create() { |
|
return client.create(this); |
|
} |
|
|
|
}
|
|
|