it compiles
[org.ibex.mail.git] / src / org / ibex / mail / target / FileSystem.java
index edfd112..ab277a2 100644 (file)
@@ -1,4 +1,5 @@
 package org.ibex.mail.target;
+import org.ibex.mail.*;
 import org.ibex.util.*;
 import org.ibex.mail.*;
 import java.io.*;
@@ -11,11 +12,11 @@ public class FileSystem {
 
     private static final String STORAGE_ROOT =
         System.getProperty("ibex.mail.root", File.separatorChar + "var" + File.separatorChar + "org.ibex.mail");
-
-    //public final FileBased root = new FileBased(STORAGE_ROOT + File.separatorChar);
+    public static FileBased root = null;
     public static Transcript transcript = null;
     static {
         try {
+            root = new FileBased(STORAGE_ROOT + File.separatorChar);
             transcript = new Transcript(STORAGE_ROOT + File.separatorChar + "transcript");
         } catch (Exception e) {
             e.printStackTrace();
@@ -27,9 +28,11 @@ public class FileSystem {
     public int[] list() { throw new Error(this.getClass().getName() + " does not support the list() method"); }
     public int add(Message message) throws IOException {
         throw new Error(this.getClass().getName() + " does not support the add() method"); }
-    public Message.StoredMessage get(int messagenum) throws IOException {
+    public int delete(Message message) throws IOException {
+        throw new Error(this.getClass().getName() + " does not support the delete() method"); }
+    public Message get(int messagenum) throws IOException {
         throw new Error(this.getClass().getName() + " does not support the get() method"); }
-    public Message.StoredMessage[] query(int maxResults) {
+    public Message[] query(int maxResults) {
         throw new Error(this.getClass().getName() + " does not support the query() method"); }
 
     /** a fast-write, slow-read place to stash all messages we touch -- in case of a major f*ckup */
@@ -97,23 +100,26 @@ public class FileSystem {
             return target;
         }
 
-        public Message.StoredMessage get(int messagenum) throws IOException {
+        public Message get(int messagenum) throws IOException {
             File f = new File(path + File.separatorChar + messagenum + ".");        
             if (!f.exists()) throw new FileNotFoundException(f.toString());
-            try {
-                Message.StoredMessage ret =
-                    new Message.StoredMessage(new LineReader(new InputStreamReader(new FileInputStream(f))));
+            //try {
+                // FIXME: need to store envelope from/to
+                //Message ret = new Message(new LineReader(new InputStreamReader(new FileInputStream(f))));
                 // FIXME: set answered/read/etc here
-                return ret;
+                //return ret;
+                return null;
+                /*
             } catch (MailException.Malformed malf) {
                 Log.error(this, "This should never happen");
                 Log.error(this, malf);
                 return null;
             }
+                */
         }
 
         // query types: stringmatch (headers, body), header element, deletion status, date range, message size
-        public Message.StoredMessage[] query(int maxResults) {
+        public Message[] query(int maxResults) {
             throw new RuntimeException("FileBased.query() not implemented yet");
         }