1 | package org.greenstone.gsdl3.gs3build.doctypes;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 | import java.util.Map;
|
---|
5 |
|
---|
6 | import org.greenstone.gsdl3.gs3build.metadata.*;
|
---|
7 |
|
---|
8 | import org.greenstone.gsdl3.gs3build.util.MultiMap;
|
---|
9 |
|
---|
10 | public interface DocumentInterface
|
---|
11 | {
|
---|
12 | /**
|
---|
13 | * Get the immediate document type of the document. The type may be derived/inherited
|
---|
14 | * from other DocumentInterface types, but that cannot be checked here.
|
---|
15 | *
|
---|
16 | * @return <code>String</code> the document type as a string
|
---|
17 | */
|
---|
18 | public String getDocumentType();
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Check if this document is of a particular type, or is derived from a particular
|
---|
22 | * type - i.e. inheritance is considered as well as the immediate type.
|
---|
23 | *
|
---|
24 | * @param <code>String</code> the type to check against.
|
---|
25 | * @return <code>boolean</code> if the document matches the given type.
|
---|
26 | */
|
---|
27 | public boolean isDocumentType(String documentType);
|
---|
28 |
|
---|
29 | public void setID(DocumentID id);
|
---|
30 | public DocumentID getID();
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Get the METS type of the document.
|
---|
34 | *
|
---|
35 | * @return <code>String</code> the document type as a string
|
---|
36 | */
|
---|
37 | public String getMETSType();
|
---|
38 |
|
---|
39 | public void setHeader(METSHeader header);
|
---|
40 | public METSHeader getHeader();
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Whether the document is indexed or not.
|
---|
44 | *
|
---|
45 | * @return <code>boolean</code> <code>true</code> by default.
|
---|
46 | */
|
---|
47 | public boolean isIndexed();
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * The plain text of the document.
|
---|
51 | *
|
---|
52 | * @return <code>String</code> This value may be <code>null</code>
|
---|
53 | * for documents which have no textual component - e.g.
|
---|
54 | * an image file
|
---|
55 | */
|
---|
56 | public String getDocumentText();
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * The metadata for the document, encoded as a map.
|
---|
60 | *
|
---|
61 | * The returned Map may have the following properties:
|
---|
62 | * 1) It may be <code>null</code> - e.g. for plain text documents
|
---|
63 | * 2) Any value in the map may be a <code>List</code> object containing
|
---|
64 | * more than one possible value - e.g. they key 'Author' may associated
|
---|
65 | * with a List of several people.
|
---|
66 | * 3) Any value in the map may itself be a <code>Map</code> where the
|
---|
67 | * encoding scheme permits groupings of hierarchical metadata items.
|
---|
68 | * 4) Where the namespace for a metadata item is known, its key will
|
---|
69 | * include the namespace. Hence Dublin Core 'Author' would be encoded
|
---|
70 | * as "dc.Author" as the key.
|
---|
71 | *
|
---|
72 | * @return <code>METSDescriptive</code> the metadata of the document
|
---|
73 | */
|
---|
74 | public METSDescriptiveSet getDocumentMetadata();
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * The metadata for the document, encoded as a map.
|
---|
78 | *
|
---|
79 | * @param <code>String</code> the namespace of the metadata
|
---|
80 | * @param <code>String</code> the label of the values to obtain
|
---|
81 | *
|
---|
82 | * @return <code>List</code> the metadata values
|
---|
83 | */
|
---|
84 | public List getDocumentMetadataItem(String namespace, String label);
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * The metadata for the document, encoded as a map.
|
---|
88 | *
|
---|
89 | * @param <code>String</code> the namespace and label of the metadata, separated
|
---|
90 | * by a colon. If no namespace is given, it is
|
---|
91 | * defaulted
|
---|
92 | *
|
---|
93 | * @return <code>List</code> the metadata values
|
---|
94 | */
|
---|
95 | public List getDocumentMetadataItem(String namespaceLabel);
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Facilitate the decoration of a document with external or extracted
|
---|
99 | * metadata. This is a "cheap" form which doesn't have a separate
|
---|
100 | * namespace element. Either the data is to be stored in the "open"
|
---|
101 | * Greenstone metadata namespace, or the namespace is encoded within
|
---|
102 | * the label.
|
---|
103 | *
|
---|
104 | * @param <code>String</code> label of the metadata, with a '.' to deliminate
|
---|
105 | * sub-component structures. The label may commence
|
---|
106 | * with a namespace followed by a colon.
|
---|
107 | * <p>e.g. "dc:title" for Dublin Core Title.</p>
|
---|
108 | * @param <code>String</code> value of the metadata
|
---|
109 | */
|
---|
110 | public void addDocumentMetadata(String label, String value);
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Facilitate the decoration of a document with external or extracted
|
---|
114 | * metadata.
|
---|
115 | *
|
---|
116 | * @param <code>String</code> namespace of the metadata
|
---|
117 | * @param <code>String</code> label of the metadata, with a '.' to deliminate
|
---|
118 | * sub-component structures
|
---|
119 | * @param <code>String</code> value of the metadata
|
---|
120 | */
|
---|
121 | public void addDocumentMetadata(String namespace, String label, String value);
|
---|
122 |
|
---|
123 | /**
|
---|
124 | * The constituent files for the document: each should be wrapped up
|
---|
125 | * as a URL
|
---|
126 | *
|
---|
127 | * @return <code>METSFileSet</code> the files which constitute the document
|
---|
128 | */
|
---|
129 | public METSFileSet getDocumentFiles();
|
---|
130 |
|
---|
131 | /**
|
---|
132 | * Obtain the structural information on the document
|
---|
133 | *
|
---|
134 | * @return <code>METSStructureSet</code> the structural information on the
|
---|
135 | * document.
|
---|
136 | */
|
---|
137 | public METSStructureSet getDocumentStructure();
|
---|
138 |
|
---|
139 | /**
|
---|
140 | * Indicate whether the document can be stored in a native form in
|
---|
141 | * a METS wrapper
|
---|
142 | *
|
---|
143 | * @return <code>boolean</code> <code>true</code> if the document
|
---|
144 | * is just to be wrapped in a METS shell.
|
---|
145 | */
|
---|
146 | public boolean isMETSCompatible();
|
---|
147 |
|
---|
148 |
|
---|
149 | /**
|
---|
150 | * Write the document into a METS wrapper - for many document types,
|
---|
151 | * this will not actually be done by the document itself, but rather
|
---|
152 | * by the default writer
|
---|
153 | */
|
---|
154 | public DocumentWriter getMETSWriter();
|
---|
155 |
|
---|
156 | public DocumentSQLWriter getSQLWriter();
|
---|
157 | }
|
---|