org.jbake.util.DataFileUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbake-core Show documentation
Show all versions of jbake-core Show documentation
JBake is a Java based open source static site/blog generator for developers.
package org.jbake.util;
import org.jbake.app.ContentStore;
import org.jbake.app.DocumentList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
public class DataFileUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(DataFileUtil.class);
private ContentStore db;
private String defaultDocType;
public DataFileUtil(ContentStore db, String defaultDocType) {
this.db = db;
this.defaultDocType = defaultDocType;
}
public Map get(String ref) {
Map result = new HashMap<>();
DocumentList docs = db.getDocumentByUri(ref);
if (docs.isEmpty()) {
LOGGER.warn("Unable to locate content for ref: {}", ref);
} else {
if (docs.size() == 1) {
result = (Map) docs.get(0);
} else {
LOGGER.warn("Located multiple hits for ref: {}", ref);
}
}
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy