- Timestamp:
- 2004-11-08T15:56:35+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/JPEGRecogniser.java
r7189 r8484 8 8 public class JPEGRecogniser implements RecogniserInterface 9 9 { 10 DocumentList listRepository; 11 12 public JPEGRecogniser(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("image/jpeg")) { 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.getProtocol().equals("file")) { 29 String fileName = url.getPath(); 30 31 if (fileName != null && 32 (fileName.endsWith(".jpg") || 33 fileName.endsWith(".jpeg"))) 34 { System.out.println("Posting jpeg document " + url.toString()); 35 this.listRepository.addDocument(new JPEGDocument(url)); 36 // TODO: spawn knowledge of children too... 37 return true; 38 } 39 } 40 else 41 { // TODO: get Mime type remotely, and then proceed if required 10 DocumentList listRepository; 11 12 public JPEGRecogniser(DocumentList listRepository) 13 { 14 this.listRepository = listRepository; 42 15 } 43 16 44 return false; 45 } 46 17 public boolean parseDocument(METSFile file) 18 { 19 String MIMEType = file.getMIMEType(); 20 if (MIMEType == null || 21 MIMEType.equals("image/jpeg")) { 22 URL location = file.getLocation(); 23 return this.parseDocument(location); 24 } 25 return false; 26 } 27 28 public boolean parseDocument(URL url) 29 { 30 if (url.getProtocol().equals("file")) { 31 String fileName = url.getPath(); 32 33 if (fileName != null && 34 (fileName.endsWith(".jpg") || 35 fileName.endsWith(".jpeg"))) { 36 System.out.println("Posting jpeg document " + url.toString()); 37 this.listRepository.addDocument(new JPEGDocument(url)); 38 // TODO: spawn knowledge of children too... 39 return true; 40 } 41 } else { 42 // TODO: get Mime type remotely, and then proceed if required 43 } 44 45 return false; 46 } 47 47 48 }
Note:
See TracChangeset
for help on using the changeset viewer.