1 | package org.greenstone.gsdl3.gs3build.metadata;
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * A METS document representation - the METS objects are represented
|
---|
5 | * by hand-coded classes rather than JAXB products due to the fact
|
---|
6 | * that we want wrappers to provide higher-level abstractions than
|
---|
7 | * the basic METS XML mark-up.
|
---|
8 | */
|
---|
9 |
|
---|
10 | import java.util.Map;
|
---|
11 | import java.util.HashMap;
|
---|
12 |
|
---|
13 | import java.io.File;
|
---|
14 | import java.net.URL;
|
---|
15 |
|
---|
16 | public class METSDocument
|
---|
17 | {
|
---|
18 | // TODO: add use of 'ID'
|
---|
19 | String objectID;
|
---|
20 | String label;
|
---|
21 | String type;
|
---|
22 | // TODO: add use of 'PROFILE';
|
---|
23 |
|
---|
24 | METSHeader header;
|
---|
25 | METSDescriptiveSet descriptiveSet;
|
---|
26 | METSAdmin admin;
|
---|
27 | METSFileSet fileSet;
|
---|
28 |
|
---|
29 | public METSDocument(String identifier)
|
---|
30 | {
|
---|
31 | this.objectID = identifier; // In Greenstone land, this should be a unique identifier within
|
---|
32 | // the current collection
|
---|
33 | this.type = "document"; // Types in METS are just strings - we currently use
|
---|
34 | // 'Document' as a standard representation.
|
---|
35 | // Individual options should be defined in a published
|
---|
36 | // METS Profile - in Greenstone we currently 'cheat'
|
---|
37 | // and bodge the system
|
---|
38 | this.header = new METSHeader();
|
---|
39 | this.descriptiveSet = new METSDescriptiveSet();
|
---|
40 | this.fileSet = new METSFileSet();
|
---|
41 | }
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Set the document identifier for this document
|
---|
45 | *
|
---|
46 | * @param <code>String</code> the identifier
|
---|
47 | */
|
---|
48 | public void setDocId(String id)
|
---|
49 | { this.objectID = id;
|
---|
50 | }
|
---|
51 |
|
---|
52 | public String getDocId()
|
---|
53 | { return this.objectID;
|
---|
54 | }
|
---|
55 |
|
---|
56 | public METSHeader getHeader()
|
---|
57 | { return this.header;
|
---|
58 | }
|
---|
59 |
|
---|
60 | public void setHeader(METSHeader header)
|
---|
61 | { this.header = header;
|
---|
62 | }
|
---|
63 |
|
---|
64 | public void addFile(METSFile file)
|
---|
65 | { this.fileSet.addFile(file);
|
---|
66 | }
|
---|
67 |
|
---|
68 | public void addFile(URL url)
|
---|
69 | { this.fileSet.addFile(url);
|
---|
70 | }
|
---|
71 |
|
---|
72 | public void addFile(METSFile file, String toGroup)
|
---|
73 | { this.fileSet.addFile(file, toGroup);
|
---|
74 | }
|
---|
75 | }
|
---|