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

Commit

Permalink
#163 Added mlManageScheme, mlAdminScheme
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Rudin committed May 10, 2017
1 parent 8fa31c7 commit 70780d7
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repositories {
}

dependencies {
compile 'com.marklogic:ml-javaclient-util:DEV'
compile 'com.marklogic:ml-javaclient-util:' + mlJavaclientUtilVersion
compile 'jaxen:jaxen:1.1.6'
compile 'org.apache.httpcomponents:httpclient:4.3.5'
compile 'org.springframework:spring-web:4.3.5.RELEASE'
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
group=com.marklogic
javadocsDir=../gh-pages-marklogic-java/javadocs
version=DEV
version=2.7.0
mlJavaclientUtilVersion=2.14.0
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ public ManageConfig newManageConfig() {
c.setPassword(mlPassword);
}

prop = getProperty("mlAdminUsername");
prop = getProperty("mlManageScheme");
if (prop != null) {
logger.info("Manage scheme: " + prop);
c.setScheme(prop);
}

prop = getProperty("mlAdminUsername");
if (prop != null) {
logger.info("Manage admin username: " + prop);
c.setAdminUsername(prop);
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/com/marklogic/mgmt/ManageClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ public void initialize(ManageConfig config) {
}
}

/**
* Use this when you want to provide your own RestTemplate as opposed to using the one that's constructed via a
* ManageConfig instance.
*
* @param restTemplate
*/
public ManageClient(RestTemplate restTemplate) {
this(restTemplate, restTemplate);
}

/**
* Use this when you want to provide your own RestTemplate as opposed to using the one that's constructed via a
* ManageConfig instance.
*
* @param restTemplate
* @param adminRestTemplate
*/
public ManageClient(RestTemplate restTemplate, RestTemplate adminRestTemplate) {
this.restTemplate = restTemplate;
this.adminRestTemplate = adminRestTemplate;
}

public ResponseEntity<String> putJson(String path, String json) {
logRequest(path, "JSON", "PUT");
return restTemplate.exchange(buildUri(path), HttpMethod.PUT, buildJsonEntity(json), String.class);
Expand Down Expand Up @@ -211,4 +233,12 @@ public RestTemplate getAdminRestTemplate() {
public ManageConfig getManageConfig() {
return manageConfig;
}

public void setRestTemplate(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}

public void setAdminRestTemplate(RestTemplate adminRestTemplate) {
this.adminRestTemplate = adminRestTemplate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public AdminConfig newAdminConfig() {
c.setPassword(mlPassword);
}

prop = getProperty("mlAdminScheme");
if (prop != null) {
logger.info("Admin scheme: " + prop);
c.setScheme(prop);
}

return c;
}

Expand Down

0 comments on commit 70780d7

Please sign in to comment.