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