KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */

18 package org.apache.roller.model;
19
20 import java.io.File JavaDoc;
21 import java.io.InputStream JavaDoc;
22 import java.io.Serializable JavaDoc;
23
24 import org.apache.roller.RollerException;
25 import org.apache.roller.pojos.WebsiteData;
26 import org.apache.roller.util.RollerMessages;
27
28 /**
29  * Interface for managing files uploaded to Roller.
30  *
31  * NOTE: this should probably be renamed "ResourceManager" or similar
32  * since the real jobe here is managing resources, not just files. We should
33  * then extend this a bit more to include the notion of not only user uploaded
34  * resources, but also other resources the system stores, such as the blacklist.
35  *
36  * @author dave
37  */

38 public interface FileManager extends Serializable JavaDoc
39 {
40     /** Determine if file can be saved in website's file space. */
41     public boolean canSave(
42         String JavaDoc weblogHandle, String JavaDoc name, String JavaDoc contentType, long size, RollerMessages msgs)
43         throws RollerException;
44     
45     /** Get website's files */
46     public File JavaDoc[] getFiles(String JavaDoc weblogHandle)
47         throws RollerException;
48     
49     /** Delete specified file from website's file space. */
50     public void deleteFile(String JavaDoc weblogHandle, String JavaDoc name)
51         throws RollerException;
52
53     /** Save file in website's file space or throw exception if rules violated. */
54     public void saveFile(String JavaDoc weblogHandle, String JavaDoc name, String JavaDoc contentType, long size, InputStream JavaDoc is)
55         throws RollerException;
56
57     /** Return true if weblog is over the file-upload limit */
58     public boolean overQuota(String JavaDoc weblogHandle) throws RollerException;
59             
60     /**
61      * Get directory in which uploaded files are stored
62      */

63     public String JavaDoc getUploadDir();
64     /**
65      * Get base URL where uploaded files are made available.
66      */

67     public String JavaDoc getUploadUrl();
68     
69     /**
70      * Release all resources associated with Roller session.
71      */

72     public void release();
73 }
74
Popular Tags