package com.ardverk.dht.io;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.ardverk.concurrent.AsyncFuture;

import com.ardverk.dht.KUID;
import com.ardverk.dht.entity.NodeEntity;
import com.ardverk.dht.entity.StoreEntity;
import com.ardverk.dht.message.RequestMessage;
import com.ardverk.dht.message.ResponseMessage;
import com.ardverk.dht.message.StoreResponse;

public class StoreResponseHandler extends ResponseHandler<StoreEntity> {

    private final NodeEntity entity;
    
    private final KUID key;
    
    private final byte[] value;
    
    private final List<StoreResponse> responses 
        = new ArrayList<StoreResponse>();
    
    public StoreResponseHandler(
            MessageDispatcher messageDispatcher, 
            NodeEntity entity, KUID key, byte[] value) {
        super(messageDispatcher);
        
        if (entity == null) {
            throw new NullPointerException("entity");
        }
        
        if (key == null) {
            throw new NullPointerException("key");
        }
        
        if (value == null) {
            throw new NullPointerException("value");
        }
        
        this.entity = entity;
        this.key = key;
        this.value = value;
    }

    @Override
    protected void go(AsyncFuture<StoreEntity> future) throws Exception {
        
    }

    @Override
    protected void processResponse(RequestMessage request, 
            ResponseMessage response, long time, TimeUnit unit) throws IOException {
        
        StoreResponse message = (StoreResponse)response;
    }

    @Override
    protected void processTimeout(RequestMessage request, 
            long time, TimeUnit unit) throws IOException {
        setException(new TimeoutIoException(request, time, unit));
    }
}

@@ -514,16 +514,117 @@
 ity%3E %7B%0A%0A
+    private static final NodeEntity QUERY %0A        = new NodeEntity(0L, TimeUnit.MILLISECONDS);%0A    %0A
     priv
@@ -819,24 +819,195 @@
 se%3E();%0A    %0A
+    public StoreResponseHandler(MessageDispatcher messageDispatcher, %0A            KUID key, byte%5B%5D value) %7B%0A        this(messageDispatcher, QUERY, key, value);%0A    %7D%0A    %0A
     public S
@@ -1647,32 +1647,185 @@
 ows Exception %7B%0A
+        if (entity == QUERY) %7B%0A            %0A        %7D else %7B%0A            store(entity);%0A        %7D%0A    %7D%0A    %0A    private void store(NodeEntity entity) %7B%0A
         %0A    %7D%0A%0A

Fix for compile error