uk.ac.bham.gloss
Class Resolver

java.lang.Object
  extended by uk.ac.bham.gloss.Resolver
All Implemented Interfaces:
javax.xml.transform.URIResolver, org.xml.sax.EntityResolver

public class Resolver
extends java.lang.Object
implements org.xml.sax.EntityResolver, javax.xml.transform.URIResolver

This class extends EntityResolver and provides a filter to determine which XML input files are local and from the GLOSS distribution and which are non-local. Copyright Richard Kaye 2007-8 for GLOSS, http://gloss.bham.ac.uk Usage permitted according to the GPL. No waranty.


Constructor Summary
Resolver()
           
Resolver(Logger l)
           
 
Method Summary
static java.lang.String findGlossDirectory()
          Searches for a GLOSS distribuition directory in the following locations (in order) $GLOSS $HOME/gloss $HOME/.gloss /usr/local/share/gloss /usr/local/lib/gloss /usr/share/gloss /usr/lib/gloss else uses null (i.e., use URLs rather than local files).
static java.lang.String replaceGlossURLPrefix(java.lang.String uri, java.lang.String localBase)
           
 javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base)
           
 java.lang.String resolveEntity(java.lang.String systemId)
          Standard resolveEntity method as required in org.xml.sax.EntityResolver.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Standard resolveEntity method as required in org.xml.sax.EntityResolver.
 void setGlossDirectory(java.lang.String d)
          Sets the directory of a GLOSS distribution directory.
 void setLogger(Logger l)
          Sets the logger object for diagnostics on this resolver
protected static boolean testGlossLocalBase(java.lang.String glossLB)
          Tests to see if "glossLB" is the base directory of a GLOSS distribution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resolver

public Resolver()

Resolver

public Resolver(Logger l)
Method Detail

testGlossLocalBase

protected static boolean testGlossLocalBase(java.lang.String glossLB)
Tests to see if "glossLB" is the base directory of a GLOSS distribution.


findGlossDirectory

public static java.lang.String findGlossDirectory()
Searches for a GLOSS distribuition directory in the following locations (in order) $GLOSS $HOME/gloss $HOME/.gloss /usr/local/share/gloss /usr/local/lib/gloss /usr/share/gloss /usr/lib/gloss else uses null (i.e., use URLs rather than local files).


setGlossDirectory

public void setGlossDirectory(java.lang.String d)
                       throws GlossException
Sets the directory of a GLOSS distribution directory. Set to null for no local directory (use http to get files) Otherwise set to a full path-name such as "/home/myname/MySoftware/installed/gloss1.0a"; excluding any final "/".

Throws:
GlossException

setLogger

public void setLogger(Logger l)
Sets the logger object for diagnostics on this resolver


replaceGlossURLPrefix

public static java.lang.String replaceGlossURLPrefix(java.lang.String uri,
                                                     java.lang.String localBase)

resolveEntity

public java.lang.String resolveEntity(java.lang.String systemId)
Standard resolveEntity method as required in org.xml.sax.EntityResolver.


resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Standard resolveEntity method as required in org.xml.sax.EntityResolver.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Throws:
org.xml.sax.SAXException
java.io.IOException

resolve

public javax.xml.transform.Source resolve(java.lang.String href,
                                          java.lang.String base)
                                   throws javax.xml.transform.TransformerException
Specified by:
resolve in interface javax.xml.transform.URIResolver
Throws:
javax.xml.transform.TransformerException