-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPeerFolderHandler.java
58 lines (47 loc) · 1.66 KB
/
PeerFolderHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.io.File;
public class PeerFolderHandler implements SimpleMessageHandler, Runnable{
MuxDemuxSimple myMuxDemux;
private String senderID;
public PeerFolderHandler(String senderID){
this.senderID=senderID;
}
public void run() {
// //Create a folder for this peer if not exists
// File senderFolder = new File(Test.ROOTFOLDERERPATH + senderID);
// if(!senderFolder.exists()) {
// senderFolder.mkdir();
// }
//
// // ADD TO DOWNLOADQUEUE
// if(Test.DEBUG)
// System.out.println("PeerFolderHandler : "+myMuxDemux.getOthersDatabases().get(senderID));
// for (String fileName : myMuxDemux.getOthersDatabases().get(senderID).stringQueue) {
//
// File file = new File(Test.ROOTFOLDERERPATH + senderID + "/" + fileName);
// if(!file.exists()) {
// DownloadObject dO = new DownloadObject(senderID,fileName);
// myMuxDemux.downloadQueue.add(dO);
// if(Test.DEBUG)
// System.out.println("LISTRECEIVER : added DownloadObject "+dO+" to downloadQueue");
//
// }
//
// }
//
// //REMOVE ALL REMOVED FILES
// File[] listOfFiles = senderFolder.listFiles();
//
// for (File file: listOfFiles) {
// if(myMuxDemux.getOthersDatabases().get(senderID).stringQueue.contains(file.getName()))
// file.delete();
// }
}
@Override
public void handleMessage(String m) {
// TODO Auto-generated method stub
}
@Override
public void setMuxDemux(MuxDemuxSimple muxDemuxSimple) {
this.myMuxDemux = muxDemuxSimple;
}
}