diff --git a/generator/pom.xml b/generator/pom.xml
index bfc58eea..22bce773 100644
--- a/generator/pom.xml
+++ b/generator/pom.xml
@@ -54,6 +54,12 @@
compile
+
+ com.github.ben-manes.caffeine
+ caffeine
+ compile
+
+
com.github.jknack
handlebars
diff --git a/generator/src/main/java/io/wcm/devops/conga/generator/ContextPropertiesBuilder.java b/generator/src/main/java/io/wcm/devops/conga/generator/ContextPropertiesBuilder.java
index a0a55c25..df0bf929 100644
--- a/generator/src/main/java/io/wcm/devops/conga/generator/ContextPropertiesBuilder.java
+++ b/generator/src/main/java/io/wcm/devops/conga/generator/ContextPropertiesBuilder.java
@@ -32,6 +32,7 @@
import static io.wcm.devops.conga.generator.ContextProperties.TENANTS_BY_ROLE;
import static io.wcm.devops.conga.generator.ContextProperties.TENANT_ROLES;
import static io.wcm.devops.conga.generator.ContextProperties.VERSION;
+import static java.util.Map.entry;
import java.util.ArrayList;
import java.util.Collections;
@@ -39,8 +40,6 @@
import java.util.List;
import java.util.Map;
-import com.google.common.collect.ImmutableMap;
-
import io.wcm.devops.conga.generator.util.ObjectCloner;
import io.wcm.devops.conga.generator.util.VariableObjectTreeResolver;
import io.wcm.devops.conga.generator.util.VariableStringResolver;
@@ -55,20 +54,20 @@
*/
public final class ContextPropertiesBuilder {
- static final Map EMPTY_CONTEXT_VARIABLES = ImmutableMap.builder()
- .put(VERSION, "")
- .put(ENVIRONMENT, "")
- .put(NODES, Collections.emptyList())
- .put(NODES_BY_ROLE, Collections.emptyMap())
- .put(NODES_BY_ROLE_VARIANT, Collections.emptyMap())
- .put(TENANTS, Collections.emptyMap())
- .put(TENANTS_BY_ROLE, Collections.emptyMap())
- .put(ROLE, "")
- .put(ROLE_VARIANT, "")
- .put(NODE, "")
- .put(TENANT, "")
- .put(TENANT_ROLES, Collections.emptyList())
- .build();
+ static final Map EMPTY_CONTEXT_VARIABLES = Map.ofEntries(
+ entry(VERSION, ""),
+ entry(ENVIRONMENT, ""),
+ entry(NODES, Collections.emptyList()),
+ entry(NODES_BY_ROLE, Collections.emptyMap()),
+ entry(NODES_BY_ROLE_VARIANT, Collections.emptyMap()),
+ entry(TENANTS, Collections.emptyMap()),
+ entry(TENANTS_BY_ROLE, Collections.emptyMap()),
+ entry(ROLE, ""),
+ entry(ROLE_VARIANT, ""),
+ entry(NODE, ""),
+ entry(TENANT, ""),
+ entry(TENANT_ROLES, Collections.emptyList())
+ );
private ContextPropertiesBuilder() {
// static methods only
diff --git a/generator/src/main/java/io/wcm/devops/conga/generator/EnvironmentGenerator.java b/generator/src/main/java/io/wcm/devops/conga/generator/EnvironmentGenerator.java
index 3e5784b4..46eb4c0b 100644
--- a/generator/src/main/java/io/wcm/devops/conga/generator/EnvironmentGenerator.java
+++ b/generator/src/main/java/io/wcm/devops/conga/generator/EnvironmentGenerator.java
@@ -40,9 +40,6 @@
import com.github.jknack.handlebars.Handlebars;
import com.github.jknack.handlebars.Template;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.wcm.devops.conga.generator.export.NodeModelExport;
@@ -132,10 +129,10 @@ final class EnvironmentGenerator {
ResourceLoader resourceLoader = new ResourceLoader(resourceClassLoader);
// prepare template and role directories
- List templateDirs = ImmutableList.of(
+ List templateDirs = List.of(
resourceLoader.getResourceCollection(ResourceLoader.FILE_PREFIX + options.getTemplateDir()),
resourceLoader.getResourceCollection(ResourceLoader.CLASSPATH_PREFIX + GeneratorOptions.CLASSPATH_TEMPLATES_DIR));
- List roleDirs = ImmutableList.of(
+ List roleDirs = List.of(
resourceLoader.getResourceCollection(ResourceLoader.FILE_PREFIX + options.getRoleDir()),
resourceLoader.getResourceCollection(ResourceLoader.CLASSPATH_PREFIX + GeneratorOptions.CLASSPATH_ROLES_DIR));
@@ -154,7 +151,7 @@ final class EnvironmentGenerator {
this.handlebarsManager = new HandlebarsManager(templateDirs, this.pluginContextOptions);
this.defaultMultiplyPlugin = options.getPluginManager().get(NoneMultiply.NAME, MultiplyPlugin.class);
- this.environmentContextProperties = ImmutableMap.copyOf(
+ this.environmentContextProperties = Collections.unmodifiableMap(
ContextPropertiesBuilder.buildEnvironmentContextVariables(environmentName, this.environment, options.getVersion(),
variableObjectTreeResolver, variableStringResolver));
@@ -178,7 +175,7 @@ public void generate(String[] nodeNames) {
log.info("");
log.info("===== Environment '{}' =====", environmentName);
- Set nodeNamesIndex = ArrayUtils.isEmpty(nodeNames) ? Collections.emptySet() : ImmutableSet.copyOf(nodeNames);
+ Set nodeNamesIndex = ArrayUtils.isEmpty(nodeNames) ? Collections.emptySet() : Set.of(nodeNames);
for (Node node : environment.getNodes()) {
if (isSelectedNode(node, nodeNamesIndex)) {
generateNode(node);
diff --git a/generator/src/main/java/io/wcm/devops/conga/generator/FileGenerator.java b/generator/src/main/java/io/wcm/devops/conga/generator/FileGenerator.java
index e77cfe85..89473afd 100644
--- a/generator/src/main/java/io/wcm/devops/conga/generator/FileGenerator.java
+++ b/generator/src/main/java/io/wcm/devops/conga/generator/FileGenerator.java
@@ -42,7 +42,6 @@
import org.slf4j.Logger;
import com.github.jknack.handlebars.Template;
-import com.google.common.collect.ImmutableList;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.wcm.devops.conga.generator.plugins.fileheader.NoneFileHeader;
@@ -423,7 +422,7 @@ private Collection applyPostProcessor(FileContext fileItem
private void applyPostProcessor(Map consolidatedFiles, PostProcessorPlugin plugin) {
// process all files from given map
- ImmutableList.copyOf(consolidatedFiles.values()).stream()
+ List.copyOf(consolidatedFiles.values()).stream()
// do not apply post processor twice
.filter(fileItem -> !fileItem.getPostProcessors().contains(plugin.getName()))
.filter(fileItem -> plugin.accepts(fileItem.getFileContext(), postProcessorContext))
@@ -441,7 +440,7 @@ private void applyPostProcessor(Map consolidatedFi
});
// remove items that do no longer exist
- ImmutableList.copyOf(consolidatedFiles.values()).forEach(fileItem -> {
+ List.copyOf(consolidatedFiles.values()).forEach(fileItem -> {
if (!fileItem.getFileContext().getFile().exists()) {
consolidatedFiles.remove(fileItem.getFileContext().getCanonicalPath());
}
@@ -469,7 +468,7 @@ private void applyPostProcessor(Map consolidatedFi
});
// remove items that do no longer exist
- ImmutableList.copyOf(consolidatedFiles.values()).forEach(fileItem -> {
+ List.copyOf(consolidatedFiles.values()).forEach(fileItem -> {
if (!fileItem.getFileContext().getFile().exists()) {
consolidatedFiles.remove(fileItem.getFileContext().getCanonicalPath());
}
diff --git a/generator/src/main/java/io/wcm/devops/conga/generator/Generator.java b/generator/src/main/java/io/wcm/devops/conga/generator/Generator.java
index 138dfa94..59d5d420 100644
--- a/generator/src/main/java/io/wcm/devops/conga/generator/Generator.java
+++ b/generator/src/main/java/io/wcm/devops/conga/generator/Generator.java
@@ -27,8 +27,6 @@
import org.apache.commons.io.FileUtils;
-import com.google.common.collect.ImmutableList;
-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.wcm.devops.conga.generator.util.FileUtil;
import io.wcm.devops.conga.model.environment.Environment;
@@ -54,7 +52,7 @@ public Generator(GeneratorOptions options) {
ClassLoader resourceClassLoader = ResourceLoaderUtil.buildClassLoader(options.getContainerClasspathUrls());
ResourceLoader resourceLoader = new ResourceLoader(resourceClassLoader);
- List environmentDirs = ImmutableList.of(
+ List environmentDirs = List.of(
resourceLoader.getResourceCollection(ResourceLoader.FILE_PREFIX + options.getEnvironmentDir()),
resourceLoader.getResourceCollection(ResourceLoader.CLASSPATH_PREFIX + GeneratorOptions.CLASSPATH_ENVIRONMENTS_DIR));
this.environments = ResourceLoaderUtil.readModels(environmentDirs, new EnvironmentReader());
diff --git a/generator/src/main/java/io/wcm/devops/conga/generator/ResourceLoaderUtil.java b/generator/src/main/java/io/wcm/devops/conga/generator/ResourceLoaderUtil.java
index 635a12e7..abe01365 100644
--- a/generator/src/main/java/io/wcm/devops/conga/generator/ResourceLoaderUtil.java
+++ b/generator/src/main/java/io/wcm/devops/conga/generator/ResourceLoaderUtil.java
@@ -23,14 +23,13 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.FilenameUtils;
-import com.google.common.collect.ImmutableMap;
-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.wcm.devops.conga.generator.spi.context.PluginContextOptions;
import io.wcm.devops.conga.generator.spi.context.UrlFilePluginContext;
@@ -114,7 +113,7 @@ public static Map readModels(List dirs, Model
}
}
}
- return ImmutableMap.copyOf(models);
+ return Collections.unmodifiableMap(models);
}
}
diff --git a/generator/src/main/java/io/wcm/devops/conga/generator/handlebars/HandlebarsManager.java b/generator/src/main/java/io/wcm/devops/conga/generator/handlebars/HandlebarsManager.java
index 96b5855d..cecdc308 100644
--- a/generator/src/main/java/io/wcm/devops/conga/generator/handlebars/HandlebarsManager.java
+++ b/generator/src/main/java/io/wcm/devops/conga/generator/handlebars/HandlebarsManager.java
@@ -21,8 +21,10 @@
import java.io.IOException;
import java.util.List;
-import java.util.concurrent.ExecutionException;
+import com.github.benmanes.caffeine.cache.CacheLoader;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.LoadingCache;
import com.github.jknack.handlebars.EscapingStrategy;
import com.github.jknack.handlebars.Handlebars;
import com.github.jknack.handlebars.Helper;
@@ -31,11 +33,7 @@
import com.github.jknack.handlebars.helper.ConditionalHelpers;
import com.github.jknack.handlebars.helper.StringHelpers;
import com.github.jknack.handlebars.io.TemplateLoader;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import io.wcm.devops.conga.generator.GeneratorException;
import io.wcm.devops.conga.generator.spi.context.PluginContextOptions;
import io.wcm.devops.conga.generator.spi.handlebars.EscapingStrategyPlugin;
import io.wcm.devops.conga.generator.spi.handlebars.HelperPlugin;
@@ -55,7 +53,7 @@ public class HandlebarsManager {
private final HelperContext helperContext;
private final LoadingCache handlebarsCache =
- CacheBuilder.newBuilder().build(new CacheLoader() {
+ Caffeine.newBuilder().build(new CacheLoader() {
@SuppressWarnings("unchecked")
@Override
public Handlebars load(HandlebarsKey options) throws Exception {
@@ -108,12 +106,7 @@ public HandlebarsManager(List templateDirs, PluginContextOpt
*/
public Handlebars get(String escapingStrategy, String charset) {
HandlebarsKey key = new HandlebarsKey(escapingStrategy, charset);
- try {
- return handlebarsCache.get(key);
- }
- catch (ExecutionException ex) {
- throw new GeneratorException("Unable to get handlebars instance for " + key.toString(), ex);
- }
+ return handlebarsCache.get(key);
}
}
diff --git a/generator/src/main/java/io/wcm/devops/conga/generator/plugins/export/YamlNodeModelExport.java b/generator/src/main/java/io/wcm/devops/conga/generator/plugins/export/YamlNodeModelExport.java
index 28432392..edd3ab21 100644
--- a/generator/src/main/java/io/wcm/devops/conga/generator/plugins/export/YamlNodeModelExport.java
+++ b/generator/src/main/java/io/wcm/devops/conga/generator/plugins/export/YamlNodeModelExport.java
@@ -24,17 +24,16 @@
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.yaml.snakeyaml.Yaml;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSortedMap;
-
import io.wcm.devops.conga.generator.GeneratorException;
import io.wcm.devops.conga.generator.spi.export.NodeModelExportPlugin;
import io.wcm.devops.conga.generator.spi.export.context.ExportNodeRoleData;
@@ -74,7 +73,7 @@ public void export(NodeModelExportContext context) {
Map versionInfo = context.getContainerVersionInfo();
if (versionInfo != null) {
- modelMap.put("versionInfo", ImmutableSortedMap.copyOf(versionInfo));
+ modelMap.put("versionInfo", Collections.unmodifiableSortedMap(new TreeMap<>(versionInfo)));
}
// save YAML file
@@ -101,7 +100,7 @@ private void addRole(List
-
- com.google.guava
- guava
- compile
-
-
diff --git a/parent/pom.xml b/parent/pom.xml
index d0b7fb69..d42e973e 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -72,12 +72,6 @@
1.11.0
-
- com.google.guava
- guava
- 33.0.0-jre
-
-
commons-beanutils
commons-beanutils
@@ -96,6 +90,12 @@
1.6.0
+
+ com.github.ben-manes.caffeine
+ caffeine
+ 3.1.8
+
+
com.github.jknack
handlebars
diff --git a/resource/pom.xml b/resource/pom.xml
index d9310acb..a9c5e251 100644
--- a/resource/pom.xml
+++ b/resource/pom.xml
@@ -49,12 +49,6 @@
compile
-
- com.google.guava
- guava
- compile
-
-
org.springframework
spring-core
diff --git a/resource/src/main/java/io/wcm/devops/conga/resource/AbstractClasspathResourceImpl.java b/resource/src/main/java/io/wcm/devops/conga/resource/AbstractClasspathResourceImpl.java
index 9a090788..4038fbb8 100644
--- a/resource/src/main/java/io/wcm/devops/conga/resource/AbstractClasspathResourceImpl.java
+++ b/resource/src/main/java/io/wcm/devops/conga/resource/AbstractClasspathResourceImpl.java
@@ -52,7 +52,7 @@ protected static String convertPath(String path) {
}
@Override
- public int compareTo(Resource o) {
+ public int compareTo(ResourceInfo o) {
return getName().compareTo(o.getName());
}
diff --git a/resource/src/main/java/io/wcm/devops/conga/resource/AbstractFileResourceInfoImpl.java b/resource/src/main/java/io/wcm/devops/conga/resource/AbstractFileResourceInfoImpl.java
index 06b3ba88..566236c4 100644
--- a/resource/src/main/java/io/wcm/devops/conga/resource/AbstractFileResourceInfoImpl.java
+++ b/resource/src/main/java/io/wcm/devops/conga/resource/AbstractFileResourceInfoImpl.java
@@ -63,7 +63,7 @@ public final String getCanonicalPath() {
}
@Override
- public int compareTo(Resource o) {
+ public int compareTo(ResourceInfo o) {
return getName().compareTo(o.getName());
}
diff --git a/resource/src/main/java/io/wcm/devops/conga/resource/ClasspathResourceCollectionImpl.java b/resource/src/main/java/io/wcm/devops/conga/resource/ClasspathResourceCollectionImpl.java
index 0c954301..a46abd6f 100644
--- a/resource/src/main/java/io/wcm/devops/conga/resource/ClasspathResourceCollectionImpl.java
+++ b/resource/src/main/java/io/wcm/devops/conga/resource/ClasspathResourceCollectionImpl.java
@@ -25,13 +25,12 @@
import java.util.ArrayList;
import java.util.List;
import java.util.SortedSet;
+import java.util.TreeSet;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
-import com.google.common.collect.ImmutableSortedSet;
-
final class ClasspathResourceCollectionImpl extends AbstractClasspathResourceImpl implements ResourceCollection {
private final List fileUrls = new ArrayList<>();
@@ -83,16 +82,16 @@ public ResourceCollection getResourceCollection(String childPath) {
@Override
public SortedSet getResources() {
- return ImmutableSortedSet.copyOf(fileUrls.stream()
+ return fileUrls.stream()
.map(url -> new ClasspathResourceImpl(url, resourceLoader))
- .collect(Collectors.toList()));
+ .collect(Collectors.toCollection(TreeSet::new));
}
@Override
public SortedSet getResourceCollections() {
- return ImmutableSortedSet.copyOf(folderPaths.stream()
+ return folderPaths.stream()
.map(folderPath -> new ClasspathResourceCollectionImpl(folderPath, resourceLoader))
- .collect(Collectors.toList()));
+ .collect(Collectors.toCollection(TreeSet::new));
}
}
diff --git a/resource/src/main/java/io/wcm/devops/conga/resource/FileResourceCollectionImpl.java b/resource/src/main/java/io/wcm/devops/conga/resource/FileResourceCollectionImpl.java
index d9fc6852..9a5a10ff 100644
--- a/resource/src/main/java/io/wcm/devops/conga/resource/FileResourceCollectionImpl.java
+++ b/resource/src/main/java/io/wcm/devops/conga/resource/FileResourceCollectionImpl.java
@@ -21,11 +21,11 @@
import java.io.File;
import java.util.Arrays;
+import java.util.Collections;
import java.util.SortedSet;
+import java.util.TreeSet;
import java.util.stream.Collectors;
-import com.google.common.collect.ImmutableSortedSet;
-
class FileResourceCollectionImpl extends FileResourceImpl implements ResourceCollection {
private final ResourceLoader resourceLoader;
@@ -60,23 +60,23 @@ public ResourceCollection getResourceCollection(String path) {
@Override
public SortedSet getResources() {
if (!exists()) {
- return ImmutableSortedSet.of();
+ return Collections.emptySortedSet();
}
- return ImmutableSortedSet.copyOf(Arrays.stream(file.listFiles())
- .filter(child -> child.isFile())
- .map(child -> new FileResourceImpl(child))
- .collect(Collectors.toList()));
+ return Arrays.stream(file.listFiles())
+ .filter(File::isFile)
+ .map(FileResourceImpl::new)
+ .collect(Collectors.toCollection(TreeSet::new));
}
@Override
public SortedSet getResourceCollections() {
if (!exists()) {
- return ImmutableSortedSet.of();
+ return Collections.emptySortedSet();
}
- return ImmutableSortedSet.copyOf(Arrays.stream(file.listFiles())
- .filter(child -> child.isDirectory())
+ return Arrays.stream(file.listFiles())
+ .filter(File::isDirectory)
.map(child -> new FileResourceCollectionImpl(child, resourceLoader))
- .collect(Collectors.toList()));
+ .collect(Collectors.toCollection(TreeSet::new));
}
}
diff --git a/resource/src/main/java/io/wcm/devops/conga/resource/ResourceInfo.java b/resource/src/main/java/io/wcm/devops/conga/resource/ResourceInfo.java
index a158f6d0..172df0af 100644
--- a/resource/src/main/java/io/wcm/devops/conga/resource/ResourceInfo.java
+++ b/resource/src/main/java/io/wcm/devops/conga/resource/ResourceInfo.java
@@ -22,7 +22,7 @@
/**
* Abstraction for resource information.
*/
-public interface ResourceInfo extends Comparable {
+public interface ResourceInfo extends Comparable {
/**
* @return true if resource exists
diff --git a/resource/src/main/java/io/wcm/devops/conga/resource/ResourceLoader.java b/resource/src/main/java/io/wcm/devops/conga/resource/ResourceLoader.java
index 77970bcb..88f7bbf9 100644
--- a/resource/src/main/java/io/wcm/devops/conga/resource/ResourceLoader.java
+++ b/resource/src/main/java/io/wcm/devops/conga/resource/ResourceLoader.java
@@ -23,8 +23,6 @@
import org.apache.commons.lang3.StringUtils;
-import com.google.common.collect.ImmutableList;
-
/**
* Resource loader to read resource and resource collections from filesystem or classpath.
*/
@@ -125,12 +123,12 @@ private List getSupportedResourceTypes(String path) {
// check for explicit path specification
for (ResourceType resourceType : ResourceType.values()) {
if (StringUtils.startsWith(path, resourceType.getPrefix())) {
- return ImmutableList.of(resourceType);
+ return List.of(resourceType);
}
}
// otherwise check all resource types in order of definition in enum
- return ImmutableList.copyOf(ResourceType.values());
+ return List.of(ResourceType.values());
}
ClassLoader getClassLoader() {