Last change
on this file since 5800 was 5800, checked in by cs025, 20 years ago |
Adding gs3build
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.0 KB
|
Line | |
---|
1 | package org.greenstone.gsdl3.gs3build.doctypes;
|
---|
2 |
|
---|
3 | import java.io.*;
|
---|
4 | import java.net.*;
|
---|
5 |
|
---|
6 | import org.greenstone.gsdl3.gs3build.metadata.*;
|
---|
7 |
|
---|
8 | public class TextRecogniser implements RecogniserInterface
|
---|
9 | {
|
---|
10 | DocumentList listRepository;
|
---|
11 |
|
---|
12 | public TextRecogniser(DocumentList listRepository)
|
---|
13 | { this.listRepository = listRepository;
|
---|
14 | }
|
---|
15 |
|
---|
16 | public boolean parseDocument(METSFile file)
|
---|
17 | {
|
---|
18 | String MIMEType = file.getMIMEType();
|
---|
19 | if (MIMEType == null ||
|
---|
20 | MIMEType.equals("text/plain")) {
|
---|
21 | URL location = file.getLocation();
|
---|
22 | return this.parseDocument(location);
|
---|
23 | }
|
---|
24 | return false;
|
---|
25 | }
|
---|
26 |
|
---|
27 | public boolean parseDocument(URL url)
|
---|
28 | { if (url.toString().startsWith("file://")) {
|
---|
29 | String fileName = url.toString().substring(7);
|
---|
30 |
|
---|
31 | if (fileName.endsWith(".txt") ||
|
---|
32 | fileName.endsWith(".text"))
|
---|
33 | { this.listRepository.addDocument(new TextDocument(url));
|
---|
34 | // TODO: spawn knowledge of children too...
|
---|
35 | System.out.println(">>> Posting text document " + fileName);
|
---|
36 | return true;
|
---|
37 | }
|
---|
38 | }
|
---|
39 | else
|
---|
40 | { // Check MIME type
|
---|
41 | }
|
---|
42 |
|
---|
43 | return false;
|
---|
44 | }
|
---|
45 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.