Updated the operations to use the KademliaNode interface rather than the JKademliaNode class

This commit is contained in:
Joshua Kissoon 2014-06-02 14:31:15 +05:30
parent a1faffb4d9
commit e8105a9e33
6 changed files with 18 additions and 17 deletions

View File

@ -1,9 +1,9 @@
package kademlia.operation;
import java.io.IOException;
import kademlia.JKademliaNode;
import kademlia.KadConfiguration;
import kademlia.KadServer;
import kademlia.KademliaNode;
import kademlia.node.KademliaId;
/**
@ -17,10 +17,10 @@ public class BucketRefreshOperation implements Operation
{
private final KadServer server;
private final JKademliaNode localNode;
private final KademliaNode localNode;
private final KadConfiguration config;
public BucketRefreshOperation(KadServer server, JKademliaNode localNode, KadConfiguration config)
public BucketRefreshOperation(KadServer server, KademliaNode localNode, KadConfiguration config)
{
this.server = server;
this.localNode = localNode;

View File

@ -10,6 +10,7 @@ import java.io.IOException;
import kademlia.JKademliaNode;
import kademlia.KadConfiguration;
import kademlia.KadServer;
import kademlia.KademliaNode;
import kademlia.exceptions.RoutingException;
import kademlia.message.AcknowledgeMessage;
import kademlia.message.ConnectMessage;
@ -22,7 +23,7 @@ public class ConnectOperation implements Operation, Receiver
public static final int MAX_CONNECT_ATTEMPTS = 5; // Try 5 times to connect to a node
private final KadServer server;
private final JKademliaNode localNode;
private final KademliaNode localNode;
private final Node bootstrapNode;
private final KadConfiguration config;
@ -35,7 +36,7 @@ public class ConnectOperation implements Operation, Receiver
* @param bootstrap Node to use to bootstrap the local node onto the network
* @param config
*/
public ConnectOperation(KadServer server, JKademliaNode local, Node bootstrap, KadConfiguration config)
public ConnectOperation(KadServer server, KademliaNode local, Node bootstrap, KadConfiguration config)
{
this.server = server;
this.localNode = local;

View File

@ -2,9 +2,9 @@ package kademlia.operation;
import java.io.IOException;
import java.util.List;
import kademlia.JKademliaNode;
import kademlia.KadConfiguration;
import kademlia.KadServer;
import kademlia.KademliaNode;
import kademlia.dht.KademliaDHT;
import kademlia.dht.StorageEntryMetadata;
import kademlia.exceptions.ContentNotFoundException;
@ -22,11 +22,11 @@ public class ContentRefreshOperation implements Operation
{
private final KadServer server;
private final JKademliaNode localNode;
private final KademliaNode localNode;
private final KademliaDHT dht;
private final KadConfiguration config;
public ContentRefreshOperation(KadServer server, JKademliaNode localNode, KademliaDHT dht, KadConfiguration config)
public ContentRefreshOperation(KadServer server, KademliaNode localNode, KademliaDHT dht, KadConfiguration config)
{
this.server = server;
this.localNode = localNode;

View File

@ -1,9 +1,9 @@
package kademlia.operation;
import java.io.IOException;
import kademlia.JKademliaNode;
import kademlia.KadConfiguration;
import kademlia.KadServer;
import kademlia.KademliaNode;
import kademlia.dht.KademliaDHT;
/**
@ -16,11 +16,11 @@ public class KadRefreshOperation implements Operation
{
private final KadServer server;
private final JKademliaNode localNode;
private final KademliaNode localNode;
private final KademliaDHT dht;
private final KadConfiguration config;
public KadRefreshOperation(KadServer server, JKademliaNode localNode, KademliaDHT dht, KadConfiguration config)
public KadRefreshOperation(KadServer server, KademliaNode localNode, KademliaDHT dht, KadConfiguration config)
{
this.server = server;
this.localNode = localNode;

View File

@ -8,9 +8,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import kademlia.JKademliaNode;
import kademlia.KadConfiguration;
import kademlia.KadServer;
import kademlia.KademliaNode;
import kademlia.exceptions.RoutingException;
import kademlia.message.Message;
import kademlia.message.NodeLookupMessage;
@ -37,7 +37,7 @@ public class NodeLookupOperation implements Operation, Receiver
private static final String FAILED = "Failed";
private final KadServer server;
private final JKademliaNode localNode;
private final KademliaNode localNode;
private final KadConfiguration config;
private final Message lookupMessage; // Message sent to each peer
@ -60,7 +60,7 @@ public class NodeLookupOperation implements Operation, Receiver
* @param lookupId The ID for which to find nodes close to
* @param config
*/
public NodeLookupOperation(KadServer server, JKademliaNode localNode, KademliaId lookupId, KadConfiguration config)
public NodeLookupOperation(KadServer server, KademliaNode localNode, KademliaId lookupId, KadConfiguration config)
{
this.server = server;
this.localNode = localNode;

View File

@ -2,9 +2,9 @@ package kademlia.operation;
import java.io.IOException;
import java.util.List;
import kademlia.JKademliaNode;
import kademlia.KadConfiguration;
import kademlia.KadServer;
import kademlia.KademliaNode;
import kademlia.dht.KademliaDHT;
import kademlia.dht.KademliaStorageEntry;
import kademlia.message.Message;
@ -21,7 +21,7 @@ public class StoreOperation implements Operation
{
private final KadServer server;
private final JKademliaNode localNode;
private final KademliaNode localNode;
private final KademliaStorageEntry storageEntry;
private final KademliaDHT localDht;
private final KadConfiguration config;
@ -33,7 +33,7 @@ public class StoreOperation implements Operation
* @param localDht The local DHT
* @param config
*/
public StoreOperation(KadServer server, JKademliaNode localNode, KademliaStorageEntry storageEntry, KademliaDHT localDht, KadConfiguration config)
public StoreOperation(KadServer server, KademliaNode localNode, KademliaStorageEntry storageEntry, KademliaDHT localDht, KadConfiguration config)
{
this.server = server;
this.localNode = localNode;