diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-07-01 17:27:48 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-07-01 17:27:48 -0400 |
| commit | 02bc52037e9ccccca672d6156d9c325c74fe28b3 (patch) | |
| tree | db022b83c90562f461f4a27412caa9936a8dfd04 /projects/net.wotonomy.datastore/src/main/java/net | |
| parent | c75d7dbd613a47b217499f7a856c469a8bc59e2a (diff) | |
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"
Diffstat (limited to 'projects/net.wotonomy.datastore/src/main/java/net')
| -rw-r--r-- | projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/DataSoup.java | 4 | ||||
| -rw-r--r-- | projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/XMLFileSoup.java | 14 |
2 files changed, 11 insertions, 7 deletions
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<String> 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<String> 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); |
