KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > publication > Document


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not 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.
15  *
16  */

17
18 /* $Id: Document.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.cms.publication;
21
22 import java.io.File JavaDoc;
23 import java.util.Date JavaDoc;
24
25 /**
26  * A CMS document.
27  */

28 public interface Document {
29     
30     String JavaDoc NAMESPACE = "http://apache.org/cocoon/lenya/document/1.0";
31     String JavaDoc DEFAULT_PREFIX = "lenya";
32     
33     /**
34      * Returns the document ID of this document.
35      * @return the document-id of this document.
36      */

37     String JavaDoc getId();
38     
39     /**
40      * Returns the document name of this document.
41      * @return the document-name of this document.
42      */

43     String JavaDoc getName();
44     
45     /**
46      * Instead of returning the full document-id for this
47      * document it just returns the id of the particular
48      * node, basically the basename of the document-id.
49      *
50      * @return the node id, i.e. the basename of the document-id
51      */

52     String JavaDoc getNodeId();
53
54     /**
55      * Returns the publication this document belongs to.
56      * @return A publication object.
57      */

58     Publication getPublication();
59
60     /**
61      * Returns the complete URL of this document in the info area:<br/>
62      * /{publication-id}/info-{area}{document-id}{language-suffix}.{extension}
63      * @return A string.
64      */

65     String JavaDoc getCompleteInfoURL();
66
67     /**
68      * Returns the complete URL of this document:<br/>
69      * /{publication-id}/{area}{document-id}{language-suffix}.{extension}
70      * @return A string.
71      */

72     String JavaDoc getCompleteURL();
73
74     /**
75      * Returns the complete URL of this document without
76      * the language-suffix:
77      * /{publication-id}/{area}{document-id}.{extension}
78      * The URL always starts with a slash (/).
79      * @return A string.
80      */

81     String JavaDoc getCompleteURLWithoutLanguage();
82
83     /**
84      * Returns the URL of this document:
85      * {document-id}{language-suffix}.{extension}
86      * The URL always starts with a slash (/).
87      * @return A string.
88      */

89     String JavaDoc getDocumentURL();
90
91     /**
92      * Returns the dublin core class for this document.
93      * @return A DublinCore object.
94      */

95     DublinCore getDublinCore();
96
97     /**
98      * Returns the language of this document.
99      * Each document has one language associated to it.
100      * @return A string denoting the language.
101      */

102     String JavaDoc getLanguage();
103
104     /**
105      * Returns all the languages this document is available in.
106      * A document has one associated language (@see Document#getLanguage)
107      * but there are possibly a number of other languages for which a
108      * document with the same document-id is also available in.
109      *
110      * @return An array of strings denoting the languages.
111      *
112      * @throws DocumentException if an error occurs
113      */

114     String JavaDoc[] getLanguages() throws DocumentException;
115
116     /**
117      * Get the navigation label associated with this document
118      * for the language.
119      *
120      * @return the label String
121      *
122      * @throws DocumentException if an error occurs
123      */

124     String JavaDoc getLabel() throws DocumentException;
125
126     /**
127      * Returns the date of the last modification of this document.
128      * @return A date denoting the date of the last modification.
129      */

130     Date JavaDoc getLastModified();
131
132     /**
133      * Returns the area this document belongs to.
134      * @return The area.
135      */

136     String JavaDoc getArea();
137
138     /**
139      * Returns the file for this document.
140      * @return A file object.
141      */

142     File JavaDoc getFile();
143
144     /**
145      * Returns the extension in the URL.
146      * @return A string.
147      */

148     String JavaDoc getExtension();
149     
150     /**
151      * Check if a document with the given document-id, language and in the given
152      * area actually exists.
153      *
154      * @return true if the document exists, false otherwise
155      *
156      * @throws DocumentException if an error occurs
157      */

158     boolean exists() throws DocumentException;
159     
160     /**
161      * Check if a document exists with the given document-id and the given area
162      * independently of the given language.
163      *
164      * @return true if a document with the given document-id and area exists,
165      * null otherwise
166      *
167      * @throws DocumentException if an error occurs
168      */

169     boolean existsInAnyLanguage() throws DocumentException;
170     
171 }
172
Popular Tags