001package org.biojava.naming;
002
003import java.util.Properties;
004
005import javax.naming.CompoundName;
006import javax.naming.Name;
007import javax.naming.NameParser;
008import javax.naming.NamingException;
009
010/**
011 * Singleton class for parsers that understand OBDA URIs.
012 *
013 * @author Matthew Pocock
014 */
015public class ObdaUriParser
016        implements NameParser
017{
018  private static final Properties syntax;
019  private static final ObdaUriParser INSTANCE;
020
021  static
022  {
023    syntax = new Properties();
024    syntax.put("jndi.syntax.direction", "left_to_right");
025    syntax.put("jndi.syntax.separator", ":");
026    syntax.put("jndi.syntax.ignorecase", "true");
027
028    INSTANCE = new ObdaUriParser();
029  }
030
031  public static ObdaUriParser getInstance()
032  {
033    return INSTANCE;
034  }
035
036  private ObdaUriParser()
037  {
038    // only we should make one
039  }
040
041  public Name parse(String name)
042          throws NamingException
043  {
044    return new CompoundName(name, syntax);
045  }
046}