1 /* 2 * Copyright (c) 2002-2021, City of Paris 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright notice 10 * and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright notice 13 * and the following disclaimer in the documentation and/or other materials 14 * provided with the distribution. 15 * 16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its 17 * contributors may be used to endorse or promote products derived from 18 * this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 * 32 * License 1.0 33 */ 34 package fr.paris.lutece.plugins.blobstore.business.filesystem; 35 36 import fr.paris.lutece.plugins.blobstore.business.BytesBlobStore; 37 import fr.paris.lutece.plugins.blobstore.business.InputStreamBlobStore; 38 39 import java.io.IOException; 40 import java.io.InputStream; 41 42 /** 43 * The Interface IFileSystemBlobStoreHome. 44 */ 45 public interface IFileSystemBlobStoreHome 46 { 47 /** 48 * Creation of an instance of record physical file. 49 * 50 * @param blobStore 51 * The instance of the physical file which contains the informations to store 52 * @param strBasePath 53 * base directory 54 * @param depth 55 * the depth 56 * @throws IOException 57 * ioe 58 * @throws FileAlreadyExistsException 59 * already exists 60 */ 61 void create( final BytesBlobStore blobStore, final String strBasePath, final Integer depth ) throws IOException, FileAlreadyExistsException; 62 63 /** 64 * Update of physical file which is specified in parameter. 65 * 66 * @param blobStore 67 * the blob store 68 * @param strBasePath 69 * base directory 70 * @param depth 71 * the depth 72 * @throws IOException 73 * ioe 74 */ 75 void update( final BytesBlobStore blobStore, final String strBasePath, final Integer depth ) throws IOException; 76 77 /** 78 * Update of physical file which is specified in parameter. 79 * 80 * @param blobStore 81 * The instance of the record physicalFile which contains the informations to update 82 * @param strBasePath 83 * base directory 84 * @param depth 85 * the depth 86 * @throws IOException 87 * ioe 88 */ 89 void updateInputStream( final InputStreamBlobStore blobStore, final String strBasePath, final Integer depth ) throws IOException; 90 91 /** 92 * Delete the physical file whose identifier is specified in parameter. 93 * 94 * @param strKey 95 * The identifier of the record physical file 96 * @param strBasePath 97 * base directory 98 * @param depth 99 * the depth 100 * @return <code>true</code> if the file is removed, <code>false</code> otherwise. 101 * @throws IOException 102 * ioe 103 */ 104 boolean remove( final String strKey, final String strBasePath, final Integer depth ) throws IOException; 105 106 /** 107 * Returns an instance of a physical file whose identifier is specified in parameter. 108 * 109 * @param strKey 110 * The file primary key 111 * @param strBasePath 112 * base directory 113 * @param depth 114 * the depth 115 * @return an instance of physical file 116 * @throws IOException 117 * ioe 118 */ 119 BytesBlobStore findByPrimaryKey( final String strKey, final String strBasePath, final Integer depth ) throws IOException; 120 121 /** 122 * Returns an instance of a physical file whose identifier is specified in parameter. 123 * 124 * @param strKey 125 * The file primary key 126 * @param strBasePath 127 * base directory 128 * @param depth 129 * the depth 130 * @return an instance of physical file 131 * @throws IOException 132 * ioe 133 */ 134 InputStream findByPrimaryKeyInputStream( final String strKey, final String strBasePath, final Integer depth ) throws IOException; 135 136 /** 137 * Creation of an instance of record physical file. 138 * 139 * @param blobStore 140 * The instance of the physical file which contains the inputstream to store 141 * @param strBasePath 142 * base directory 143 * @param depth 144 * the depth 145 * @throws FileAlreadyExistsException 146 * already exists 147 * @throws IOException 148 * ioe 149 */ 150 void createInputStream( final InputStreamBlobStore blobStore, final String strBasePath, final Integer depth ) 151 throws FileAlreadyExistsException, IOException; 152 }