001/* 002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Anahide Tchertchian 016 */ 017package org.nuxeo.ecm.web.resources.api.service; 018 019import java.util.List; 020 021import org.nuxeo.ecm.web.resources.api.Processor; 022import org.nuxeo.ecm.web.resources.api.Resource; 023import org.nuxeo.ecm.web.resources.api.ResourceBundle; 024import org.nuxeo.ecm.web.resources.api.ResourceContext; 025 026/** 027 * Service for web resources retrieval. 028 * 029 * @since 7.3 030 */ 031public interface WebResourceManager { 032 033 /** 034 * Returns a registered resource with given name, or null if not found. 035 * <p> 036 * Referenced resource can either be a static resource or a style. 037 */ 038 Resource getResource(String name); 039 040 /** 041 * Returns a registered resource bundle with given name, or null if not found. 042 */ 043 ResourceBundle getResourceBundle(String name); 044 045 /** 046 * Returns all resource bundles registered on the service. 047 */ 048 List<ResourceBundle> getResourceBundles(); 049 050 /** 051 * Returns the corresponding processor with given name, or null if not found. 052 */ 053 Processor getProcessor(String name); 054 055 /** 056 * Returns all processors registered on the service, ordered. 057 */ 058 List<Processor> getProcessors(); 059 060 /** 061 * Returns all processors registered on the service, ordered, for given type. 062 */ 063 List<Processor> getProcessors(String type); 064 065 /** 066 * Returns the ordered list of resources for given bundle name, filtered using given type. 067 * <p> 068 */ 069 List<Resource> getResources(ResourceContext context, String bundleName, String type); 070 071 /** 072 * Allows to dynamically register a bundle. 073 * 074 * @since 7.4 075 */ 076 void registerResourceBundle(ResourceBundle bundle); 077 078 /** 079 * Allows to dynamically unregister a bundle. 080 * 081 * @since 7.4 082 */ 083 void unregisterResourceBundle(ResourceBundle bundle); 084 085 /** 086 * Allows to dynamically register a resource. 087 * 088 * @since 7.4 089 */ 090 void registerResource(Resource resource); 091 092 /** 093 * Allows to dynamically unregister a resource. 094 * 095 * @since 7.4 096 */ 097 void unregisterResource(Resource resource); 098 099}