001    /**
002     * Copyright (c) 2000-2011 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(
062                            long companyId, long repositoryId, String fileName)
063                    throws PortalException, SystemException;
064    
065            public void deleteFile(
066                            long companyId, long repositoryId, String fileName,
067                            String versionLabel)
068                    throws PortalException, SystemException;
069    
070            public File getFile(long companyId, long repositoryId, String fileName)
071                    throws PortalException, SystemException;
072    
073            public File getFile(
074                            long companyId, long repositoryId, String fileName,
075                            String versionLabel)
076                    throws PortalException, SystemException;
077    
078            public byte[] getFileAsBytes(
079                            long companyId, long repositoryId, String fileName)
080                    throws PortalException, SystemException;
081    
082            public byte[] getFileAsBytes(
083                            long companyId, long repositoryId, String fileName,
084                            String versionLabel)
085                    throws PortalException, SystemException;
086    
087            public InputStream getFileAsStream(
088                            long companyId, long repositoryId, String fileName)
089                    throws PortalException, SystemException;
090    
091            public InputStream getFileAsStream(
092                            long companyId, long repositoryId, String fileName,
093                            String versionLabel)
094                    throws PortalException, SystemException;
095    
096            public String[] getFileNames(long companyId, long repositoryId)
097                    throws SystemException;
098    
099            public String[] getFileNames(
100                            long companyId, long repositoryId, String dirName)
101                    throws PortalException, SystemException;
102    
103            public long getFileSize(
104                            long companyId, long repositoryId, String fileName)
105                    throws PortalException, SystemException;
106    
107            public boolean hasDirectory(
108                            long companyId, long repositoryId, String dirName)
109                    throws PortalException, SystemException;
110    
111            public boolean hasFile(long companyId, long repositoryId, String fileName)
112                    throws PortalException, SystemException;
113    
114            public boolean hasFile(
115                            long companyId, long repositoryId, String fileName,
116                            String versionLabel)
117                    throws PortalException, SystemException;
118    
119            public void move(String srcDir, String destDir) throws SystemException;
120    
121            public void updateFile(
122                            long companyId, long repositoryId, long newRepositoryId,
123                            String fileName)
124                    throws PortalException, SystemException;
125    
126            public void updateFile(
127                            long companyId, long repositoryId, String fileName,
128                            String newFileName)
129                    throws PortalException, SystemException;
130    
131            public void updateFile(
132                            long companyId, long repositoryId, String fileName,
133                            String versionLabel, byte[] bytes)
134                    throws PortalException, SystemException;
135    
136            public void updateFile(
137                            long companyId, long repositoryId, String fileName,
138                            String versionLabel, File file)
139                    throws PortalException, SystemException;
140    
141            public void updateFile(
142                            long companyId, long repositoryId, String fileName,
143                            String versionLabel, InputStream is)
144                    throws PortalException, SystemException;
145    
146            public void updateFileVersion(
147                            long companyId, long repositoryId, String fileName,
148                            String fromVersionLabel, String toVersionLabel)
149                    throws PortalException, SystemException;
150    
151    }