/** * Render an index file using the supplied content. * * @param indexFile The name of the output file * @throws Exception if IOException or SecurityException are raised */ public void renderIndex(String indexFile) throws Exception { render(new DefaultRenderingConfig(indexFile, MASTERINDEX_TEMPLATE_NAME)); }
/** * Create an Oven instance with given {@link Utensils} * * @param utensils All Utensils necessary to bake */ public Oven(Utensils utensils) { checkConfiguration(utensils.getConfiguration()); this.utensils = utensils; }
public void updateAndClearCacheIfNeeded(boolean needed, File templateFolder) { boolean clearCache = needed; if (!needed) { clearCache = updateTemplateSignatureIfChanged(templateFolder); } if (clearCache) { deleteAllDocumentTypes(); this.updateSchema(); } }
public static DocumentList wrap(Iterator<ODocument> docs) { DocumentList list = new DocumentList(); while (docs.hasNext()) { ODocument next = docs.next(); list.add(DBUtil.documentToModel(next)); } return list; }
@Override public DocumentList get(ContentStore db, Map model, String key) { DocumentList allContent = new DocumentList(); String[] documentTypes = DocumentTypes.getDocumentTypes(); for (String docType : documentTypes) { DocumentList query = db.getAllContent(docType); allContent.addAll(query); } return allContent; }
/** * Responsible for copying any asset files that exist within the content directory. * * @param path of the content directory */ public void copyAssetsFromContent(File path) { copy(path, config.getDestinationFolder(), FileUtil.getNotContentFileFilter()); }
@Override public DocumentList get(ContentStore db, Map model, String key) { DocumentList publishedContent = new DocumentList(); String[] documentTypes = DocumentTypes.getDocumentTypes(); for (String docType : documentTypes) { DocumentList query = db.getPublishedContent(docType); publishedContent.addAll(query); } return publishedContent; }
@BeforeClass public static void setUpTest() { //switch to PLOCAL mode for this test class as Travis sometimes runs out of memory db.close(); config.setDatabaseStore(StorageType.PLOCAL.toString()); db = DBUtil.createDataStore(config); }
@Override public DocumentList get(ContentStore db, Map model, String key) { // document types are pluralized in model, so unpluralize try { String type = DocumentTypeUtils.unpluralize(key); return db.getAllContent(type); } catch (UnsupportedOperationException e) { return new DocumentList(); } }
private void checkRequiredFolderExists(String folderName, File path) { if (!FileUtil.isExistingFolder(path)) { throw new JBakeException("Error: Required folder cannot be found! Expected to find [" + folderName + "] at: " + path.getAbsolutePath()); } }
public void close() { if (db != null) { activateOnCurrentThread(); db.close(); } DBUtil.closeDataStore(); }
/** * Creates new instance of Crawler. * * @param db Database instance for content * @param config Project configuration */ public Crawler(ContentStore db, JBakeConfiguration config) { this.db = db; this.config = config; this.parser = new Parser(config); }
@Override public DocumentList get(ContentStore db, Map model, String key) { return db.getPublishedContent(customDocumentType); }
/** * Create an Oven instance by a {@link JBakeConfiguration} * <p> * It creates default {@link Utensils} needed to bake sites. * * @param config The project configuration. see {@link JBakeConfiguration} */ public Oven(JBakeConfiguration config) { this.utensils = UtensilsFactory.createDefaultUtensils(config); }
@Override public DocumentList get(ContentStore db, Map model, String key) { return db.getPublishedPages(); }
@Override public Set<String> get(ContentStore db, Map model, String key) { return db.getAllTags(); }
/** * Render an XML feed file using the supplied content. * * @param feedFile The name of the output file * @throws Exception if default rendering configuration is not loaded correctly */ public void renderFeed(String feedFile) throws Exception { render(new DefaultRenderingConfig(feedFile, FEED_TEMPLATE_NAME)); }
public DocumentList getPublishedContent(String docType) { return getPublishedContent(docType, false); }
/** * Render an XML sitemap file using the supplied content. * * @param sitemapFile configuration for site map * @throws Exception if can't create correct default rendering config * @see <a href="https://support.google.com/webmasters/answer/156184?hl=en&ref_topic=8476">About Sitemaps</a> * @see <a href="http://www.sitemaps.org/">Sitemap protocol</a> */ public void renderSitemap(String sitemapFile) throws Exception { render(new DefaultRenderingConfig(sitemapFile, SITEMAP_TEMPLATE_NAME)); }
/** * Render an archive file using the supplied content. * * @param archiveFile The name of the output file * @throws Exception if default rendering configuration is not loaded correctly */ public void renderArchive(String archiveFile) throws Exception { render(new DefaultRenderingConfig(archiveFile, ARCHIVE_TEMPLATE_NAME)); }