Search in sources :

Example 1 with FreeableResource

use of com.eden.orchid.api.resources.resource.FreeableResource in project Orchid by JavaEden.

the class OrchidGenerators method indexGenerator.

private void indexGenerator(OrchidGenerator generator) {
    Clog.d("Indexing generator: #{$1}:[#{$2 | className}]", generator.getPriority(), generator);
    List<? extends OrchidPage> generatorPages = generator.startIndexing();
    if (!EdenUtils.isEmpty(generator.getName()) && generatorPages != null && generatorPages.size() > 0) {
        OrchidInternalIndex index = new OrchidInternalIndex(generator.getName());
        for (OrchidPage page : generatorPages) {
            index.addToIndex(generator.getName() + "/" + page.getReference().getPath(), page);
            if (page.getResource() instanceof FreeableResource) {
                ((FreeableResource) page.getResource()).free();
            }
        }
        this.internalIndex.addChildIndex(generator.getName(), index);
    }
}
Also used : OrchidPage(com.eden.orchid.api.theme.pages.OrchidPage) FreeableResource(com.eden.orchid.api.resources.resource.FreeableResource) OrchidInternalIndex(com.eden.orchid.impl.indexing.OrchidInternalIndex)

Aggregations

FreeableResource (com.eden.orchid.api.resources.resource.FreeableResource)1 OrchidPage (com.eden.orchid.api.theme.pages.OrchidPage)1 OrchidInternalIndex (com.eden.orchid.impl.indexing.OrchidInternalIndex)1