source: trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/DocumentInterface.java@ 7466

Last change on this file since 7466 was 7466, checked in by cs025, 20 years ago

Many changes to support date information, Windows pathnames in Recogniser-
Manager and also better loading of classes through the Manager.

  • Property svn:keywords set to Author Date Id Revision
File size: 8.7 KB
Line 
1package org.greenstone.gsdl3.gs3build.doctypes;
2
3import java.util.List;
4import java.util.Map;
5
6import java.net.URL;
7
8import org.greenstone.gsdl3.gs3build.metadata.*;
9
10import org.greenstone.gsdl3.gs3build.util.MultiMap;
11import org.greenstone.gsdl3.gs3build.util.GS3SQLConnection;
12
13public interface DocumentInterface
14{
15 /**
16 * Get the immediate document type of the document. The type may be derived/inherited
17 * from other DocumentInterface types, but that cannot be checked here.
18 *
19 * @return <code>String</code> the document type as a string
20 */
21 public String getDocumentType();
22
23 /**
24 * Check if this document is of a particular type, or is derived from a particular
25 * type - i.e. inheritance is considered as well as the immediate type.
26 *
27 * @param <code>String</code> the type to check against.
28 * @return <code>boolean</code> if the document matches the given type.
29 */
30 public boolean isDocumentType(String documentType);
31
32 public void setID(DocumentID id);
33 public DocumentID getID();
34
35 /**
36 * Get the METS type of the document.
37 *
38 * @return <code>String</code> the document type as a string
39 */
40 public String getMETSType();
41
42 public void setHeader(METSHeader header);
43 public METSHeader getHeader();
44
45 /**
46 * Whether the document is indexed or not.
47 *
48 * @return <code>boolean</code> <code>true</code> by default.
49 */
50 public boolean isIndexed();
51
52 /**
53 * Get the date that this file was modified
54 */
55 public long getModifiedDatestamp();
56
57 /**
58 * Check if the document matches another in the database
59 */
60 public boolean hasDuplicate(GS3SQLConnection connection);
61
62 /**
63 * The plain text of the document.
64 *
65 * @return <code>String</code> This value may be <code>null</code>
66 * for documents which have no textual component - e.g.
67 * an image file
68 */
69 public String getDocumentText();
70
71 /**
72 * The document as a dom object
73 */
74 public org.w3c.dom.Document getDOMDocument();
75
76 /**
77 * Get the text of a section of this document
78 *
79 * @return <code>String</code> the text as a string - for sections
80 * that have no textual components, this value may be
81 * <code>null</code>
82 */
83 public String getSectionText(String sectionId);
84
85 /**
86 * The metadata for the document, encoded as a map.
87 *
88 * The returned Map may have the following properties:
89 * 1) It may be <code>null</code> - e.g. for plain text documents
90 * 2) Any value in the map may be a <code>List</code> object containing
91 * more than one possible value - e.g. they key 'Author' may associated
92 * with a List of several people.
93 * 3) Any value in the map may itself be a <code>Map</code> where the
94 * encoding scheme permits groupings of hierarchical metadata items.
95 * 4) Where the namespace for a metadata item is known, its key will
96 * include the namespace. Hence Dublin Core 'Author' would be encoded
97 * as "dc.Author" as the key.
98 *
99 * @return <code>METSDescriptive</code> the metadata of the document
100 */
101 public METSDescriptiveSet getDocumentMetadata();
102
103 /**
104 * The metadata for a particular given upon the document, encoded as a <code>List</code>
105 *
106 * @param <code>String</code> the namespace of the metadata
107 * @param <code>String</code> the label of the values to obtain
108 *
109 * @return <code>List</code> the metadata values
110 */
111 public List getDocumentMetadataItem(String namespace, String label);
112
113 /**
114 * The metadata for the document, encoded as a map.
115 *
116 * @param <code>String</code> the namespace and label of the metadata, separated
117 * by a colon. If no namespace is given, it is
118 * defaulted
119 *
120 * @return <code>List</code> the metadata values
121 */
122 public List getDocumentMetadataItem(String namespaceLabel);
123
124 /**
125 * Facilitate the decoration of a document with external or extracted
126 * metadata. This is a "cheap" form which doesn't have a separate
127 * namespace element. Either the data is to be stored in the "open"
128 * Greenstone metadata namespace, or the namespace is encoded within
129 * the label.
130 *
131 * @param <code>MetadataLabel</code> label of the metadata, with a '.' to deliminate
132 * sub-component structures. The label may commence
133 * with a namespace followed by a colon.
134 * <p>e.g. "dc:title" for Dublin Core Title.</p>
135 * @param <code>String</code> value of the metadata
136 */
137 public void addDocumentMetadata(MetadataLabel label, String value);
138
139 /**
140 * Facilitate the decoration of a document with external or extracted
141 * metadata. This is a "cheap" form which doesn't have a separate
142 * namespace element. Either the data is to be stored in the "open"
143 * Greenstone metadata namespace, or the namespace is encoded within
144 * the label.
145 *
146 * @param <code>MetadataLabel</code> label of the metadata, with a '.' to deliminate
147 * sub-component structures. The label may commence
148 * with a namespace followed by a colon.
149 * <p>e.g. "dc:title" for Dublin Core Title.</p>
150 * @param <code>String</code> value of the metadata
151 */
152 public void setDocumentMetadata(MetadataLabel label, String value);
153
154 /**
155 * Facilitate the decoration of a document with external or extracted
156 * metadata.
157 *
158 * @param <code>String</code> namespace of the metadata
159 * @param <code>String</code> label of the metadata, with a '.' to deliminate
160 * sub-component structures
161 * @param <code>String</code> value of the metadata
162 */
163 public void addDocumentMetadata(String namespace, String label, String value);
164
165 /**
166 * Facilitate the decoration of a document with external or extracted
167 * metadata.
168 *
169 * @param <code>String</code> namespace of the metadata
170 * @param <code>String</code> label of the metadata, with a '.' to deliminate
171 * sub-component structures
172 * @param <code>String</code> value of the metadata
173 */
174 public void setDocumentMetadata(String namespace, String label, String value);
175
176 /**
177 * Facilitate the removal of document metadata.
178 *
179 * @param <code>String</code> namespace of the metadata
180 * @param <code>String</code> label of the metadata, with a '.' to deliminate
181 * sub-component structures
182 */
183 public void removeDocumentMetadata(String namespace, String label);
184
185 /**
186 * Facilitate the removal of all metadata of a given label from the document.
187 *
188 * @param <code>String</code> namespace of the metadata
189 * @param <code>String</code> label of the metadata, with a '.' to deliminate
190 * sub-component structures
191 */
192 public void removeAllMetadata(String namespace, String label);
193
194 /**
195 * Post metadata to a file in this document - the appropriate changes
196 * should be made...
197 *
198 * @param <code>URL</code> the location of the file...
199 * @param <code>String</code> the namespace of the metadata
200 * @param <code>String</code> label of the metadata, with a '.' to deliminate
201 * sub-component structures
202 * @param <code>String</code> value of the metadata
203 */
204 public void postFileMetadata(URL fileLocation, String namespace, String label, String value);
205
206 /**
207 * The constituent files for the document: each should be wrapped up
208 * as a URL
209 *
210 * @return <code>METSFileSet</code> the files which constitute the document
211 */
212 public METSFileSet getDocumentFiles();
213
214 /**
215 * Set the constituent files for the document.
216 */
217 public void setDocumentFiles(METSFileSet fileSet);
218
219 /**
220 * Obtain the structural information on the document
221 *
222 * @return <code>METSStructureSet</code> the structural information on the
223 * document.
224 */
225 public METSStructureSet getDocumentStructure();
226
227 /**
228 * Indicate whether the document can be stored in a native form in
229 * a METS wrapper
230 *
231 * @return <code>boolean</code> <code>true</code> if the document
232 * is just to be wrapped in a METS shell.
233 */
234 public boolean isMETSCompatible();
235
236 /**
237 * Write the document into a METS wrapper - for many document types,
238 * this will not actually be done by the document itself, but rather
239 * by the default writer
240 */
241 public DocumentWriter getMETSWriter();
242
243 /**
244 * Get the writer to send the document to an SQL database
245 */
246 public DocumentSQLWriter getSQLWriter();
247
248 /**
249 * Check if the document is changed or not
250 */
251 public boolean isModified();
252
253 /**
254 * Set the document modified state
255 */
256 public void setModified(boolean isModified);
257}
Note: See TracBrowser for help on using the repository browser.