/*
 *  (c) Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Hewlett-Packard Development Company, LP
 *  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.

 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * $Id: RDFReaderFImpl.java,v 1.13 2006-03-22 13:52:30 andy_seaborne Exp $
 */

package com.hp.hpl.jena.rdf.model.impl;

import com.hp.hpl.jena.*;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.shared.*;
import java.util.Properties;
import com.hp.hpl.jena.JenaRuntime ;

/**
 *
 * @author  bwm
 * @version $Revision: 1.13 $ $Date: 2006-03-22 13:52:30 $
 */
public class RDFReaderFImpl extends Object implements RDFReaderF {

    protected static Properties langToClassName = null;

    // predefined languages - these should probably go in a properties file

    protected static final String LANGS[] = { "RDF/XML",
                                              "RDF/XML-ABBREV",
                                              "N-TRIPLE",
                                              "N-TRIPLES",
                                              "N3",
                                              "TURTLE"};
    // default readers for each language

    protected static final String DEFAULTREADERS[] = {
        "com.hp.hpl.jena.rdf.arp.JenaReader",
        "com.hp.hpl.jena.rdf.arp.JenaReader",
        Jena.PATH + ".rdf.model.impl.NTripleReader",
        Jena.PATH + ".rdf.model.impl.NTripleReader",
        "com.hp.hpl.jena.n3.N3JenaReader",
        "com.hp.hpl.jena.n3.TurtleJenaReader"
    };

    protected static final String DEFAULTLANG = LANGS[0];

    protected static final String PROPNAMEBASE = Jena.PATH + ".reader.";

    static { // static initializer - set default readers
        langToClassName = new Properties();
        for (int i = 0; i<LANGS.length; i++) {
            langToClassName.setProperty(
                               LANGS[i],
                               JenaRuntime.getSystemProperty(PROPNAMEBASE + LANGS[i],
                                                  DEFAULTREADERS[i]));
        }
    }


    /** Creates new RDFReaderFImpl */
    public  RDFReaderFImpl() {
    }

    public RDFReader getReader()  {
        return getReader(DEFAULTLANG);
    }

    public RDFReader getReader(String lang)  {

        // setup default language
        if (lang==null || lang.equals("")) {
            lang = LANGS[0];
        }

        String className = langToClassName.getProperty(lang);
        if (className == null || className.equals("")) {
            throw new NoReaderForLangException( lang );
        }
        try {
          return (RDFReader) Class.forName(className)
                                  .newInstance();
        } catch (Exception e) {
            throw new JenaException(e);
        }
    }

    public String setReaderClassName( String lang,String className ) {
        return setBaseReaderClassName( lang, className );
    }
    
    public static String setBaseReaderClassName( String lang, String className ) {
        String oldClassName = langToClassName.getProperty(lang);
        langToClassName.setProperty(lang, className);
        return oldClassName;
    }
}

@@ -1560,29 +1560,29 @@
  1.1
-3
+4
  2006-0
-3-22 13:52:30
+8-25 14:44:15
  and
@@ -1855,17 +1855,17 @@
 ion: 1.1
-3
+4
  $ $Date
@@ -1876,21 +1876,21 @@
 06-0
-3-22 13:52:30
+8-25 14:44:15
  $%0A 
@@ -2438,16 +2438,69 @@
 %22TURTLE%22
+,%0A                                              %22TTL%22
 %7D;%0A    /
@@ -2781,32 +2781,32 @@
 NTripleReader%22,%0A
-
         %22com.hp.
@@ -2824,32 +2824,79 @@
 .N3JenaReader%22,%0A
+        %22com.hp.hpl.jena.n3.TurtleJenaReader%22,%0A
         %22com.hp.

Add TTL as a reader format (like TURTLE)