From 34f578db7f7881962be6e5d69241875ab9f10f11 Mon Sep 17 00:00:00 2001 From: kitfox Date: Thu, 6 Feb 2014 17:27:31 +0000 Subject: Fixing SVGSALAMANDER-33. User can now selectively remove documents from cache. git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@169 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b --- src/main/java/com/kitfox/svg/SVGUniverse.java | 58 +++++++++------------------ 1 file changed, 19 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/kitfox/svg/SVGUniverse.java b/src/main/java/com/kitfox/svg/SVGUniverse.java index b6859b9..5f6a2cd 100644 --- a/src/main/java/com/kitfox/svg/SVGUniverse.java +++ b/src/main/java/com/kitfox/svg/SVGUniverse.java @@ -54,6 +54,7 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.logging.Level; @@ -624,45 +625,24 @@ public class SVGUniverse implements Serializable return null; } -// public static void main(String argv[]) -// { -// try -// { -// URL url = new URL("svgSalamander", "localhost", -1, "abc.svg", -// new URLStreamHandler() -// { -// protected URLConnection openConnection(URL u) -// { -// return null; -// } -// } -// ); -//// URL url2 = new URL("svgSalamander", "localhost", -1, "abc.svg"); -// -// //Investigate URI resolution -// URI uriA, uriB, uriC, uriD, uriE; -// -// uriA = new URI("svgSalamander", "/names/mySpecialName", null); -//// uriA = new URI("http://www.kitfox.com/salamander"); -//// uriA = new URI("svgSalamander://mySpecialName/grape"); -// System.err.println(uriA.toString()); -// System.err.println(uriA.getScheme()); -// -// uriB = uriA.resolve("#begin"); -// System.err.println(uriB.toString()); -// -// uriC = uriA.resolve("tree#boing"); -// System.err.println(uriC.toString()); -// -// uriC = uriA.resolve("../tree#boing"); -// System.err.println(uriC.toString()); -// } -// catch (Exception e) -// { -// Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, -// "Could not parse", e); -// } -// } + /** + * Get list of uris of all loaded documents and subdocuments. + * @return + */ + public ArrayList getLoadedDocumentURIs() + { + return new ArrayList(loadedDocs.keySet()); + } + + /** + * Remove loaded document from cache. + * @param uri + */ + public void removeDocument(URI uri) + { + loadedDocs.remove(uri); + } + public boolean isVerbose() { return verbose; -- cgit v1.2.3-55-g7522