From: David ‘Bombe’ Roden Date: Thu, 10 Apr 2008 08:23:54 +0000 (+0000) Subject: add TestDDAComplete message X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=966d4ac902c693077f10ef4b1b7bc562559ca49e;p=jSite2.git add TestDDAComplete message git-svn-id: http://trooper/svn/projects/jSite/trunk@686 c3eda9e8-030b-0410-8277-bc7414b0a119 --- diff --git a/src/net/pterodactylus/util/fcp/FcpAdapter.java b/src/net/pterodactylus/util/fcp/FcpAdapter.java index 62adc9e..cdfbe03 100644 --- a/src/net/pterodactylus/util/fcp/FcpAdapter.java +++ b/src/net/pterodactylus/util/fcp/FcpAdapter.java @@ -96,6 +96,14 @@ public class FcpAdapter implements FcpListener { } /** + * @see net.pterodactylus.util.fcp.FcpListener#receivedTestDDAComplete(net.pterodactylus.util.fcp.FcpConnection, + * net.pterodactylus.util.fcp.TestDDAComplete) + */ + public void receivedTestDDAComplete(FcpConnection fcpConnection, TestDDAComplete testDDAComplete) { + /* empty. */ + } + + /** * @see net.pterodactylus.util.fcp.FcpListener#receivedMessage(net.pterodactylus.util.fcp.FcpConnection, * net.pterodactylus.util.fcp.FcpMessage) */ diff --git a/src/net/pterodactylus/util/fcp/FcpConnection.java b/src/net/pterodactylus/util/fcp/FcpConnection.java index 6cd71b4..07a0916 100644 --- a/src/net/pterodactylus/util/fcp/FcpConnection.java +++ b/src/net/pterodactylus/util/fcp/FcpConnection.java @@ -271,6 +271,18 @@ public class FcpConnection { } /** + * Notifies all listeners that a “TestDDAComplete” message was received. + * + * @param testDDAComplete + * The “TestDDAComplete” message + */ + private void fireReceivedTestDDAComplete(TestDDAComplete testDDAComplete) { + for (FcpListener fcpListener: fcpListeners) { + fcpListener.receivedTestDDAComplete(this, testDDAComplete); + } + } + + /** * Notifies all registered listeners that a message has been received. * * @see FcpListener#receivedMessage(FcpConnection, FcpMessage) @@ -360,6 +372,8 @@ public class FcpConnection { fireReceivedNodeData(new NodeData(fcpMessage)); } else if ("TestDDAReply".equals(messageName)) { fireReceivedTestDDAReply(new TestDDAReply(fcpMessage)); + } else if ("TestDDAComplete".equals(messageName)) { + fireReceivedTestDDAComplete(new TestDDAComplete(fcpMessage)); } else if ("NodeHello".equals(messageName)) { fireReceivedNodeHello(new NodeHello(fcpMessage)); } else if ("CloseConnectionDuplicateClientName".equals(messageName)) { diff --git a/src/net/pterodactylus/util/fcp/FcpListener.java b/src/net/pterodactylus/util/fcp/FcpListener.java index f34cd0d..50156ab 100644 --- a/src/net/pterodactylus/util/fcp/FcpListener.java +++ b/src/net/pterodactylus/util/fcp/FcpListener.java @@ -131,6 +131,16 @@ public interface FcpListener extends EventListener { public void receivedTestDDAReply(FcpConnection fcpConnection, TestDDAReply testDDAReply); /** + * Notifies a listener that a “TestDDAComplete” was received. + * + * @param fcpConnection + * The connection that received the message + * @param testDDAComplete + * The “TestDDAComplete” message + */ + public void receivedTestDDAComplete(FcpConnection fcpConnection, TestDDAComplete testDDAComplete); + + /** * Notifies a listener that a message has been received. This method is only * called if {@link FcpConnection#handleMessage(FcpMessage)} does not * recognize the message. Should that ever happen, please file a bug report! diff --git a/src/net/pterodactylus/util/fcp/TestDDAComplete.java b/src/net/pterodactylus/util/fcp/TestDDAComplete.java new file mode 100644 index 0000000..f43b18d --- /dev/null +++ b/src/net/pterodactylus/util/fcp/TestDDAComplete.java @@ -0,0 +1,54 @@ +/** + * © 2008 INA Service GmbH + */ +package net.pterodactylus.util.fcp; + +/** + * The “TestDDAComplete” message signals that the node has finished checking + * your read and write access to a certain directory. + * + * @author David Roden + * @version $Id$ + */ +public class TestDDAComplete extends BaseMessage { + + /** + * Creates a new “TestDDAComplete” message that wraps the received message. + * + * @param receivedMessage + * The received message + */ + public TestDDAComplete(FcpMessage receivedMessage) { + super(receivedMessage); + } + + /** + * Returns the directory the authorization is given for. + * + * @return The directory that was tested for read and/or write access + */ + public String getDirectory() { + return getField("Directory"); + } + + /** + * Returns whether read access to the directory is allowed. + * + * @return true if the client is allowed to read from that + * directory, false otherwise + */ + public boolean isReadDirectoryAllowed() { + return Boolean.valueOf(getField("ReadDirectoryAllowed")); + } + + /** + * Returns whether write access to the directory is allowed. + * + * @return true if the client is allowed to write into that + * directory, false otherwise + */ + public boolean isWriteDirectoryAllowed() { + return Boolean.valueOf(getField("WriteDirectoryAllowed")); + } + +}