001/* 002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Anahide Tchertchian 018 */ 019package org.nuxeo.ecm.web.resources.api.service; 020 021import java.util.List; 022 023import org.nuxeo.ecm.web.resources.api.Processor; 024import org.nuxeo.ecm.web.resources.api.Resource; 025import org.nuxeo.ecm.web.resources.api.ResourceBundle; 026import org.nuxeo.ecm.web.resources.api.ResourceContext; 027import org.nuxeo.runtime.service.TimestampedService; 028 029/** 030 * Service for web resources retrieval. 031 * 032 * @since 7.3 033 */ 034public interface WebResourceManager extends TimestampedService { 035 036 /** 037 * Returns a registered resource with given name, or null if not found. 038 * <p> 039 * Referenced resource can either be a static resource or a style. 040 */ 041 Resource getResource(String name); 042 043 /** 044 * Returns a registered resource bundle with given name, or null if not found. 045 */ 046 ResourceBundle getResourceBundle(String name); 047 048 /** 049 * Returns all resource bundles registered on the service. 050 */ 051 List<ResourceBundle> getResourceBundles(); 052 053 /** 054 * Returns the corresponding processor with given name, or null if not found. 055 */ 056 Processor getProcessor(String name); 057 058 /** 059 * Returns all processors registered on the service, ordered. 060 */ 061 List<Processor> getProcessors(); 062 063 /** 064 * Returns all processors registered on the service, ordered, for given type. 065 */ 066 List<Processor> getProcessors(String type); 067 068 /** 069 * Returns the ordered list of resources for given bundle name, filtered using given type. 070 * <p> 071 */ 072 List<Resource> getResources(ResourceContext context, String bundleName, String type); 073 074 /** 075 * Allows to dynamically register a bundle. 076 * 077 * @since 7.4 078 */ 079 void registerResourceBundle(ResourceBundle bundle); 080 081 /** 082 * Allows to dynamically unregister a bundle. 083 * 084 * @since 7.4 085 */ 086 void unregisterResourceBundle(ResourceBundle bundle); 087 088 /** 089 * Allows to dynamically register a resource. 090 * 091 * @since 7.4 092 */ 093 void registerResource(Resource resource); 094 095 /** 096 * Allows to dynamically unregister a resource. 097 * 098 * @since 7.4 099 */ 100 void unregisterResource(Resource resource); 101 102}