deweese 02/05/20 10:18:57 Modified: sources/org/apache/batik/util ParsedURL.java ParsedURLJarProtocolHandler.java Service.java Log: Documentation futzing. Revision Changes Path 1.11 +12 -9 xml-batik/sources/org/apache/batik/util/ParsedURL.java Index: ParsedURL.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/ParsedURL.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ParsedURL.java 5 Dec 2001 18:45:56 -0000 1.10 +++ ParsedURL.java 20 May 2002 17:18:57 -0000 1.11 @@ -43,7 +43,7 @@ * protocol specific instances of the ParsedURLData class. * * @author <a href="mailto:[EMAIL PROTECTED]">Thomas DeWeese</a> - * @version $Id: ParsedURL.java,v 1.10 2001/12/05 18:45:56 deweese Exp $ + * @version $Id: ParsedURL.java,v 1.11 2002/05/20 17:18:57 deweese Exp $ */ public class ParsedURL { @@ -352,6 +352,9 @@ /** * Attempt to open the stream checking for common compression * types, and automatically decompressing them if found. + * @param mimeType The expected mime type of the content + * in the returned InputStream (mapped to Http accept + * header among other possabilities). */ public InputStream openStream(String mimeType) throws IOException { List mt = new ArrayList(1); @@ -364,7 +367,7 @@ * types, and automatically decompressing them if found. * @param mimeTypes The expected mime types of the content * in the returned InputStream (mapped to Http accept - * header among other possability). + * header among other possabilities). */ public InputStream openStream(String [] mimeTypes) throws IOException { List mt = new ArrayList(mimeTypes.length); @@ -378,7 +381,7 @@ * types, and automatically decompressing them if found. * @param mimeTypes The expected mime types of the content * in the returned InputStream (mapped to Http accept - * header among other possability). The elements of + * header among other possabilities). The elements of * the iterator must be strings. */ public InputStream openStream(Iterator mimeTypes) throws IOException { @@ -386,7 +389,7 @@ } /** - * Attempt to open the stream, does no checking for comression + * Attempt to open the stream, does no checking for compression * types. */ public InputStream openStreamRaw() throws IOException { @@ -394,11 +397,11 @@ } /** - * Attempt to open the stream, does no checking for comression + * Attempt to open the stream, does no checking for compression * types. * @param mimeType The expected mime type of the content * in the returned InputStream (mapped to Http accept - * header among other possability). + * header among other possabilities). */ public InputStream openStreamRaw(String mimeType) throws IOException { List mt = new ArrayList(1); @@ -411,7 +414,7 @@ * types. * @param mimeTypes The expected mime types of the content * in the returned InputStream (mapped to Http accept - * header among other possability). + * header among other possabilities). */ public InputStream openStreamRaw(String [] mimeTypes) throws IOException { List mt = new ArrayList(mimeTypes.length); @@ -425,7 +428,7 @@ * types. * @param mimeTypes The expected mime types of the content * in the returned InputStream (mapped to Http accept - * header among other possability). The elements of + * header among other possabilities). The elements of * the iterator must be strings. */ public InputStream openStreamRaw(Iterator mimeTypes) throws IOException { @@ -481,9 +484,9 @@ */ public static ParsedURLData parseURL(ParsedURL baseURL, String urlStr) { String protocol = getProtocol(urlStr); - if (protocol == null) protocol = baseURL.getProtocol(); + ParsedURLProtocolHandler handler = getHandler(protocol); return handler.parseURL(baseURL, urlStr); } 1.3 +7 -1 xml-batik/sources/org/apache/batik/util/ParsedURLJarProtocolHandler.java Index: ParsedURLJarProtocolHandler.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/ParsedURLJarProtocolHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ParsedURLJarProtocolHandler.java 5 Dec 2001 19:01:19 -0000 1.2 +++ ParsedURLJarProtocolHandler.java 20 May 2002 17:18:57 -0000 1.3 @@ -19,7 +19,7 @@ * jar:<URL for jar file>!<path in jar file> * * @author <a href="mailto:[EMAIL PROTECTED]">Thomas DeWeese</a> - * @version $Id: ParsedURLJarProtocolHandler.java,v 1.2 2001/12/05 19:01:19 deweese Exp $ + * @version $Id: ParsedURLJarProtocolHandler.java,v 1.3 2002/05/20 17:18:57 deweese Exp $ */ public class ParsedURLJarProtocolHandler extends ParsedURLDefaultProtocolHandler { @@ -30,12 +30,18 @@ super(JAR); } + + // We mostly use the base class parse methods (that leverage + // java.net.URL. But we take care to ignore the baseURL if urlStr + // is an absolute URL. public ParsedURLData parseURL(ParsedURL baseURL, String urlStr) { String start = urlStr.substring(0, JAR.length()+1).toLowerCase(); + // urlStr is absolute... if (start.equals(JAR+":")) return parseURL(urlStr); + // It's relative so base it off baseURL. return super.parseURL(baseURL, urlStr); } } 1.2 +17 -5 xml-batik/sources/org/apache/batik/util/Service.java Index: Service.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/Service.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Service.java 27 Apr 2001 19:55:44 -0000 1.1 +++ Service.java 20 May 2002 17:18:57 -0000 1.2 @@ -25,17 +25,29 @@ * This class handles looking up service providers on the class path. * it implements the system described in: * - * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html - * Under Service Provider. Note that this interface is very - * similar to the one they describe which seems to be missing in the JDK. + * <a href='http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service Provider'> JAR + * File Specification Under Service Provider</a>. Note that this + * interface is very similar to the one they describe which seems to + * be missing in the JDK. * * @author <a href="mailto:[EMAIL PROTECTED]">Thomas DeWeese</a> - * @version $Id: Service.java,v 1.1 2001/04/27 19:55:44 deweese Exp $ - */ + * @version $Id: Service.java,v 1.2 2002/05/20 17:18:57 deweese Exp $ */ public class Service { + // Remember providers we have looked up before. static HashMap providerMap = new HashMap(); + /** + * Returns an iterator where each element should implement the + * interface (or subclass the baseclass) described by cls. The + * Classes are found by searching the classpath for service files + * named: 'META-INF/services/<fully qualified classname> that list + * fully qualifted classnames of classes that implement the + * service files classes interface. These classes must have + * default constructors. + * + * @param cls The class/interface to search for providers of. + */ public static synchronized Iterator providers(Class cls) { ClassLoader cl = cls.getClassLoader(); String serviceFile = "META-INF/services/"+cls.getName();
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]