Changeset 8492


Ignore:
Timestamp:
2004-11-09T11:26:05+13:00 (19 years ago)
Author:
kjdon
Message:

added in a new method to create documents from a URL

File:
1 edited

Legend:

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

    r8459 r8492  
    33import java.sql.SQLException;
    44import java.sql.ResultSet;
     5import java.net.URL;
    56
    67import org.greenstone.gsdl3.gs3build.util.GS3SQLConnection;
    78
    89public class DocumentFactory {
     10   
    911    public static AbstractDocument createDocument(String type, DocumentID id) {
    1012   
    11     System.out.println(type + " " + id.toString());
    1213    if (type.equals(HTMLDocument.HTML_DOCUMENT_TYPE)) {
    1314        return new HTMLDocument(id);
     
    2223    } else if (type.equals(METSDocument.METS_DOCUMENT_TYPE)) {
    2324        return new METSDocument(id);
     25    } else if (type.equals(GMLDocument.GML_DOCUMENT_TYPE)) {
     26        return new GMLDocument(id);
     27    }
     28   
     29    /*
     30      else if (type.equals(ExtXMLDocument.EXTXML_DOCUMENT_TYPE))
     31      { return new ExtXMLDocument(id);
     32      }*/
     33    return null;
     34    }
     35    public static AbstractDocument createDocument(String type, URL url) {
     36   
     37    if (type.equals(HTMLDocument.HTML_DOCUMENT_TYPE)) {
     38        return new HTMLDocument(url);
     39    } else if (type.equals(TextDocument.TEXT_DOCUMENT_TYPE)) {
     40        return new TextDocument(url);
     41    } else if (type.equals(JPEGDocument.JPEG_DOCUMENT_TYPE)) {
     42        return new JPEGDocument(url);
     43    } else if (type.equals(IndexDocument.INDEX_DOCUMENT_TYPE)) {
     44        return new IndexDocument(url);
     45    } else if (type.equals(MetadataDocument.METADATA_DOCUMENT_TYPE)) {
     46        return new MetadataDocument(url);
     47    } else if (type.equals(METSDocument.METS_DOCUMENT_TYPE)) {
     48        return new METSDocument(url);
     49    } else if (type.equals(GMLDocument.GML_DOCUMENT_TYPE)) {
     50        return new GMLDocument(url);
    2451    }
    2552   
Note: See TracChangeset for help on using the changeset viewer.