Author: saces
Date: 2007-11-19 21:49:17 +0000 (Mon, 19 Nov 2007)
New Revision: 15859

Removed:
   trunk/plugins/HelloFCP/PingMessage.java
   trunk/plugins/HelloFCP/PongMessage.java
Modified:
   trunk/plugins/HelloFCP/HelloFCP.java
Log:
update HelloFCP plugin

Modified: trunk/plugins/HelloFCP/HelloFCP.java
===================================================================
--- trunk/plugins/HelloFCP/HelloFCP.java        2007-11-19 21:48:08 UTC (rev 
15858)
+++ trunk/plugins/HelloFCP/HelloFCP.java        2007-11-19 21:49:17 UTC (rev 
15859)
@@ -1,14 +1,15 @@
-/**
- * 
- */
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
 package plugins.HelloFCP;

-import freenet.node.fcp.FCPMessage;
+import freenet.pluginmanager.FCPPluginOutputWrapper;
 import freenet.pluginmanager.FredPlugin;
 import freenet.pluginmanager.FredPluginFCP;
 import freenet.pluginmanager.FredPluginThreadless;
 import freenet.pluginmanager.PluginRespirator;
 import freenet.support.SimpleFieldSet;
+import freenet.support.api.Bucket;

 /**
  * @author saces
@@ -23,26 +24,17 @@
        public void terminate() {

        }
-
+       
        /**
-        * sample command:
-        * <pre>
-        * plugins.HelloFCP.HelloFCP.Ping
-        * EndMessage
-        * </pre>
-        * the node have found our class (plugins.HelloFCP.HelloFCP) and want 
now to
-        * know what to do with "Ping"
         * 
         * the fullaccess flag is set true if the client comes from an adress 
with full fcp access,
         * otherwise false
         * 
         * @see freenet.pluginmanager.FredPluginFCP#create(java.lang.String, 
freenet.support.SimpleFieldSet, boolean)
         */
-       public FCPMessage create(String name, SimpleFieldSet fs, boolean 
fullaccess) {
-               if(name.equals(PingMessage.name))
-                       return new PingMessage(fs);
-               
-               return null;
+       public void handle(FCPPluginOutputWrapper replysender, SimpleFieldSet 
params, Bucket data, boolean fullacess) {
+               // simple echo
+               replysender.send(params);
        }

 }

Deleted: trunk/plugins/HelloFCP/PingMessage.java
===================================================================
--- trunk/plugins/HelloFCP/PingMessage.java     2007-11-19 21:48:08 UTC (rev 
15858)
+++ trunk/plugins/HelloFCP/PingMessage.java     2007-11-19 21:49:17 UTC (rev 
15859)
@@ -1,35 +0,0 @@
-/**
- * 
- */
-package plugins.HelloFCP;
-
-import freenet.node.Node;
-import freenet.node.fcp.FCPConnectionHandler;
-import freenet.node.fcp.FCPMessage;
-import freenet.node.fcp.MessageInvalidException;
-import freenet.support.SimpleFieldSet;
-
-/**
- * @author saces
- *
- */
-public class PingMessage extends FCPMessage {
-       public static String name = "Ping";
-
-       public PingMessage(SimpleFieldSet fs) {
-               
-       }
-
-       public SimpleFieldSet getFieldSet() {
-               return null;
-       }
-
-       public String getName() {
-               return name;
-       }
-
-       public void run(FCPConnectionHandler handler, Node node) throws 
MessageInvalidException {
-               handler.outputHandler.queue(new PongMessage()); 
-       }
-
-}

Deleted: trunk/plugins/HelloFCP/PongMessage.java
===================================================================
--- trunk/plugins/HelloFCP/PongMessage.java     2007-11-19 21:48:08 UTC (rev 
15858)
+++ trunk/plugins/HelloFCP/PongMessage.java     2007-11-19 21:49:17 UTC (rev 
15859)
@@ -1,35 +0,0 @@
-/**
- * 
- */
-package plugins.HelloFCP;
-
-import freenet.node.Node;
-import freenet.node.fcp.FCPConnectionHandler;
-import freenet.node.fcp.FCPMessage;
-import freenet.node.fcp.MessageInvalidException;
-import freenet.node.fcp.ProtocolErrorMessage;
-import freenet.support.SimpleFieldSet;
-
-/**
- * @author saces
- *
- */
-public class PongMessage extends FCPMessage {
-       public static String name = "Pong";
-
-       public SimpleFieldSet getFieldSet() {
-               SimpleFieldSet sfs = new SimpleFieldSet(true);
-               sfs.putSingle("Hello", "FCP");
-               sfs.putSingle("World", "mine!!");
-               return sfs;
-       }
-
-       public String getName() {
-               return name;
-       }
-
-       public void run(FCPConnectionHandler handler, Node node) throws 
MessageInvalidException {
-               throw new 
MessageInvalidException(ProtocolErrorMessage.INVALID_MESSAGE, name + " goes 
from server to client not the other way around", name, false);
-       }
-
-}


Reply via email to