Author: xor
Date: 2008-10-27 21:52:26 +0000 (Mon, 27 Oct 2008)
New Revision: 23119

Modified:
   trunk/plugins/FMSPlugin/FMSIdentity.java
   trunk/plugins/FMSPlugin/FMSIdentityManager.java
   trunk/plugins/FMSPlugin/FMSMessage.java
   trunk/plugins/FMSPlugin/FMSOwnIdentity.java
Log:
Make these classes abstract. WoT-based FMS will implement them. Also add more 
functions, clean up and rename stuff.

Modified: trunk/plugins/FMSPlugin/FMSIdentity.java
===================================================================
--- trunk/plugins/FMSPlugin/FMSIdentity.java    2008-10-27 21:36:04 UTC (rev 
23118)
+++ trunk/plugins/FMSPlugin/FMSIdentity.java    2008-10-27 21:52:26 UTC (rev 
23119)
@@ -3,21 +3,23 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package plugins.FMSPlugin;

-public class FMSIdentity {
+import freenet.keys.FreenetURI;
+
+public abstract class FMSIdentity {

-       private final String nickName;
-       private final String requestUri;
+       private final String mNickname;
+       private final FreenetURI mRequestURI;

-       public FMSIdentity(String nickname, String requesturi) {
-               nickName = nickname;
-               requestUri = requesturi;
+       public FMSIdentity(String newNickname, FreenetURI newRequestURI) {
+               mNickname = newNickname;
+               mRequestURI = newRequestURI;
        }

        public String getNickName() {
-               return nickName;
+               return mNickname;
        }

-       public String getRequestURI() {
-               return requestUri;
+       public FreenetURI getRequestURI() {
+               return mRequestURI;
        }
 }

Modified: trunk/plugins/FMSPlugin/FMSIdentityManager.java
===================================================================
--- trunk/plugins/FMSPlugin/FMSIdentityManager.java     2008-10-27 21:36:04 UTC 
(rev 23118)
+++ trunk/plugins/FMSPlugin/FMSIdentityManager.java     2008-10-27 21:52:26 UTC 
(rev 23119)
@@ -3,13 +3,15 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package plugins.FMSPlugin;

+import java.util.Set;
+
 import freenet.support.Executor;

 /**
- * @author saces
+ * @author saces, xor
  *
  */
-public class FMSIdentityManager {
+public abstract class FMSIdentityManager implements Set<FMSIdentity> {

        private final Executor _executor;

@@ -18,9 +20,4 @@

        }

-       void killMe() {
-               // TODO Auto-generated method stub
-               
-       }
-
 }

Modified: trunk/plugins/FMSPlugin/FMSMessage.java
===================================================================
--- trunk/plugins/FMSPlugin/FMSMessage.java     2008-10-27 21:36:04 UTC (rev 
23118)
+++ trunk/plugins/FMSPlugin/FMSMessage.java     2008-10-27 21:52:26 UTC (rev 
23119)
@@ -3,10 +3,76 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package plugins.FMSPlugin;

+import java.util.Date;
+import java.util.List;
+
+import freenet.keys.FreenetURI;
+
 /**
- * @author saces
+ * @author saces, xor
  *
  */
-public class FMSMessage {
+public abstract class FMSMessage {
+       
+       public final FreenetURI mURI;
+       
+       public final FMSIdentity mAuthor;

+       public final String mTitle;
+       
+       /**
+        * The date when the message was written in UTC time.
+        */
+       public final Date mDate;
+       
+       public FMSMessage(FreenetURI newURI, FMSIdentity newAuthor, String 
newTitle, Date newDate) {
+               mURI = newURI;
+               mAuthor = newAuthor;
+               mTitle = newTitle;
+               mDate = newDate; // TODO: Check out whether Date provides a 
function for getting the timezone and throw an Exception if not UTC.
+       }
+       
+       /**
+        * Get the URI of the message.
+        * @return The URI of the message.
+        */
+       public FreenetURI getURI() {
+               return mURI;
+       }
+
+       /**
+        * Get the author of the message.
+        * @return The author of the message.
+        */
+       public FMSIdentity getAuthor() {
+               return mAuthor;
+       }
+
+       /**
+        * Get the title of the message.
+        * @return The title of the message.
+        */
+       public String getTitle() {
+               return mTitle;
+       }
+       
+       /**
+        * Get the date when the message was written.
+        * @return The date when the message was written in UTC time.
+        */
+       public Date getDate() {
+               return mDate;
+       }
+       
+       /**
+        * Get the text of the message.
+        * @return The text of the message.
+        */
+       public abstract String getText();
+       
+       /**
+        * Get the attachments of the message.
+        * @return The attachments of the message.
+        */
+       public abstract List<FreenetURI> getAttachments();
 }

Modified: trunk/plugins/FMSPlugin/FMSOwnIdentity.java
===================================================================
--- trunk/plugins/FMSPlugin/FMSOwnIdentity.java 2008-10-27 21:36:04 UTC (rev 
23118)
+++ trunk/plugins/FMSPlugin/FMSOwnIdentity.java 2008-10-27 21:52:26 UTC (rev 
23119)
@@ -3,44 +3,37 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package plugins.FMSPlugin;

-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
 import java.util.Date;
+import freenet.keys.FreenetURI;

 /**
- * @author saces
+ * @author saces, xor
  *
  */
-public class FMSOwnIdentity extends FMSIdentity {
+public abstract class FMSOwnIdentity extends FMSIdentity {

-       private final String insertUri;
-       private final boolean publishTrustList;
+       private final FreenetURI mInsertURI;
+       private final boolean mPublishTrustList;

-       public FMSOwnIdentity(String nickname, String requesturi, String 
inserturi, boolean publishtrustlist) {
-               super(nickname, requesturi);
-               insertUri = inserturi;
-               publishTrustList = publishtrustlist;
+       public FMSOwnIdentity(String newNickname, FreenetURI newRequestURI, 
FreenetURI newInsertURI, boolean bPublishTrustList) {
+               super(newNickname, newRequestURI);
+               mInsertURI = newInsertURI;
+               mPublishTrustList = bPublishTrustList;
        }

-       public String getLastChange() {
-               return "LastChange";
+       public FreenetURI getInsertURI() {
+               return mInsertURI;
        }
-
-       public Date getLastInsert() {
-               return new Date(0);
-       }
-
-       public String getInsertURI() {
-               return insertUri;
-       }

        public boolean doesPublishTrustList() {
-               return publishTrustList;
+               return mPublishTrustList;
        }

+       public abstract Date getLastChange();
+
+       public abstract Date getLastInsert();
+       
+       /*
        public final void exportXML(OutputStream out) throws IOException {
                Writer w = new BufferedWriter(new OutputStreamWriter(out));
                w.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
@@ -57,4 +50,5 @@
                w.flush();
                w.close();
        }
+       */
 }


Reply via email to