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

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

Added getSectionText member function to documents

  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 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 * Get the text of a section of this document
62 *
63 * @return <code>String</code> the text as a string - for sections
64 * that have no textual components, this value may be
65 * <code>null</code>
66 */
67 public String getSectionText(String sectionId);
68
69 /**
70 * The metadata for the document, encoded as a map.
71 *
72 * The returned Map may have the following properties:
73 * 1) It may be <code>null</code> - e.g. for plain text documents
74 * 2) Any value in the map may be a <code>List</code> object containing
75 * more than one possible value - e.g. they key 'Author' may associated
76 * with a List of several people.
77 * 3) Any value in the map may itself be a <code>Map</code> where the
78 * encoding scheme permits groupings of hierarchical metadata items.
79 * 4) Where the namespace for a metadata item is known, its key will
80 * include the namespace. Hence Dublin Core 'Author' would be encoded
81 * as "dc.Author" as the key.
82 *
83 * @return <code>METSDescriptive</code> the metadata of the document
84 */
85 public METSDescriptiveSet getDocumentMetadata();
86
87 /**
88 * The metadata for a particular given upon the document, encoded as a <code>List</code>
89 *
90 * @param <code>String</code> the namespace of the metadata
91 * @param <code>String</code> the label of the values to obtain
92 *
93 * @return <code>List</code> the metadata values
94 */
95 public List getDocumentMetadataItem(String namespace, String label);
96
97 /**
98 * The metadata for the document, encoded as a map.
99 *
100 * @param <code>String</code> the namespace and label of the metadata, separated
101 * by a colon. If no namespace is given, it is
102 * defaulted
103 *
104 * @return <code>List</code> the metadata values
105 */
106 public List getDocumentMetadataItem(String namespaceLabel);
107
108 /**
109 * Facilitate the decoration of a document with external or extracted
110 * metadata. This is a "cheap" form which doesn't have a separate
111 * namespace element. Either the data is to be stored in the "open"
112 * Greenstone metadata namespace, or the namespace is encoded within
113 * the label.
114 *
115 * @param <code>String</code> label of the metadata, with a '.' to deliminate
116 * sub-component structures. The label may commence
117 * with a namespace followed by a colon.
118 * <p>e.g. "dc:title" for Dublin Core Title.</p>
119 * @param <code>String</code> value of the metadata
120 */
121 public void addDocumentMetadata(String label, String value);
122
123 /**
124 * Facilitate the decoration of a document with external or extracted
125 * metadata.
126 *
127 * @param <code>String</code> namespace of the metadata
128 * @param <code>String</code> label of the metadata, with a '.' to deliminate
129 * sub-component structures
130 * @param <code>String</code> value of the metadata
131 */
132 public void addDocumentMetadata(String namespace, String label, String value);
133
134
135 /**
136 * Post metadata to a file in this document - the appropriate changes
137 * should be made...
138 *
139 * @param <code>URL</code> the location of the file...
140 * @param <code>String</code> the namespace of the metadata
141 * @param <code>String</code> label of the metadata, with a '.' to deliminate
142 * sub-component structures
143 * @param <code>String</code> value of the metadata
144 */
145 public void postFileMetadata(URL fileLocation, String namespace, String label, String value);
146
147 /**
148 * The constituent files for the document: each should be wrapped up
149 * as a URL
150 *
151 * @return <code>METSFileSet</code> the files which constitute the document
152 */
153 public METSFileSet getDocumentFiles();
154
155 /**
156 * Set the constituent files for the document.
157 */
158 public void setDocumentFiles(METSFileSet fileSet);
159
160 /**
161 * Obtain the structural information on the document
162 *
163 * @return <code>METSStructureSet</code> the structural information on the
164 * document.
165 */
166 public METSStructureSet getDocumentStructure();
167
168 /**
169 * Indicate whether the document can be stored in a native form in
170 * a METS wrapper
171 *
172 * @return <code>boolean</code> <code>true</code> if the document
173 * is just to be wrapped in a METS shell.
174 */
175 public boolean isMETSCompatible();
176
177 /**
178 * Write the document into a METS wrapper - for many document types,
179 * this will not actually be done by the document itself, but rather
180 * by the default writer
181 */
182 public DocumentWriter getMETSWriter();
183
184 /**
185 * Get the writer to send the document to an SQL database
186 */
187 public DocumentSQLWriter getSQLWriter();
188
189 /**
190 * Check if the document is changed or not
191 */
192 public boolean isModified();
193
194 /**
195 * Set the document modified state
196 */
197 public void setModified(boolean isModified);
198}
Note: See TracBrowser for help on using the repository browser.