Changeset 7189 for trunk


Ignore:
Timestamp:
2004-04-06T09:28:28+12:00 (20 years ago)
Author:
cs025
Message:

Fixes and improvements.

Location:
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/JPEGDocument.java

    r6101 r7189  
    1313public class JPEGDocument extends AbstractDocument
    1414{
    15   public static final String DOCUMENT_JPEG_TYPE = "JPEG";
     15  public static final String JPEG_DOCUMENT_TYPE = "JPEG";
     16
     17  public JPEGDocument(DocumentID id)
     18  { super(id);
     19  }
    1620 
    1721  public JPEGDocument(URL url)
     
    2024
    2125  public String getDocumentType()
    22   { return DOCUMENT_JPEG_TYPE;
     26  { return JPEG_DOCUMENT_TYPE;
    2327  }
    2428
     
    3640  { return true;
    3741  }
    38  
    39   public DocumentWriter getMETSWriter()
    40   { return null;
    41   }
    4242}
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/JPEGRecogniser.java

    r5800 r7189  
    88public class JPEGRecogniser implements RecogniserInterface
    99{
    10     DocumentList listRepository;
     10  DocumentList listRepository;
    1111
    12     public JPEGRecogniser(DocumentList listRepository)
    13     {   this.listRepository = listRepository;
    14     }
     12  public JPEGRecogniser(DocumentList listRepository)
     13  { this.listRepository = listRepository;
     14  }
    1515
    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     }
     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  }
    2626
    27     public boolean parseDocument(URL url)
    28     {   if (url.toString().startsWith("file://")) {
    29             String fileName = url.toString().substring(7);
    30        
    31    
    32             if (fileName.endsWith(".jpg") ||
    33                     fileName.endsWith(".jpeg"))
    34             {   this.listRepository.addDocument(new JPEGDocument(url));
    35                 // TODO: spawn knowledge of children too...
    36                 return true;
    37             }
    38         }
    39         else
    40         { // TODO: get Mime type remotely, and then proceed if required
    41         }
     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
     42    }
    4243
    43         return false;
    44     }
     44    return false;
     45  }
    4546       
    4647}
Note: See TracChangeset for help on using the changeset viewer.