52643be82aa8160c82e7871371c736ec40fc1b61
[jSite2.git] / src / net / pterodactylus / jsite / project / Entry.java
1 /*
2  * jSite2 - Entry.java -
3  * Copyright © 2008 David Roden
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 package net.pterodactylus.jsite.project;
21
22 import java.io.File;
23
24 /**
25  * A file is an entry in a directory. Its name can contain multiple components,
26  * separated by the platform’s {@link File#separatorChar}.
27  * 
28  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
29  */
30 public interface Entry {
31
32         /**
33          * Returns whether this entry denotes a virtual file. A virtual file entry
34          * is a file entry that does not have a corresponding file on the disk.
35          * 
36          * @return <code>true</code> if this entry is a virtual file entry,
37          *         <code>false</code> otherwise
38          */
39         public boolean isVirtual();
40
41         /**
42          * Returns whether this entry still has its default settings.
43          * 
44          * @return <code>true</code> if this entry has not been changed by the
45          *         user, <code>false</code> otherwise
46          */
47         public boolean isDefault();
48
49         /**
50          * Returns whether the content type setting is still the default.
51          * 
52          * @return <code>true</code> if the content type has not been changed by
53          *         the user, <code>false</code> otherwise
54          */
55         public boolean isDefaultContentType();
56
57         /**
58          * Returns the name of the file. The name can contain multiple path
59          * components, separated by the platform’s {@link File#separatorChar}. It
60          * will never start with a separator, though.
61          * 
62          * @return The name of the file
63          */
64         public String getName();
65
66         /**
67          * Sets the name of the file.
68          * 
69          * @param name
70          *            The name of the file
71          */
72         public void setName(String name);
73
74         /**
75          * Returns whether this file should be inserted.
76          * 
77          * @return <code>true</code> to insert the file, <code>false</code> to
78          *         skip it
79          */
80         public boolean isInsert();
81
82         /**
83          * Sets whether this file should be inserted.
84          * 
85          * @param insert
86          *            <code>true</code> to insert the file, <code>false</code>
87          *            to skip it
88          */
89         public void setInsert(boolean insert);
90
91         /**
92          * Returns the content type of the file. If the content type is
93          * <code>null</code>, the node will auto-detect the content type based on
94          * the filename. The content type is given as a MIME type.
95          * 
96          * @return The content of the file
97          */
98         public String getContentType();
99
100         /**
101          * Sets the content type of the file.
102          * 
103          * @param contentType
104          *            The content type of the file
105          */
106         public void setContentType(String contentType);
107
108         /**
109          * Restores the default content type.
110          */
111         public void restoreDefaultContentType();
112
113 }