001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.commons.io.res; 020 021import java.io.IOException; 022import java.io.Serializable; 023import java.util.Map; 024 025/** 026 * Interface for resource provider, loaded by "Resources", 027 * classes that implement a provider that produce resources, that match given path. 028 * 029 */ 030public interface ResourceProvider extends Serializable { 031 032 033 /** 034 * this class is called by the "Resources" at startup 035 * @param scheme of the provider (can be "null") 036 * @param arguments initals argument (can be "null") 037 */ 038 public ResourceProvider init(String scheme, Map arguments); 039 040 /** 041 * return a resource that match given path 042 * @param path 043 * @return matching resource to path 044 */ 045 public Resource getResource(String path); 046 047 /** 048 * returns the scheme of the resource 049 * @return scheme 050 */ 051 public String getScheme(); 052 053 /** 054 * returns the arguments defined for this resource 055 * @return scheme 056 */ 057 public Map<String,String> getArguments(); 058 059 public void setResources(Resources resources); 060 061 public void unlock(Resource res); 062 public void lock(Resource res) throws IOException; 063 public void read(Resource res) throws IOException; 064 065 /** 066 * returns if the resources of the provider are case-sensitive or not 067 * @return is resource case-sensitive or not 068 */ 069 public boolean isCaseSensitive(); 070 071 /** 072 * returns if the resource support mode for his resources 073 * @return is mode supported or not 074 */ 075 public boolean isModeSupported(); 076 077 /** 078 * returns if the resource support attributes for his resources 079 * @return is attributes supported or not 080 */ 081 public boolean isAttributesSupported(); 082}