This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
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
15 changed files
with
180 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.java] | ||
indent_size = 4 |
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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/marklogic/appdeployer/command/forests/DeployCustomForestsCommand.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,39 @@ | ||
package com.marklogic.appdeployer.command.forests; | ||
|
||
import com.marklogic.appdeployer.command.AbstractCommand; | ||
import com.marklogic.appdeployer.command.CommandContext; | ||
import com.marklogic.appdeployer.command.SortOrderConstants; | ||
import com.marklogic.mgmt.forests.ForestManager; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* Use this command when you want precise control over the forests that are created for a database. It processes | ||
* each directory under ml-config/forests (the name of the directory does not matter, but it makes sense to name | ||
* it after the database that the forests belong to), and each file in a directory can have a single forest object | ||
* or an array of forest objects. | ||
*/ | ||
public class DeployCustomForestsCommand extends AbstractCommand { | ||
|
||
public DeployCustomForestsCommand() { | ||
setExecuteSortOrder(SortOrderConstants.DEPLOY_FORESTS); | ||
} | ||
|
||
@Override | ||
public void execute(CommandContext context) { | ||
File dir = new File(context.getAppConfig().getConfigDir().getBaseDir(), "forests"); | ||
for (File f : dir.listFiles()) { | ||
if (f.isDirectory()) { | ||
processDirectory(f, context); | ||
} | ||
} | ||
} | ||
|
||
protected void processDirectory(File dir, CommandContext context) { | ||
ForestManager mgr = new ForestManager(context.getManageClient()); | ||
for (File f : listFilesInDirectory(dir)) { | ||
String payload = copyFileToString(f, context); | ||
mgr.saveJsonForests(payload); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.