-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
87 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
group=com.marklogic | ||
version=3.6.3 | ||
version=3.7.0 | ||
javadocsDir=../gh-pages-marklogic-java/javadocs | ||
|
||
mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.6.3 | ||
mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.7.0 | ||
mlcpUtilDependency=com.marklogic:mlcp-util:0.9.0 | ||
mlDataMovementDependency=com.marklogic:marklogic-data-movement-components:1.0 | ||
mlUnitTestDependency=com.marklogic:ml-unit-test-client:0.10.0 |
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
12 changes: 12 additions & 0 deletions
12
src/main/groovy/com/marklogic/gradle/task/configuration/DeployConfigurationsTask.groovy
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,12 @@ | ||
package com.marklogic.gradle.task.configuration | ||
|
||
import com.marklogic.gradle.task.MarkLogicTask | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
class DeployConfigurationsTask extends MarkLogicTask { | ||
|
||
@TaskAction | ||
void deployConfigurations() { | ||
deployWithCommandListProperty("mlConfigurationCommands") | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
src/main/groovy/com/marklogic/gradle/task/forests/PrintForestPlanTask.groovy
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,60 @@ | ||
package com.marklogic.gradle.task.forests | ||
|
||
import com.marklogic.appdeployer.AppConfig | ||
import com.marklogic.appdeployer.command.databases.DeployContentDatabasesCommand | ||
import com.marklogic.appdeployer.command.databases.DeployDatabaseCommand | ||
import com.marklogic.appdeployer.command.databases.DeploySchemasDatabaseCommand | ||
import com.marklogic.appdeployer.command.databases.DeployTriggersDatabaseCommand | ||
import com.marklogic.appdeployer.impl.SimpleAppDeployer | ||
import com.marklogic.gradle.task.MarkLogicTask | ||
import com.marklogic.mgmt.api.forest.Forest | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
class PrintForestPlanTask extends MarkLogicTask { | ||
|
||
@TaskAction | ||
void printForestPlan() { | ||
if (!project.hasProperty("database")) { | ||
println "Please specify a database via the 'database' property" | ||
return | ||
} | ||
|
||
String database = project.property("database") | ||
|
||
/** | ||
* We unfortunately have to do a little work here to determine what command object to use based on the database | ||
* name. That's to account for the "special" stuff that's done for the content database (mlContentForestsPerHost) | ||
* and for the schema/triggers databases (those commands default to only having forests on one host). | ||
*/ | ||
AppConfig appConfig = getAppConfig() | ||
SimpleAppDeployer appDeployer = getAppDeployer() | ||
DeployDatabaseCommand command | ||
if (database.equals(appConfig.getContentDatabaseName()) || database.equals(appConfig.getTestContentDatabaseName())) { | ||
command = appDeployer.getCommandOfType(DeployContentDatabasesCommand.class) | ||
} else if (database.equals(appConfig.getSchemasDatabaseName())) { | ||
command = appDeployer.getCommandOfType(DeploySchemasDatabaseCommand.class) | ||
} else if (database.equals(appConfig.getTriggersDatabaseName())) { | ||
command = appDeployer.getCommandOfType(DeployTriggersDatabaseCommand.class) | ||
} else { | ||
command = new DeployDatabaseCommand() | ||
} | ||
|
||
/** | ||
* Now that we have a command, use it to build its command for deploying forests, and then use that to build | ||
* the list of forests that will be created. | ||
*/ | ||
List<Forest> forests = command.buildDeployForestsCommand(database, getCommandContext()).buildForests(getCommandContext(), true) | ||
|
||
|
||
if (forests.isEmpty()) { | ||
println "\nNo primary forests will be created the next time the database '" + database + "' is deployed; this is likely because it already has all of the primary desired forests based on the configuration settings." | ||
println "\nIf replicas have been configured for the database - e.g. via mlDatabaseNamesAndReplicaCounts - and these do not exist yet, " + | ||
"then replicas will be created the next time either the mlDeploy task or mlConfigureForestReplicas task is run." | ||
} else { | ||
for (Forest f : forests) { | ||
println f.getJson() | ||
} | ||
println "\nThe " + forests.size() + " forests (and replicas if applicable) that will be created the next time the database '" + database + "' is deployed (e.g. via the mlDeploy task) are listed above." | ||
} | ||
} | ||
} |
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