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

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

Added HTMLDocumentTools, also modifications to the abstract interfaces
and the HTMLDocument doctype to support indexing by section.

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