From 02bc52037e9ccccca672d6156d9c325c74fe28b3 Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 1 Jul 2024 17:27:48 -0400 Subject: Update a whole bunch of things Yeah... not a great commit message. t.b.h, I could maybe've split the commit into more parts; but that would be quite a lot off effort and would have a pretty decent chance of at least one of the commits leaving the repository in a non-working state. For the future, will want to try and commit more often so there aren't these mega-commits where it's just "a whole bunch of stuff changed" --- projects/net.wotonomy.datastore/pom.xml | 13 +++++++++++++ .../src/main/java/net/wotonomy/datastore/DataSoup.java | 4 ++-- .../src/main/java/net/wotonomy/datastore/XMLFileSoup.java | 14 +++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) (limited to 'projects/net.wotonomy.datastore') diff --git a/projects/net.wotonomy.datastore/pom.xml b/projects/net.wotonomy.datastore/pom.xml index 1955d17..7dfad9e 100644 --- a/projects/net.wotonomy.datastore/pom.xml +++ b/projects/net.wotonomy.datastore/pom.xml @@ -22,6 +22,19 @@ test + + + 11 + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + diff --git a/projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/DataSoup.java b/projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/DataSoup.java index c7523b3..d599e9d 100644 --- a/projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/DataSoup.java +++ b/projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/DataSoup.java @@ -93,7 +93,7 @@ public interface DataSoup { * * @return A collection of all indices in this soup. */ - public Collection getAllIndices(); + public Collection getAllIndices(); // relationship management @@ -181,7 +181,7 @@ public interface DataSoup { * @return A DataView containing the objects for the corresponding keys, in the * order in which the keys are returned from the collection. */ - public DataView queryByKeys(Collection aKeyList); + public DataView queryByKeys(Collection aKeyList); /** * As queryByIndex, but with objects returned in reverse order. diff --git a/projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/XMLFileSoup.java b/projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/XMLFileSoup.java index cb22f7a..a6564f6 100644 --- a/projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/XMLFileSoup.java +++ b/projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/XMLFileSoup.java @@ -27,6 +27,11 @@ import java.net.MalformedURLException; import net.wotonomy.web.xml.XMLRPCDecoder; import net.wotonomy.web.xml.XMLRPCEncoder; +/** + * An implementation of FileSoup for an XML file + * @author bjculkin + * + */ public class XMLFileSoup extends FileSoup { public XMLFileSoup(String aPath) { super(aPath); @@ -34,8 +39,8 @@ public class XMLFileSoup extends FileSoup { // file access methods + @Override protected boolean writeFile(String name, Object anObject) { -//System.out.print( "writeFile: " + name + "..." ); try { File f = new File(getHomeDirectory(), name); FileOutputStream fos = new FileOutputStream(f); @@ -47,29 +52,28 @@ public class XMLFileSoup extends FileSoup { System.err.println("XMLFileSoup.writeFile: " + exc); return false; } -//System.out.println( "done." ); return true; } + @Override protected Object readFile(String name) { -//System.out.print( "readFile: " + name + "..." ); Object result = null; try { File f = new File(getHomeDirectory(), name); FileInputStream fis = new FileInputStream(f); XMLRPCDecoder decoder = new XMLRPCDecoder(); - result = decoder.decode(fis, f.getAbsolutePath(), f.toURL()); + result = decoder.decode(fis, f.getAbsolutePath(), f.toURI().toURL()); fis.close(); } catch (MalformedURLException exc) { result = null; } catch (IOException exc) { result = null; } -//System.out.println( "done." ); return result; } + @Override protected boolean deleteFile(String name) { try { File f = new File(getHomeDirectory(), name); -- cgit v1.2.3