Author: nextgens
Date: 2007-04-12 18:07:52 +0000 (Thu, 12 Apr 2007)
New Revision: 12614
Removed:
trunk/freenet/src/freenet/node/fcp/TestFileAccessQueryMessage.java
trunk/freenet/src/freenet/node/fcp/TestFileAccessReplyMessage.java
Modified:
trunk/freenet/src/freenet/node/fcp/FCPMessage.java
Log:
Get rid of TestFileAccess messages ... toad isn't convinced :|
Modified: trunk/freenet/src/freenet/node/fcp/FCPMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPMessage.java 2007-04-12 18:07:18 UTC
(rev 12613)
+++ trunk/freenet/src/freenet/node/fcp/FCPMessage.java 2007-04-12 18:07:52 UTC
(rev 12614)
@@ -81,8 +81,6 @@
return new TestDDARequestMessage(fs);
if(name.equals(TestDDAResponseMessage.name))
return new TestDDAResponseMessage(fs);
- if(name.equals(TestFileAccessQueryMessage.name))
- return new TestFileAccessQueryMessage(fs);
if(name.equals(WatchGlobal.name))
return new WatchGlobal(fs);
if(name.equals("Void"))
Deleted: trunk/freenet/src/freenet/node/fcp/TestFileAccessQueryMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestFileAccessQueryMessage.java
2007-04-12 18:07:18 UTC (rev 12613)
+++ trunk/freenet/src/freenet/node/fcp/TestFileAccessQueryMessage.java
2007-04-12 18:07:52 UTC (rev 12614)
@@ -1,47 +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 freenet.node.Node;
-import freenet.support.SimpleFieldSet;
-
-/**
- * Tell the client what access the node has to a specific file
- *
- * @author Florent Daignière <nextgens at freenetproject.org>
- *
- */
-public class TestFileAccessQueryMessage extends FCPMessage {
- public static final String name = "TestFileAccessQuery";
- public static final String FILENAME = "Filename";
-
- private final String filename;
-
- public TestFileAccessQueryMessage(SimpleFieldSet sfs) throws
MessageInvalidException {
- filename = sfs.get(FILENAME);
- if(filename == null)
- throw new
MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Directory
given!", null, false);
- if(filename.length() < 1)
- throw new
MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "The specified " +
FILENAME + " can't be empty!", null, false);
- }
-
- public SimpleFieldSet getFieldSet() {
- return null;
- }
-
- public String getName() {
- return name;
- }
-
- public void run(FCPConnectionHandler handler, Node node) throws
MessageInvalidException {
- File file = new File(filename);
- if(!file.exists())
- throw new
MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "The node isn't
aware that \"" + filename + "\" exists!", filename, false);
- TestFileAccessReplyMessage reply = new
TestFileAccessReplyMessage(handler, file);
- handler.outputHandler.queue(reply);
- }
-
-}
Deleted: trunk/freenet/src/freenet/node/fcp/TestFileAccessReplyMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestFileAccessReplyMessage.java
2007-04-12 18:07:18 UTC (rev 12613)
+++ trunk/freenet/src/freenet/node/fcp/TestFileAccessReplyMessage.java
2007-04-12 18:07:52 UTC (rev 12614)
@@ -1,53 +0,0 @@
-package freenet.node.fcp;
-
-import java.io.File;
-
-import freenet.node.Node;
-import freenet.support.SimpleFieldSet;
-import freenet.support.io.FileUtil;
-
-/**
- * Tell the client what access the node has to a specific file
- *
- * @author Florent Daignière <nextgens at freenetproject.org>
- * @see TestFileAccessQueryMessage
- *
- * Shall we provide a salted hash of the content ?
- * It's probably not necessary as a client can generate a random filename...
- */
-public class TestFileAccessReplyMessage extends FCPMessage {
- public static final String name = "TestFileAccessReply";
- public static final String CAN_READ = "CanRead";
- public static final String CAN_WRITE = "CanWrite";
- public static final String IS_DDA_READ_ALLOWED = "IsDDAReadAllowed";
- public static final String IS_DDA_WRITE_ALLOWED = "IsDDAWriteAllowed";
-
- private final File file;
- private final FCPConnectionHandler handler;
-
- public TestFileAccessReplyMessage(FCPConnectionHandler handler, File
filename) {
- this.file = FileUtil.getCanonicalFile(filename);
- this.handler = handler;
- }
-
- public SimpleFieldSet getFieldSet() {
- SimpleFieldSet sfs = new SimpleFieldSet(true);
-
- sfs.putSingle(TestFileAccessQueryMessage.FILENAME,
file.toString());
- sfs.putSingle(CAN_READ, String.valueOf(file.canRead()));
- sfs.putSingle(CAN_WRITE, String.valueOf(file.canWrite()));
- sfs.putSingle(IS_DDA_READ_ALLOWED,
String.valueOf(handler.allowDDAFrom(file, false)));
- sfs.putSingle(IS_DDA_WRITE_ALLOWED,
String.valueOf(handler.allowDDAFrom(file, true)));
-
- 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);
- }
-
-}