Author: nextgens
Date: 2007-04-12 15:19:28 +0000 (Thu, 12 Apr 2007)
New Revision: 12610

Removed:
   trunk/freenet/src/freenet/node/fcp/TestDDAReply.java
   trunk/freenet/src/freenet/node/fcp/TestDDARequest.java
   trunk/freenet/src/freenet/node/fcp/TestDDAResponse.java
   trunk/freenet/src/freenet/node/fcp/testDDAComplete.java
Log:
Remove dead code

Deleted: trunk/freenet/src/freenet/node/fcp/TestDDAReply.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestDDAReply.java        2007-04-12 
15:14:41 UTC (rev 12609)
+++ trunk/freenet/src/freenet/node/fcp/TestDDAReply.java        2007-04-12 
15:19:28 UTC (rev 12610)
@@ -1,54 +0,0 @@
-/* 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 freenet.node.fcp;
-
-import freenet.node.Node;
-import freenet.node.fcp.FCPConnectionHandler.DDACheckJob;
-import freenet.support.SimpleFieldSet;
-
-/**
- * client -> node: DDARequest { WantRead=true, WantWrite=true, Dir=/tmp/blah }
- * node -> client: DDAReply { Dir=/tmp/blah, ReadFilename=random1, 
WriteFilename=random2, ContentToWrite=random3 }
- * client -> node: DDAResponse { Dir=/tmp/blah, ReadContent=blah }
- * node -> client: DDAComplete { Dir=/tmp/blah, ReadAllowed=true, 
WriteAllowed=true }
- * 
- * @author Florent Daignière <nextgens at freenetproject.org>
- *
- */
-public class TestDDAReply extends FCPMessage {
-       public static final String NAME = "TestDDAReply";
-       public static final String READ_FILENAME = "ReadFilename";
-       public static final String WRITE_FILENAME = "WriteFilename";
-       public static final String CONTENT_TO_WRITE = "ContentToWrite";
-       
-       final DDACheckJob checkJob;
-       
-       TestDDAReply(DDACheckJob job) {
-               this.checkJob = job;
-       }
-       
-       public SimpleFieldSet getFieldSet() {
-               SimpleFieldSet sfs = new SimpleFieldSet(true);
-               sfs.putSingle(TestDDARequest.DIRECTORY, 
checkJob.directory.toString());
-               
-               if(checkJob.readFilename != null) {
-                       sfs.putSingle(READ_FILENAME, 
checkJob.readFilename.toString());
-               }
-               
-               if(checkJob.writeFilename != null) {
-                       sfs.putSingle(WRITE_FILENAME, 
checkJob.writeFilename.toString());
-                       sfs.putSingle(CONTENT_TO_WRITE, checkJob.writeContent);
-               }
-               
-               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);
-       }
-}

Deleted: trunk/freenet/src/freenet/node/fcp/TestDDARequest.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestDDARequest.java      2007-04-12 
15:14:41 UTC (rev 12609)
+++ trunk/freenet/src/freenet/node/fcp/TestDDARequest.java      2007-04-12 
15:19:28 UTC (rev 12610)
@@ -1,62 +0,0 @@
-/* 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 freenet.node.fcp;
-
-import freenet.node.Node;
-import freenet.node.fcp.FCPConnectionHandler.DDACheckJob;
-import freenet.support.SimpleFieldSet;
-
-/**
- * client -> node: DDARequest { WantRead=true, WantWrite=true, Dir=/tmp/blah }
- * node -> client: DDAReply { Dir=/tmp/blah, ReadFilename=random1, 
WriteFilename=random2, ContentToWrite=random3 }
- * client -> node: DDAResponse { Dir=/tmp/blah, ReadContent=blah }
- * node -> client: DDAComplete { Dir=/tmp/blah, ReadAllowed=true, 
WriteAllowed=true }
- * 
- *  @author Florent Daignière <nextgens at freenetproject.org>
- */
-public class TestDDARequest extends FCPMessage {
-       public static final String NAME = "TestDDARequest";
-       public static final String DIRECTORY = "Directory";
-       public static final String WANT_READ = "WantRead";
-       public static final String WANT_WRITE = "WantWrite";
-       
-       final String identifier;
-       final boolean wantRead, wantWrite;
-       
-       
-       /** 
-        * @throws MessageInvalidException 
-        */
-       public TestDDARequest(SimpleFieldSet fs) throws MessageInvalidException 
{
-               identifier = fs.get(DIRECTORY);
-               if(identifier == null)
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Directory 
given!", null, false);
-               if(identifier.length() == 0)
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "The specified 
Directory can't be empty!", null, false);
-               
-               wantRead = fs.getBoolean(WANT_READ, false);
-               wantWrite = fs.getBoolean(WANT_WRITE, false);
-               if((wantRead == false) && (wantWrite == false))
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.INVALID_MESSAGE, "Both "+ 
WANT_READ + " and " + WANT_WRITE + " are set to false: what's the point of 
sending a message?", identifier, false);
-       }
-
-       public SimpleFieldSet getFieldSet() {
-               return null;
-       }
-
-       public String getName() {
-               return NAME;
-       }
-
-       public void run(FCPConnectionHandler handler, Node node) throws 
MessageInvalidException {
-               DDACheckJob job;
-               try {
-                       job = handler.enqueueDDACheck(identifier, wantRead, 
wantWrite);
-               } catch (IllegalArgumentException e) {
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, e.getMessage(), 
identifier, false);
-               }
-               TestDDAReply reply = new TestDDAReply(job);
-               handler.outputHandler.queue(reply);
-       }
-}

Deleted: trunk/freenet/src/freenet/node/fcp/TestDDAResponse.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestDDAResponse.java     2007-04-12 
15:14:41 UTC (rev 12609)
+++ trunk/freenet/src/freenet/node/fcp/TestDDAResponse.java     2007-04-12 
15:19:28 UTC (rev 12610)
@@ -1,59 +0,0 @@
-/* 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 freenet.node.fcp;
-
-import freenet.node.Node;
-import freenet.node.fcp.FCPConnectionHandler.DDACheckJob;
-import freenet.support.SimpleFieldSet;
-
-/**
- * client -> node: DDARequest { WantRead=true, WantWrite=true, Dir=/tmp/blah }
- * node -> client: DDAReply { Dir=/tmp/blah, ReadFilename=random1, 
WriteFilename=random2, ContentToWrite=random3 }
- * client -> node: DDAResponse { Dir=/tmp/blah, ReadContent=blah }
- * node -> client: DDAComplete { Dir=/tmp/blah, ReadAllowed=true, 
WriteAllowed=true }
- * 
- * @author Florent Daignière <nextgens at freenetproject.org>
- *
- */
-public class TestDDAResponse extends FCPMessage {
-       public static final String NAME = "TestDDAResponse";
-       public static final String READ_CONTENT = "ReadContent";
-       
-       final String identifier;
-       final String readContent;
-       
-       public TestDDAResponse(SimpleFieldSet sfs) throws 
MessageInvalidException {
-               identifier = sfs.get(TestDDARequest.DIRECTORY);
-               if(identifier == null)
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Directory 
given!", null, false);
-               if(identifier.length() == 0)
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "The specified 
Directory can't be empty!", null, false);
-               
-               readContent = sfs.get(READ_CONTENT);
-       }
-
-       public SimpleFieldSet getFieldSet() {
-               return null;
-       }
-
-       public String getName() {
-               return NAME;
-       }
-
-       public void run(FCPConnectionHandler handler, Node node) throws 
MessageInvalidException {
-               DDACheckJob job;
-               try {
-                        job = handler.popDDACheck(identifier);
-               } catch (IllegalArgumentException e) {
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, e.getMessage(), 
identifier, false);
-               }
-               if(job == null)
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.INVALID_MESSAGE, "The node doesn't 
know that testDDA identifier! double check it! (" + identifier + ").", 
identifier, false);
-               else if((job.readFilename != null) && (readContent == null))
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "You need to send " 
+ READ_CONTENT + " back to the node if you specify " + TestDDARequest.WANT_READ 
+ " in " + TestDDARequest.NAME + '.', identifier, false);
-               
-               testDDAComplete reply = new testDDAComplete(handler, job, 
readContent);
-               handler.outputHandler.queue(reply);
-       }
-}

Deleted: trunk/freenet/src/freenet/node/fcp/testDDAComplete.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/testDDAComplete.java     2007-04-12 
15:14:41 UTC (rev 12609)
+++ trunk/freenet/src/freenet/node/fcp/testDDAComplete.java     2007-04-12 
15:19:28 UTC (rev 12610)
@@ -1,88 +0,0 @@
-/* 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 freenet.node.fcp;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import freenet.node.Node;
-import freenet.node.fcp.FCPConnectionHandler.DDACheckJob;
-import freenet.support.Logger;
-import freenet.support.SimpleFieldSet;
-
-/**
- * client -> node: DDARequest { WantRead=true, WantWrite=true, Dir=/tmp/blah }
- * node -> client: DDAReply { Dir=/tmp/blah, ReadFilename=random1, 
WriteFilename=random2, ContentToWrite=random3 }
- * client -> node: DDAResponse { Dir=/tmp/blah, ReadContent=blah }
- * node -> client: DDAComplete { Dir=/tmp/blah, ReadAllowed=true, 
WriteAllowed=true }
- * 
- * @author Florent Daignière <nextgens at freenetproject.org>
- *
- */
-public class testDDAComplete extends FCPMessage {
-       public static String NAME = "TestDDAComplete";
-       public static String READ_ALLOWED = "ReadAllowed";
-       public static String WRITE_ALLOWED = "WriteAllowed";
-
-       final DDACheckJob checkJob;
-       final String readContentFromClient;
-       private final FCPConnectionHandler handler;
-       
-       public testDDAComplete(FCPConnectionHandler handler, DDACheckJob job, 
String readContent) {
-               this.checkJob = job;
-               this.readContentFromClient = readContent;
-               this.handler = handler;
-       }
-
-       public SimpleFieldSet getFieldSet() {
-               SimpleFieldSet sfs = new SimpleFieldSet(true);
-               
-               sfs.putSingle(TestDDARequest.DIRECTORY, 
checkJob.directory.toString());
-               
-               boolean isReadAllowed = false; 
-               boolean isWriteAllowed = false;
-               
-               if(checkJob.readFilename != null) {
-                       isReadAllowed = (readContentFromClient != null) &&  
(checkJob.readContent.equals(readContentFromClient));
-                       // cleanup in any case : we created it!... let's hope 
the client will do the same on its side.
-                       checkJob.readFilename.delete();
-                       sfs.putSingle(READ_ALLOWED, 
String.valueOf(isReadAllowed));
-               }
-               
-               if(checkJob.writeFilename != null) {
-                       File maybeWrittenFile = checkJob.writeFilename;
-                       if (maybeWrittenFile.exists() && 
maybeWrittenFile.isFile() && maybeWrittenFile.canRead()) {
-                               try {
-                                       FileReader fr = new 
FileReader(maybeWrittenFile);
-                                       StringBuffer sb = new StringBuffer();
-                                       
-                                       int current = fr.read();                
                        
-                                       while(current != -1) {
-                                               sb.append((char)current);
-                                               current = fr.read();
-                                       }
-                                       
-                                       fr.close();
-                                       isWriteAllowed = 
checkJob.writeContent.equals(sb.toString().trim());
-                               } catch (IOException e) {
-                                       Logger.error(this, "Caught an IOE 
trying to read the file (" + maybeWrittenFile + ")! " + e.getMessage());
-                               }
-                       }
-                       sfs.putSingle(WRITE_ALLOWED, 
String.valueOf(isWriteAllowed));
-               }
-               
-               handler.registerTestDDAResult(checkJob.directory.toString(), 
isReadAllowed, isWriteAllowed);
-               
-               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