001/* 002 * (C) Copyright 2006-2008 Nuxeo SAS (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.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 * bstefanescu 016 */ 017package org.nuxeo.ecm.webengine.loader.store; 018 019import java.io.IOException; 020import java.io.InputStream; 021import java.net.URL; 022 023/** 024 * When implementing a resource store you should implement equals and hashCode method. A store is equals to another if 025 * the store location is the same. 026 * 027 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 028 */ 029public interface ResourceStore { 030 031 void put(final String name, final InputStream data) throws IOException; 032 033 void put(final String name, final byte[] data) throws IOException; 034 035 InputStream getStream(final String name); 036 037 byte[] getBytes(final String name); 038 039 void remove(final String name); 040 041 boolean exists(final String name); 042 043 long lastModified(String name); 044 045 URL getURL(final String name); 046 047 /** 048 * A string that uniquely identify the location of that store. Two stores are considered equals if their locations 049 * are the same. 050 */ 051 String getLocation(); 052 053}