Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete user schemas from user schemas database only #416

Merged
merged 3 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
20 changes: 14 additions & 6 deletions src/main/groovy/com/marklogic/gradle/task/MarkLogicTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,29 @@ class MarkLogicTask extends DefaultTask {
project.hasProperty("mlAdminPassword") ? project.property("mlAdminPassword") : project.property("mlPassword")
}

DatabaseClient newClient() {
newClient(null)
}

/**
* If the "database" property is set, then the DatabaseClient that's returned will use the App-Services port
* (defaults to 8000) to connect to the given database. Otherwise, the DatabaseClient will try to connect to the
* REST API server defined by mlRestPort.
* If the "database" property is set or is passed as a parameter, then the DatabaseClient that's returned will use
* the App-Services port (defaults to 8000) to connect to the given database. Otherwise, the DatabaseClient will
* try to connect to the REST API server defined by mlRestPort.
* @return
*/
DatabaseClient newClient() {
if (project.hasProperty("database")) {
DatabaseClient newClient(String database) {
if (database != null){
println "Connecting via the App-Services port to database: " + database
return getAppConfig().newAppServicesDatabaseClient(database)
}
else if (project.hasProperty("database")) {
println "Connecting via the App-Services port to database: " + project.property("database")
return getAppConfig().newAppServicesDatabaseClient(project.property("database"))
}
else {
getAppConfig().newDatabaseClient()
}
}
}

void deployWithCommandListProperty(String propertyName) {
deployWithCommands(getProject().property(propertyName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DeleteUserSchemasTask extends MarkLogicTask {
String fullQuery = "cts:uris((), (), " + xquery + ") ! xdmp:document-delete(.)"
println "Deleting user schemas in database '" + database + "' via : " + fullQuery

def client = newClient()
def client = newClient(database)
try {
client.newServerEval().xquery(fullQuery).eval()
} finally {
Expand Down