Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
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
25 changes: 12 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "com.marklogic"
version = "4.3.1"
version = "4.3.2"

sourceCompatibility = "8"
targetCompatibility = "8"
Expand All @@ -20,13 +20,12 @@ repositories {

dependencies {
api 'com.marklogic:ml-javaclient-util:4.3.0'
api 'org.springframework:spring-web:5.3.9'
// Match the version of what Java Client 5.5.0 expects
api 'com.fasterxml.jackson.core:jackson-databind:2.11.1'
api 'org.springframework:spring-web:5.3.18'
api 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'

implementation 'jaxen:jaxen:1.2.0'
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
implementation 'org.jdom:jdom2:2.0.6'
implementation 'org.jdom:jdom2:2.0.6.1'

// Forcing httpclient to use this to address https://snyk.io/vuln/SNYK-JAVA-COMMONSCODEC-561518
implementation 'commons-codec:commons-codec:1.15'
Expand All @@ -35,29 +34,29 @@ dependencies {
implementation "org.apache.commons:commons-lang3:3.12.0"

// For PreviewInterceptor; can be excluded if that feature is not used
implementation("com.flipkart.zjsonpatch:zjsonpatch:0.4.11") {
implementation("com.flipkart.zjsonpatch:zjsonpatch:0.4.12") {
// Prefer the api version declared above
exclude module: "jackson-databind"
}

// Required for Java 11
implementation "javax.xml.bind:jaxb-api:2.3.1"
implementation "com.sun.xml.bind:jaxb-core:2.3.0.1"
implementation "com.sun.xml.bind:jaxb-impl:2.3.3"
implementation "com.sun.xml.bind:jaxb-impl:2.3.6"

// Don't want to include this in the published jar, just the executable jar
compileOnly "com.beust:jcommander:1.78"
compileOnly "ch.qos.logback:logback-classic:1.2.4"
compileOnly "com.beust:jcommander:1.82"
compileOnly "ch.qos.logback:logback-classic:1.2.11"

testImplementation "org.junit.jupiter:junit-jupiter:5.7.2"
testImplementation 'org.springframework:spring-test:5.3.9'
testImplementation 'org.springframework:spring-test:5.3.18'
testImplementation 'commons-io:commons-io:2.11.0'
testImplementation 'xmlunit:xmlunit:1.6'

// Forcing Spring to use logback for testing instead of commons-logging
testImplementation "ch.qos.logback:logback-classic:1.2.4"
testImplementation "org.slf4j:jcl-over-slf4j:1.7.31"
testImplementation "org.slf4j:slf4j-api:1.7.31"
testImplementation "ch.qos.logback:logback-classic:1.2.11"
testImplementation "org.slf4j:jcl-over-slf4j:1.7.36"
testImplementation "org.slf4j:slf4j-api:1.7.36"
}

// This ensures that Gradle includes in the published jar any non-java files under src/main/java
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ It is not intended to be used to build this project.
<modelVersion>4.0.0</modelVersion>
<groupId>com.marklogic</groupId>
<artifactId>ml-app-deployer</artifactId>
<version>4.3.1</version>
<version>4.3.2</version>
<name>com.marklogic:ml-app-deployer</name>
<description>Java client for the MarkLogic REST Management API and for deploying applications to MarkLogic</description>
<url>https://github.com/marklogic-community/ml-app-deployer</url>
Expand Down Expand Up @@ -46,13 +46,13 @@ It is not intended to be used to build this project.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.9</version>
<version>5.3.18</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.1</version>
<version>2.13.2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -70,7 +70,7 @@ It is not intended to be used to build this project.
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.6</version>
<version>2.0.6.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
Expand All @@ -88,7 +88,7 @@ It is not intended to be used to build this project.
<dependency>
<groupId>com.flipkart.zjsonpatch</groupId>
<artifactId>zjsonpatch</artifactId>
<version>0.4.11</version>
<version>0.4.12</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
Expand All @@ -112,7 +112,7 @@ It is not intended to be used to build this project.
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.3</version>
<version>2.3.6</version>
<scope>runtime</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,7 @@ public void initialize() {
logger.info("Databases that will have their forest(s) created on a single host: " + prop);
String[] names = prop.split(",");
Set<String> set = new HashSet<>();
for (String name : names) {
set.add(name);
}
set.addAll(Arrays.asList(names));
config.setDatabasesWithForestsOnOneHost(set);
});

Expand Down Expand Up @@ -904,9 +902,7 @@ protected Map<String, List<String>> buildMapOfListsFromDelimitedString(String st
String dbName = tokens[i];
String[] hostNames = tokens[i + 1].split("\\|");
List<String> names = new ArrayList<>();
for (String name : hostNames) {
names.add(name);
}
names.addAll(Arrays.asList(hostNames));
map.put(dbName, names);
}
return map;
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/marklogic/appdeployer/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,8 @@ private static PropertySource buildPropertySource(Options options) throws IOExce
if (logger.isInfoEnabled()) {
logger.info("Reading properties from file path: " + propertiesFilePath);
}
FileInputStream fis = new FileInputStream(propertiesFilePath);
try {
try (FileInputStream fis = new FileInputStream(propertiesFilePath)) {
props.load(fis);
} finally {
fis.close();
}

// Dynamic params override what's in the properties file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ public void setFilenamesToIgnore(String... filenames) {
} else {
set = new HashSet<>();
}
for (String f : filenames) {
set.add(f);
}
set.addAll(Arrays.asList(filenames));
rff.setFilenamesToIgnore(set);
} else {
logger.warn("resourceFilenameFilter is not an instanceof ResourceFilenameFilter, so unable to set resource filenames to ignore");
Expand Down Expand Up @@ -509,7 +507,10 @@ protected void setIncrementalMode(boolean incrementalMode) {
* within the directory should be associated with. But starting in 3.16.0, if the name of the directory doesn't
* match that of an existing database, then a check is made to see if there's a database file in the given ConfigDir
* that has the same name, minus its extension, as the database directory name. If so, then the database-name is
* extracted from that file and used as the database name. If not, an exception is thrown.
* extracted from that file and used as the database name. If not, a warning is logged and null is returned.
* Previously, an exception was thrown if the database-name could not be determined, but this raised problems for
* users that had directory names like ".svn" that they could not easily remove (and we can't eagerly ignore certain
* names since something like ".svn" is a valid ML database name).
*
* @param context
* @param configDir
Expand Down Expand Up @@ -538,8 +539,10 @@ protected String determineDatabaseNameForDatabaseResourceDirectory(CommandContex
}
}

throw new RuntimeException("Could not determine database to associate with database resource directory: " +
databaseResourceDir);
logger.warn("Could not determine database to associate with database resource directory: " +
databaseResourceDir + "; will not process any resource files in that directory");

return null;
}

public void setPayloadTokenReplacer(PayloadTokenReplacer payloadTokenReplacer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,35 +92,35 @@ public List<Command> getCommandsForReplicaCluster() {
}

private void addCommandsThatDoNotWriteToDatabases(Map<String, List<Command>> map) {
List<Command> clusterCommands = new ArrayList<Command>();
List<Command> clusterCommands = new ArrayList<>();
clusterCommands.add(new ModifyLocalClusterCommand());
map.put("mlClusterCommands", clusterCommands);

List<Command> configurationCommands = new ArrayList<>();
configurationCommands.add(new DeployConfigurationsCommand());
map.put("mlConfigurationCommands", configurationCommands);

List<Command> dbCommands = new ArrayList<Command>();
List<Command> dbCommands = new ArrayList<>();
dbCommands.add(new DeployOtherDatabasesCommand());
map.put("mlDatabaseCommands", dbCommands);

List<Command> forestCommands = new ArrayList<Command>();
List<Command> forestCommands = new ArrayList<>();
forestCommands.add(new DeployCustomForestsCommand());
map.put("mlForestCommands", forestCommands);

List<Command> replicaCommands = new ArrayList<Command>();
List<Command> replicaCommands = new ArrayList<>();
replicaCommands.add(new ConfigureForestReplicasCommand());
map.put("mlForestReplicaCommands", replicaCommands);

List<Command> groupCommands = new ArrayList<Command>();
List<Command> groupCommands = new ArrayList<>();
groupCommands.add(new DeployGroupsCommand());
map.put("mlGroupCommands", groupCommands);

List<Command> hostCommands = new ArrayList<Command>();
List<Command> hostCommands = new ArrayList<>();
hostCommands.add(new AssignHostsToGroupsCommand());
map.put("mlHostCommands", hostCommands);

List<Command> mimetypeCommands = new ArrayList<Command>();
List<Command> mimetypeCommands = new ArrayList<>();
mimetypeCommands.add(new DeployMimetypesCommand());
map.put("mlMimetypeCommands", mimetypeCommands);

Expand All @@ -137,7 +137,7 @@ private void addCommandsThatDoNotWriteToDatabases(Map<String, List<Command>> map
restApiCommands.add(new DeployRestApiServersCommand());
map.put("mlRestApiCommands", restApiCommands);

List<Command> securityCommands = new ArrayList<Command>();
List<Command> securityCommands = new ArrayList<>();
securityCommands.add(new DeployRolesCommand());
securityCommands.add(new DeployUsersCommand());
securityCommands.add(new DeployAmpsCommand());
Expand All @@ -157,20 +157,20 @@ private void addCommandsThatDoNotWriteToDatabases(Map<String, List<Command>> map
serverCommands.add(new UpdateRestApiServersCommand());
map.put("mlServerCommands", serverCommands);

List<Command> taskCommands = new ArrayList<Command>();
List<Command> taskCommands = new ArrayList<>();
taskCommands.add(new DeployScheduledTasksCommand());
taskCommands.add(new UpdateTaskServerCommand());
map.put("mlTaskCommands", taskCommands);
}

private void addCommandsThatWriteToDatabases(Map<String, List<Command>> map) {
List<Command> alertCommands = new ArrayList<Command>();
List<Command> alertCommands = new ArrayList<>();
alertCommands.add(new DeployAlertConfigsCommand());
alertCommands.add(new DeployAlertActionsCommand());
alertCommands.add(new DeployAlertRulesCommand());
map.put("mlAlertCommands", alertCommands);

List<Command> cpfCommands = new ArrayList<Command>();
List<Command> cpfCommands = new ArrayList<>();
cpfCommands.add(new DeployCpfConfigsCommand());
cpfCommands.add(new DeployDomainsCommand());
cpfCommands.add(new DeployPipelinesCommand());
Expand All @@ -180,7 +180,7 @@ private void addCommandsThatWriteToDatabases(Map<String, List<Command>> map) {
dataCommands.add(new LoadDataCommand());
map.put("mlDataCommands", dataCommands);

List<Command> flexrepCommands = new ArrayList<Command>();
List<Command> flexrepCommands = new ArrayList<>();
flexrepCommands.add(new DeployConfigsCommand());
flexrepCommands.add(new DeployTargetsCommand());
flexrepCommands.add(new DeployFlexrepCommand());
Expand All @@ -201,11 +201,11 @@ private void addCommandsThatWriteToDatabases(Map<String, List<Command>> map) {
temporalCommands.add(new DeployTemporalCollectionsLSQTCommand());
map.put("mlTemporalCommands", temporalCommands);

List<Command> triggerCommands = new ArrayList<Command>();
List<Command> triggerCommands = new ArrayList<>();
triggerCommands.add(new DeployTriggersCommand());
map.put("mlTriggerCommands", triggerCommands);

List<Command> viewCommands = new ArrayList<Command>();
List<Command> viewCommands = new ArrayList<>();
viewCommands.add(new DeployViewSchemasCommand());
map.put("mlViewCommands", viewCommands);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.marklogic.client.ext.helper.LoggingObject;

import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -38,9 +39,7 @@ public ResourceFilenameFilter(ResourceFileManager resourceFileManager) {
public ResourceFilenameFilter(String... filenamesToIgnore) {
this();
this.filenamesToIgnore = new HashSet<>();
for (String f : filenamesToIgnore) {
this.filenamesToIgnore.add(f);
}
this.filenamesToIgnore.addAll(Arrays.asList(filenamesToIgnore));
}

public ResourceFilenameFilter(Set<String> filenamesToIgnore) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public void execute(CommandContext context) {
deployActions(context, configDir, appConfig.getContentDatabaseName());
for (File dir : configDir.getDatabaseResourceDirectories()) {
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
deployActions(context, new ConfigDir(dir), databaseName);
if (databaseName != null) {
deployActions(context, new ConfigDir(dir), databaseName);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public void execute(CommandContext context) {
deployAlertConfigs(context, configDir, appConfig.getContentDatabaseName());
for (File dir : configDir.getDatabaseResourceDirectories()) {
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
deployAlertConfigs(context, new ConfigDir(dir), databaseName);
if (databaseName != null) {
deployAlertConfigs(context, new ConfigDir(dir), databaseName);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.marklogic.appdeployer.command.alert;

import java.io.File;

import com.marklogic.appdeployer.AppConfig;
import com.marklogic.appdeployer.ConfigDir;
import com.marklogic.appdeployer.command.AbstractCommand;
Expand All @@ -28,7 +26,9 @@ public void execute(CommandContext context) {
deployRules(context, configDir, appConfig.getContentDatabaseName());
for (File dir : configDir.getDatabaseResourceDirectories()) {
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
deployRules(context, new ConfigDir(dir), databaseName);
if (databaseName != null) {
deployRules(context, new ConfigDir(dir), databaseName);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.marklogic.appdeployer.command.UndoableCommand;
import com.marklogic.appdeployer.command.forests.DeployForestsCommand;
import com.marklogic.mgmt.PayloadParser;
import com.marklogic.mgmt.SaveReceipt;
import com.marklogic.mgmt.api.database.Database;
import com.marklogic.mgmt.resource.databases.DatabaseManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ protected List<DatabasePlan> mergeDatabasePlanFiles(CommandContext context, Data
ObjectReader objectReader = ObjectMapperFactory.getObjectMapper().readerFor(Database.class);

List<DatabasePlan> databasePlanList = new ArrayList<>();
databasePlans.getDatabasePlanMap().values().forEach(ref -> databasePlanList.add(ref));
databasePlanList.addAll(databasePlans.getDatabasePlanMap().values());

DatabasePlan testDatabasePlan = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void execute(CommandContext context) {
}

if (subdbDir.exists()) {
List<String> subDbNames = new ArrayList<String>();
List<String> subDbNames = new ArrayList<>();
for (File subDatabaseFile : listFilesInDirectory(subdbDir)) {
logger.info(format("Processing sub-database for %s found in file: %s", superDatabaseName, subDatabaseFile.getAbsolutePath()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public void execute(CommandContext context) {
deployConfigs(context, configDir, appConfig.getContentDatabaseName());
for (File dir : configDir.getDatabaseResourceDirectories()) {
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
deployConfigs(context, new ConfigDir(dir), databaseName);
if (databaseName != null) {
deployConfigs(context, new ConfigDir(dir), databaseName);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public void execute(CommandContext context) {
deployFlexRepPulls(context, configDir, appConfig.getContentDatabaseName());
for (File dir : configDir.getDatabaseResourceDirectories()) {
String databaseName = determineDatabaseNameForDatabaseResourceDirectory(context, configDir, dir);
deployFlexRepPulls(context, new ConfigDir(dir), databaseName);
if (databaseName != null) {
deployFlexRepPulls(context, new ConfigDir(dir), databaseName);
}
}
}
}
Expand Down
Loading