Last change
on this file since 12188 was 12188, checked in by kjdon, 18 years ago |
Initial revision
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1020 bytes
|
Line | |
---|
1 | package org.greenstone.gsdl3.gs3build.doctypes;
|
---|
2 |
|
---|
3 | //import java.io.*;
|
---|
4 | import java.net.URL;
|
---|
5 | import java.util.ArrayList;
|
---|
6 |
|
---|
7 |
|
---|
8 | public class MetadataRecogniser extends AbstractRecogniser
|
---|
9 | {
|
---|
10 |
|
---|
11 | public MetadataRecogniser()
|
---|
12 | {
|
---|
13 | this.preferred_mime_type = "text/xml";
|
---|
14 | this.filename_extensions = new ArrayList();
|
---|
15 | this.filename_extensions.add("metadata.xml");
|
---|
16 | this.document_type = MetadataDocument.METADATA_DOCUMENT_TYPE;
|
---|
17 | }
|
---|
18 |
|
---|
19 | public boolean parseDocument(URL url)
|
---|
20 | {
|
---|
21 | String filename = null;
|
---|
22 |
|
---|
23 | if (url.getProtocol().equals("file")) {
|
---|
24 | filename = url.getPath();
|
---|
25 | }
|
---|
26 |
|
---|
27 | if (filename != null) {
|
---|
28 | if (isAcceptedFilename(filename)) {
|
---|
29 |
|
---|
30 | System.out.println("Posting Metadata Document " + filename);
|
---|
31 | MetadataDocument doc = new MetadataDocument(url);
|
---|
32 | this.list_repository.addDocument(doc);
|
---|
33 | // TODO: spawn knowledge of children too...
|
---|
34 | // System.out.println(doc.getDocumentText());
|
---|
35 | return true;
|
---|
36 | }
|
---|
37 | } else {
|
---|
38 | // TODO: get Mime type remotely, and then proceed if required
|
---|
39 | }
|
---|
40 | return false;
|
---|
41 | }
|
---|
42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.