package transfer.download;
import java.io.IOException;
import transfer.download.logic.DownloadAttempter;
import common.connection.AbstractCommunicationSet;
import common.connection.AbstractConnection;
import common.connection.AbstractConnector;
import connection.peer.AbstractConnectorToPeer;
import connection.peer.GenericPeerConnection;
import connection.peer.secure.ClientSideSecurableConnection;
import connection.peer.secure.ConnectionSecurerInterface;
public class FileDownloadConnector extends AbstractConnectorToPeer implements
ConnectionSecurerInterface
{
private FileDownload download;
private DownloadAttempter attempter;
public FileDownloadConnector(FileDownload download, DownloadAttempter attempter)
{
this.download = download;
this.attempter = attempter;
}
protected AbstractConnection createConnectionObject() throws IOException
{
return new ClientSideSecurableConnection(this);
}
public AbstractConnector getConnector()
{
return this;
}
public GenericPeerConnection createConnection(AbstractCommunicationSet source)
throws IOException
{
FileDownloadConnection connection = new FileDownloadConnection(source, download,
attempter);
return connection;
}
public void notifyFailedNegotiation()
{
attempter.notifyFailure();
}
}