-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from paxtonhare/gradle_fixes
Gradle fixes
- Loading branch information
Showing
54 changed files
with
1,041 additions
and
418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
mlAppDeployerDependency=com.marklogic:ml-app-deployer:+ | ||
mlConfigDir=marklogic-data-hub/src/main/resources/ml-config | ||
publishUrl=file:../marklogic-data-hub/releases | ||
mlStagingRestPort=8010 | ||
mlFinalRestPort=8011 | ||
mlTraceRestPort=8012 | ||
mlUsername=admin | ||
mlPassword=admin | ||
|
||
mlHost=localhost | ||
mlAppName=data-hub | ||
|
||
mlUsername=admin | ||
mlPassword=admin | ||
auth=digest | ||
|
||
mlStagingAppserverName=data-hub-STAGING | ||
mlStagingPort=8010 | ||
mlStagingDbName=data-hub-STAGING | ||
mlStagingForestsPerHost=4 | ||
|
||
mlFinalAppserverName=data-hub-FINAL | ||
mlFinalPort=8011 | ||
mlFinalDbName=data-hub-FINAL | ||
mlFinalForestsPerHost=4 | ||
|
||
mlTraceAppserverName=data-hub-TRACING | ||
mlTracePort=8012 | ||
mlTraceDbName=data-hub-TRACING | ||
mlTraceForestsPerHost=1 | ||
|
||
mlModulesDbName=data-hub-MODULES | ||
mlTriggersDbName=data-hub-TRIGGERS | ||
mlSchemasDbName=data-hub-SCHEMAS | ||
|
||
hubModulesPath=exmaples/hr-hub/plugins | ||
|
||
version=1.0.0-beta.2 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
marklogic-data-hub/src/main/java/com/marklogic/hub/Debugging.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.marklogic.hub; | ||
|
||
import com.marklogic.client.DatabaseClient; | ||
import com.marklogic.client.extensions.ResourceManager; | ||
import com.marklogic.client.extensions.ResourceServices.ServiceResult; | ||
import com.marklogic.client.extensions.ResourceServices.ServiceResultIterator; | ||
import com.marklogic.client.io.StringHandle; | ||
import com.marklogic.client.util.RequestParameters; | ||
|
||
public class Debugging extends ResourceManager { | ||
private static final String NAME = "debug"; | ||
|
||
public Debugging(DatabaseClient client) { | ||
super(); | ||
client.init(NAME, this); | ||
} | ||
|
||
/** | ||
* Enables tracing | ||
*/ | ||
public void enable() { | ||
RequestParameters params = new RequestParameters(); | ||
params.add("enable", "true"); | ||
this.getServices().post(params, new StringHandle("{}")); | ||
} | ||
|
||
/** | ||
* Disables tracing | ||
*/ | ||
public void disable() { | ||
RequestParameters params = new RequestParameters(); | ||
params.add("enable", "false"); | ||
this.getServices().post(params, new StringHandle("{}")); | ||
} | ||
|
||
/** | ||
* Determines if the hub has tracing enabled or not | ||
* | ||
* @return - true if enabled, false otherwise | ||
*/ | ||
public boolean isEnabled() { | ||
RequestParameters params = new RequestParameters(); | ||
ServiceResultIterator resultItr = this.getServices().get(params); | ||
if (resultItr == null || ! resultItr.hasNext()) { | ||
return false; | ||
} | ||
ServiceResult res = resultItr.next(); | ||
StringHandle handle = new StringHandle(); | ||
String enabled = res.getContent(handle).get(); | ||
return Boolean.parseBoolean(enabled); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
marklogic-data-hub/src/main/java/com/marklogic/hub/commands/UpdateRestApiServersCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.marklogic.hub.commands; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import com.marklogic.appdeployer.AppConfig; | ||
import com.marklogic.appdeployer.command.AbstractCommand; | ||
import com.marklogic.appdeployer.command.CommandContext; | ||
import com.marklogic.appdeployer.command.SortOrderConstants; | ||
import com.marklogic.mgmt.appservers.ServerManager; | ||
|
||
/** | ||
* Command for updating an existing REST API server that was presumably created via /v1/rest-apis. | ||
*/ | ||
public class UpdateRestApiServersCommand extends AbstractCommand { | ||
|
||
private String serverName; | ||
public UpdateRestApiServersCommand(String serverName) { | ||
this.serverName = serverName; | ||
setExecuteSortOrder(SortOrderConstants.UPDATE_REST_API_SERVERS); | ||
} | ||
|
||
/** | ||
* This uses a different file than that of creating a REST API, as the payload for /v1/rest-apis differs from that | ||
* of the /manage/v2/servers endpoint. | ||
*/ | ||
@Override | ||
public void execute(CommandContext context) { | ||
AppConfig appConfig = context.getAppConfig(); | ||
|
||
ServerManager mgr = new ServerManager(context.getManageClient(), appConfig.getGroupName()); | ||
|
||
String json = buildRestApiJson(appConfig); | ||
mgr.save(json); | ||
} | ||
|
||
private String buildRestApiJson(AppConfig config) { | ||
ObjectMapper m = new ObjectMapper(); | ||
ObjectNode node = m.createObjectNode(); | ||
node.put("server-name", serverName); | ||
node.put("error-handler", "/com.marklogic.hub/error-handler.xqy"); | ||
|
||
try { | ||
String json = m.writer(new DefaultPrettyPrinter()).writeValueAsString(node); | ||
return json; | ||
} catch (JsonProcessingException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
} | ||
|
||
|
||
} |
8 changes: 6 additions & 2 deletions
8
marklogic-data-hub/src/main/resources/ml-config/databases/final-database.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
{ | ||
"database-name": "data-hub-FINAL", | ||
"database-name": "%%FINAL_DB_NAME%%", | ||
"range-element-index": [], | ||
"schema-database": "%%SCHEMAS_DATABASE%%", | ||
"triggers-database": "%%TRIGGERS_DATABASE%%", | ||
"triple-index": true, | ||
"collection-lexicon":true | ||
"collection-lexicon": true, | ||
"uri-lexicon": true | ||
} |
5 changes: 5 additions & 0 deletions
5
marklogic-data-hub/src/main/resources/ml-config/databases/modules-database.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"database-name": "%%MODULES_DB_NAME%%", | ||
"collection-lexicon": true, | ||
"uri-lexicon": true | ||
} |
3 changes: 3 additions & 0 deletions
3
marklogic-data-hub/src/main/resources/ml-config/databases/schemas-database.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"database-name": "%%SCHEMAS_DATABASE%%" | ||
} |
8 changes: 6 additions & 2 deletions
8
marklogic-data-hub/src/main/resources/ml-config/databases/staging-database.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
{ | ||
"database-name": "data-hub-STAGING", | ||
"database-name": "%%STAGING_DB_NAME%%", | ||
"range-element-index": [], | ||
"schema-database": "%%SCHEMAS_DATABASE%%", | ||
"triggers-database": "%%TRIGGERS_DATABASE%%", | ||
"triple-index": true, | ||
"collection-lexicon":true | ||
"collection-lexicon": true, | ||
"uri-lexicon": true | ||
} |
Oops, something went wrong.