Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 70780d7

Browse files
author
Rob Rudin
committed
#163 Added mlManageScheme, mlAdminScheme
1 parent 8fa31c7 commit 70780d7

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repositories {
2828
}
2929

3030
dependencies {
31-
compile 'com.marklogic:ml-javaclient-util:DEV'
31+
compile 'com.marklogic:ml-javaclient-util:' + mlJavaclientUtilVersion
3232
compile 'jaxen:jaxen:1.1.6'
3333
compile 'org.apache.httpcomponents:httpclient:4.3.5'
3434
compile 'org.springframework:spring-web:4.3.5.RELEASE'

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
group=com.marklogic
22
javadocsDir=../gh-pages-marklogic-java/javadocs
3-
version=DEV
3+
version=2.7.0
4+
mlJavaclientUtilVersion=2.14.0

src/main/java/com/marklogic/mgmt/DefaultManageConfigFactory.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ public ManageConfig newManageConfig() {
5454
c.setPassword(mlPassword);
5555
}
5656

57-
prop = getProperty("mlAdminUsername");
57+
prop = getProperty("mlManageScheme");
58+
if (prop != null) {
59+
logger.info("Manage scheme: " + prop);
60+
c.setScheme(prop);
61+
}
62+
63+
prop = getProperty("mlAdminUsername");
5864
if (prop != null) {
5965
logger.info("Manage admin username: " + prop);
6066
c.setAdminUsername(prop);

src/main/java/com/marklogic/mgmt/ManageClient.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,28 @@ public void initialize(ManageConfig config) {
5757
}
5858
}
5959

60+
/**
61+
* Use this when you want to provide your own RestTemplate as opposed to using the one that's constructed via a
62+
* ManageConfig instance.
63+
*
64+
* @param restTemplate
65+
*/
66+
public ManageClient(RestTemplate restTemplate) {
67+
this(restTemplate, restTemplate);
68+
}
69+
70+
/**
71+
* Use this when you want to provide your own RestTemplate as opposed to using the one that's constructed via a
72+
* ManageConfig instance.
73+
*
74+
* @param restTemplate
75+
* @param adminRestTemplate
76+
*/
77+
public ManageClient(RestTemplate restTemplate, RestTemplate adminRestTemplate) {
78+
this.restTemplate = restTemplate;
79+
this.adminRestTemplate = adminRestTemplate;
80+
}
81+
6082
public ResponseEntity<String> putJson(String path, String json) {
6183
logRequest(path, "JSON", "PUT");
6284
return restTemplate.exchange(buildUri(path), HttpMethod.PUT, buildJsonEntity(json), String.class);
@@ -211,4 +233,12 @@ public RestTemplate getAdminRestTemplate() {
211233
public ManageConfig getManageConfig() {
212234
return manageConfig;
213235
}
236+
237+
public void setRestTemplate(RestTemplate restTemplate) {
238+
this.restTemplate = restTemplate;
239+
}
240+
241+
public void setAdminRestTemplate(RestTemplate adminRestTemplate) {
242+
this.adminRestTemplate = adminRestTemplate;
243+
}
214244
}

src/main/java/com/marklogic/mgmt/admin/DefaultAdminConfigFactory.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ public AdminConfig newAdminConfig() {
5454
c.setPassword(mlPassword);
5555
}
5656

57+
prop = getProperty("mlAdminScheme");
58+
if (prop != null) {
59+
logger.info("Admin scheme: " + prop);
60+
c.setScheme(prop);
61+
}
62+
5763
return c;
5864
}
5965

0 commit comments

Comments
 (0)