summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.datastore/src
diff options
context:
space:
mode:
Diffstat (limited to 'projects/net.wotonomy.datastore/src')
-rw-r--r--projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/DataSoup.java4
-rw-r--r--projects/net.wotonomy.datastore/src/main/java/net/wotonomy/datastore/XMLFileSoup.java14
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);