KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > model > FileManager


1 package org.roller.model;
2
3 import java.io.File JavaDoc;
4 import java.io.InputStream JavaDoc;
5 import java.io.Serializable JavaDoc;
6
7 import org.roller.RollerException;
8 import org.roller.pojos.WebsiteData;
9 import org.roller.util.RollerMessages;
10
11 /**
12  * Interface for managing files uploaded to Roller.
13  *
14  * NOTE: this should probably be renamed "ResourceManager" or similar
15  * since the real jobe here is managing resources, not just files. We should
16  * then extend this a bit more to include the notion of not only user uploaded
17  * resources, but also other resources the system stores, such as the blacklist.
18  *
19  * @author dave
20  */

21 public interface FileManager extends Serializable JavaDoc
22 {
23     /** Determine if file can be saved in website's file space. */
24     public boolean canSave(
25         WebsiteData site, String JavaDoc name, long size, RollerMessages msgs)
26         throws RollerException;
27     
28     /** Get website's files */
29     public File JavaDoc[] getFiles(WebsiteData site)
30         throws RollerException;
31     
32     /** Delete specified file from website's file space. */
33     public void deleteFile(WebsiteData site, String JavaDoc name)
34         throws RollerException;
35
36     /** Save file in website's file space or throw exception if rules violated. */
37     public void saveFile(WebsiteData site, String JavaDoc name, long size, InputStream JavaDoc is)
38         throws RollerException;
39
40     /**
41      * Get directory in which uploaded files are stored
42      */

43     public String JavaDoc getUploadDir();
44     /**
45      * Get base URL where uploaded files are made available.
46      */

47     public String JavaDoc getUploadUrl();
48     
49     /**
50      * Release all resources associated with Roller session.
51      */

52     public void release();
53 }
54
Popular Tags