Revision 2
Updated some classes
FileManager.java | ||
---|---|---|
38 | 38 |
this.chunkMap = chunksInfo; |
39 | 39 |
} |
40 | 40 |
|
41 |
public String getFileID() { |
|
42 |
return fileID; |
|
43 |
} |
|
44 |
|
|
45 |
public int getNumChunks() { |
|
46 |
return numChunks; |
|
47 |
} |
|
48 |
|
|
49 |
public String getPathname() { |
|
50 |
return pathName; |
|
51 |
} |
|
52 |
|
|
53 |
public String getFileName() { |
|
54 |
return fileName; |
|
55 |
} |
|
56 |
|
|
57 |
public int getWantedReplication() { |
|
58 |
return wantedReplication; |
|
59 |
} |
|
60 |
|
|
61 |
public HashMap<String, Chunk> getChunks() { |
|
62 |
return chunkMap; |
|
63 |
} |
|
64 |
|
|
65 | 41 |
synchronized public static FileManager loadDatabase(File file) throws ClassNotFoundException { |
66 | 42 |
FileManager db = null; |
67 | 43 |
|
... | ... | |
125 | 101 |
chunkRepository.remove(fileID); |
126 | 102 |
} |
127 | 103 |
|
128 |
public int getNumChunks(String pathname) { |
|
129 |
return fileRepository.get(pathname).getNumChunks(); |
|
130 |
} |
|
131 |
|
|
132 | 104 |
public Integer getRecognizedReplication(String fileID, int chunkNo) |
133 | 105 |
{ |
134 | 106 |
int ret; |
... | ... | |
141 | 113 |
return ret; |
142 | 114 |
} |
143 | 115 |
|
116 |
// Getters e Setters |
|
117 |
|
|
144 | 118 |
public boolean chunkExists(String fileID) { |
145 | 119 |
return chunkRepository.containsKey(fileID); |
146 | 120 |
} |
147 | 121 |
|
122 |
public ConcurrentMap<String, FileManager> getFileRepository() { |
|
123 |
return fileRepository; |
|
124 |
} |
|
125 |
|
|
126 |
public void setFileRepository(ConcurrentMap<String, FileManager> fileRepository) { |
|
127 |
this.fileRepository = fileRepository; |
|
128 |
} |
|
129 |
|
|
130 |
public ConcurrentMap<String, ConcurrentMap<Integer, Chunk>> getChunkRepository() { |
|
131 |
return chunkRepository; |
|
132 |
} |
|
133 |
|
|
134 |
public void setChunkRepository(ConcurrentMap<String, ConcurrentMap<Integer, Chunk>> chunkRepository) { |
|
135 |
this.chunkRepository = chunkRepository; |
|
136 |
} |
|
137 |
|
|
138 |
public String getPathName() { |
|
139 |
return pathName; |
|
140 |
} |
|
141 |
|
|
142 |
public void setPathName(String pathName) { |
|
143 |
this.pathName = pathName; |
|
144 |
} |
|
145 |
|
|
146 |
public HashMap<String, Chunk> getChunkMap() { |
|
147 |
return chunkMap; |
|
148 |
} |
|
149 |
|
|
150 |
public void setChunkMap(HashMap<String, Chunk> chunkMap) { |
|
151 |
this.chunkMap = chunkMap; |
|
152 |
} |
|
153 |
|
|
154 |
public void setFileID(String fileID) { |
|
155 |
this.fileID = fileID; |
|
156 |
} |
|
157 |
|
|
158 |
public void setFileName(String fileName) { |
|
159 |
this.fileName = fileName; |
|
160 |
} |
|
161 |
|
|
162 |
public void setNumChunks(int numChunks) { |
|
163 |
this.numChunks = numChunks; |
|
164 |
} |
|
165 |
|
|
166 |
public void setWantedReplication(int wantedReplication) { |
|
167 |
this.wantedReplication = wantedReplication; |
|
168 |
} |
|
169 |
|
|
148 | 170 |
public Set<Integer> getFileChunksKey(String fileID) { |
149 | 171 |
return chunkRepository.get(fileID).keySet(); |
150 | 172 |
} |
173 |
|
|
174 |
public String getFileID() { |
|
175 |
return fileID; |
|
176 |
} |
|
151 | 177 |
|
178 |
public int getNumChunks() { |
|
179 |
return numChunks; |
|
180 |
} |
|
181 |
|
|
182 |
public String getPathname() { |
|
183 |
return pathName; |
|
184 |
} |
|
185 |
|
|
186 |
public String getFileName() { |
|
187 |
return fileName; |
|
188 |
} |
|
189 |
|
|
190 |
public int getWantedReplication() { |
|
191 |
return wantedReplication; |
|
192 |
} |
|
193 |
|
|
194 |
public HashMap<String, Chunk> getChunks() { |
|
195 |
return chunkMap; |
|
196 |
} |
|
197 |
|
|
198 |
public int getNumChunks(String pathname) { |
|
199 |
return fileRepository.get(pathname).getNumChunks(); |
|
200 |
} |
|
201 |
|
|
152 | 202 |
} |
Also available in: Unified diff