001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.store;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    
020    import java.io.File;
021    import java.io.InputStream;
022    
023    /**
024     * The interface for all file store implementations. Most, if not all
025     * implementations should extend from the class {@link BaseStore}.
026     *
027     * @author Brian Wing Shun Chan
028     * @author Edward Han
029     * @see    BaseStore
030     */
031    public interface Store {
032    
033            public static final String VERSION_DEFAULT = "1.0";
034    
035            public void addDirectory(long companyId, long repositoryId, String dirName)
036                    throws PortalException, SystemException;
037    
038            public void addFile(
039                            long companyId, long repositoryId, String fileName, byte[] bytes)
040                    throws PortalException, SystemException;
041    
042            public void addFile(
043                            long companyId, long repositoryId, String fileName, File file)
044                    throws PortalException, SystemException;
045    
046            public void addFile(
047                            long companyId, long repositoryId, String fileName, InputStream is)
048                    throws PortalException, SystemException;
049    
050            public void checkRoot(long companyId) throws SystemException;
051    
052            public void copyFileVersion(
053                            long companyId, long repositoryId, String fileName,
054                            String fromVersionLabel, String toVersionLabel)
055                    throws PortalException, SystemException;
056    
057            public void deleteDirectory(
058                            long companyId, long repositoryId, String dirName)
059                    throws PortalException, SystemException;
060    
061            public void deleteFile(long companyId, long repositoryId, String fileName)
062                    throws PortalException, SystemException;
063    
064            public void deleteFile(
065                            long companyId, long repositoryId, String fileName,
066                            String versionLabel)
067                    throws PortalException, SystemException;
068    
069            public File getFile(long companyId, long repositoryId, String fileName)
070                    throws PortalException, SystemException;
071    
072            public File getFile(
073                            long companyId, long repositoryId, String fileName,
074                            String versionLabel)
075                    throws PortalException, SystemException;
076    
077            public byte[] getFileAsBytes(
078                            long companyId, long repositoryId, String fileName)
079                    throws PortalException, SystemException;
080    
081            public byte[] getFileAsBytes(
082                            long companyId, long repositoryId, String fileName,
083                            String versionLabel)
084                    throws PortalException, SystemException;
085    
086            public InputStream getFileAsStream(
087                            long companyId, long repositoryId, String fileName)
088                    throws PortalException, SystemException;
089    
090            public InputStream getFileAsStream(
091                            long companyId, long repositoryId, String fileName,
092                            String versionLabel)
093                    throws PortalException, SystemException;
094    
095            public String[] getFileNames(long companyId, long repositoryId)
096                    throws SystemException;
097    
098            public String[] getFileNames(
099                            long companyId, long repositoryId, String dirName)
100                    throws PortalException, SystemException;
101    
102            public long getFileSize(long companyId, long repositoryId, String fileName)
103                    throws PortalException, SystemException;
104    
105            public boolean hasDirectory(
106                            long companyId, long repositoryId, String dirName)
107                    throws PortalException, SystemException;
108    
109            public boolean hasFile(long companyId, long repositoryId, String fileName)
110                    throws PortalException, SystemException;
111    
112            public boolean hasFile(
113                            long companyId, long repositoryId, String fileName,
114                            String versionLabel)
115                    throws PortalException, SystemException;
116    
117            public void move(String srcDir, String destDir) throws SystemException;
118    
119            public void updateFile(
120                            long companyId, long repositoryId, long newRepositoryId,
121                            String fileName)
122                    throws PortalException, SystemException;
123    
124            public void updateFile(
125                            long companyId, long repositoryId, String fileName,
126                            String newFileName)
127                    throws PortalException, SystemException;
128    
129            public void updateFile(
130                            long companyId, long repositoryId, String fileName,
131                            String versionLabel, byte[] bytes)
132                    throws PortalException, SystemException;
133    
134            public void updateFile(
135                            long companyId, long repositoryId, String fileName,
136                            String versionLabel, File file)
137                    throws PortalException, SystemException;
138    
139            public void updateFile(
140                            long companyId, long repositoryId, String fileName,
141                            String versionLabel, InputStream is)
142                    throws PortalException, SystemException;
143    
144            public void updateFileVersion(
145                            long companyId, long repositoryId, String fileName,
146                            String fromVersionLabel, String toVersionLabel)
147                    throws PortalException, SystemException;
148    
149    }