package org.greenstone.gsdl3.gs3build.doctypes; import java.io.*; import java.net.*; import org.greenstone.gsdl3.gs3build.metadata.*; public class GMLRecogniser implements RecogniserInterface { DocumentList listRepository; public GMLRecogniser(DocumentList listRepository) { this.listRepository = listRepository; } public boolean parseDocument(METSFile file) { String MIMEType = file.getMIMEType(); if (MIMEType == null || MIMEType.equals("text/xml")) { URL location = file.getLocation(); return this.parseDocument(location); } return false; } public boolean parseDocument(URL url) { if (url.toString().startsWith("file://")) { String fileName = url.toString().substring(7); if (fileName.endsWith(".gml")) { System.out.println("Posting GML Document " + fileName); GMLDocument doc = new GMLDocument(url); this.listRepository.addDocument(doc); // TODO: spawn knowledge of children too... // System.out.println(doc.getDocumentText()); return true; } } else { // TODO: get Mime type remotely, and then proceed if required } return false; } }