e95aac55d1168741c40015db3c3d860d39905d7c
[splitter-ng] / Splitter-ng-filesplitter / src / Filesplitter.java
1 import java.io.IOException;
2 import java.nio.file.DirectoryStream;
3 import java.nio.file.Files;
4 import java.nio.file.Path;
5 import java.nio.file.Paths;
6 import java.util.Collection;
7 import java.util.HashMap;
8 import java.util.LinkedList;
9 import java.util.List;
10 import java.util.Map;
11 import java.util.Map.Entry;
12 import java.util.Scanner;
13 import java.util.TreeMap;
14
15 import splitterng.CodingTask;
16 import splitterng.DecodingTask;
17 import splitterng.EncodingTask;
18 import splitterng.Splitter;
19 import splitterng.SplitterCallback;
20 import splitterng.plugin.CodecDescription;
21 import splitterng.plugin.PluginDescription;
22
23 public class Filesplitter implements SplitterCallback {
24
25         private Collection<Splitter> splitters = new LinkedList<Splitter>();
26         private List<CodingTask> finished_encoding_task = new LinkedList<CodingTask>();
27         private List<CodingTask> finished_decoding_task = new LinkedList<CodingTask>();
28         private List<CodingTask> running_tasks = new LinkedList<CodingTask>();
29
30         // in der Map werden die Metadaten-vorlage für jeden Codec gespeichert
31         private Map<Splitter, Map<String, Object>> splitter_metadata_map = new HashMap<Splitter, Map<String, Object>>();
32
33         public static void main(String[] args) throws InterruptedException {
34                 Filesplitter filesplitter = new Filesplitter();
35                 filesplitter.run();
36
37                 // Thread.sleep(50000);
38                 // System.exit(0);
39         }
40
41         public void run() {
42
43                 System.out.println("Splitter Plugins");
44                 // Optional: Anfrage, welche Plugins geladen sind
45                 for (PluginDescription p : Splitter.getPluginDescriptions()) {
46                         System.out.println("---------------------------------------------\n" + p.getPluginID() + "\t"
47                                         + p.getPluginName());
48                         // Optional: Aus jeder Plugindescription die Verfügbaren Codecs
49                         // auslesen
50                         for (CodecDescription c : p.getCodecDescriptions()) {
51                                 System.out.println("\t|---------------------------------------------\n\t|" + c.getCodecID() + "\t"
52                                                 + c.getCodecDescriptionText());
53                                 Map<String, Integer[]> codecParameterMinMax = c
54                                                 .getCodecParameterMinMax();
55                                 for (Entry<String, Integer[]> e : codecParameterMinMax
56                                                 .entrySet()) {
57                                         System.out.println("\t|\t" + e.getKey() + "\tmin:"
58                                                         + e.getValue()[0] + "  max:" + e.getValue()[1] + " default: " + c.getCodecParameterDefaults().get(e.getKey()));
59                                 }
60                                 // Wenn hier eine Konfiguration für eine plugin-codec
61                                 // Kombination vorhanden ist, wird der Splitter initialisiert.
62                                 Map<String, Integer> codecParameter;
63                                 Splitter splitter;
64                                 switch (p.getPluginID() + "/" + c.getCodecID()) {
65 ///-----------------------------------------------------------------------------------------------
66 ///-----------------------------------------------------------------------------------------------
67 ///-----------------------------------------------------------------------------------------------
68 ///-----------------------------------------------------------------------------------------------
69                                 case "jerasure/JerasureCauchyGood":
70                                         // Codecparameter Bauen
71                                         codecParameter = new TreeMap<String, Integer>();
72                                         codecParameter.put("k", 2);
73                                         codecParameter.put("m", 2);
74                                         //codecParameter.put("w", 8);
75                                         //codecParameter.put("packetsize", 8);
76                                         System.out.println("\t\tinitialisiere mit" + " k="
77                                                         + codecParameter.get("k") + " m="
78                                                         + codecParameter.get("m") + " w="
79                                                         + codecParameter.get("w") + " packetsize="
80                                                         + codecParameter.get("packetsize"));
81                                         // Splitter mit Plugin-ID CodecID und codecparametern
82                                         // initialisieren
83                                         Splitter splitterjerasure = new Splitter(p.getPluginID(), c.getCodecID(),
84                                                         codecParameter);
85                                         splitters.add(splitterjerasure);
86                                         
87                                         // Metadaten bauen vorlage
88                                         Map<String, Object> metadatajerasure = new TreeMap<String, Object>();
89                                         metadatajerasure.put("fragmentsize", (int) 64);
90                                         // Beleiebige weitere Metadaten
91                                         
92                                         splitter_metadata_map.put(splitterjerasure, metadatajerasure);
93                                         break;
94 ///-----------------------------------------------------------------------------------------------
95                                 case "jerasure/JerasureReedSolomon":
96                                         // Codecparameter Bauen
97                                         Map<String, Integer> codecParameter1 = new TreeMap<String, Integer>();
98                                         codecParameter1.put("k", 3);
99                                         codecParameter1.put("m", 3);
100                                         //codecParameter1.put("w", 16);
101                                         //codecParameter1.put("packetsize", 64);
102                                         System.out.println("\t\tinitialisiere mit" + " k="
103                                                         + codecParameter1.get("k") + " m="
104                                                         + codecParameter1.get("m") + " w="
105                                                         + codecParameter1.get("w") + " packetsize="
106                                                         + codecParameter1.get("packetsize"));
107                                         // Splitter mit Plugin-ID CodecID und codecparametern
108                                         // initialisieren
109                                         Splitter splitterjerasure1 = new Splitter(p.getPluginID(), c.getCodecID(),
110                                                         codecParameter1);
111                                         splitters.add(splitterjerasure1);
112                                         
113                                         // Metadaten bauen vorlage
114                                         Map<String, Object> metadatajerasure1 = new TreeMap<String, Object>();
115                                         metadatajerasure1.put("fragmentsize", (int) 40960);
116                                         // Beleiebige weitere Metadaten
117                                         
118                                         splitter_metadata_map.put(splitterjerasure1, metadatajerasure1);
119                                         break;
120 ///-----------------------------------------------------------------------------------------------
121                                 case "jerasure/JerasureLiber8tion":
122                                         // Codecparameter Bauen
123                                         Map<String, Integer> codecParameter2 = new TreeMap<String, Integer>();
124                                         codecParameter2.put("k", 3);
125                                         codecParameter2.put("m", 2);
126                                         codecParameter2.put("packetsize", 64);
127                                         System.out.println("\t\tinitialisiere mit"
128                                                         + " k=" + codecParameter2.get("k") 
129                                                         + " m=" + codecParameter2.get("m")
130                                                         + " packetsize=" + codecParameter2.get("packetsize"));
131                                         // Splitter mit Plugin-ID CodecID und codecparametern
132                                         // initialisieren
133                                         Splitter splitterjerasure2 = new Splitter(p.getPluginID(), c.getCodecID(),
134                                                         codecParameter2);
135                                         splitters.add(splitterjerasure2);
136                                         
137                                         // Metadaten bauen vorlage
138                                         Map<String, Object> metadatajerasure2 = new TreeMap<String, Object>();
139                                         metadatajerasure2.put("fragmentsize", (int) 40960);
140                                         // Beleiebige weitere Metadaten
141                                         
142                                         splitter_metadata_map.put(splitterjerasure2, metadatajerasure2);
143                                         break;
144 ///-----------------------------------------------------------------------------------------------
145                                 case "Raid1Plugin/raid1codec":
146                                         // Codecparameter Bauen
147                                         Map<String, Integer> codecParameternoop = new TreeMap<String, Integer>();
148                                         codecParameternoop.put("k", 1);
149                                         codecParameternoop.put("m", 1);
150                                         System.out.println("\t\tinitialisiere mit"
151                                                         + " k=" + codecParameternoop.get("k")
152                                                         + " m=" + codecParameternoop.get("m")
153                                                         );
154                                         // Splitter mit Plugin-ID CodecID und codecparametern
155                                         // initialisieren
156                                         Splitter splitterraid1 = new Splitter(p.getPluginID(), c.getCodecID(),
157                                                         codecParameternoop);
158                                         splitters.add(splitterraid1);
159                                         
160                                         // Metadaten bauen vorlage
161                                         Map<String, Object> metadataraid1 = new TreeMap<String, Object>();
162                                         metadataraid1.put("fragmentsize", (int) 40960);
163                                         // Beleiebige weitere Metadaten
164                                         
165                                         splitter_metadata_map.put(splitterraid1, metadataraid1);
166                                         
167                                         break;
168 ///-----------------------------------------------------------------------------------------------
169                                 case "jsharing/shamir":
170                                         // Codecparameter Bauen
171                                         Map<String, Integer> codecParameterjsharing = new TreeMap<String, Integer>();
172                                         codecParameterjsharing.put("k", 2);
173                                         codecParameterjsharing.put("m", 1);
174                                         System.out.println("\t\tinitialisiere mit k="
175                                                         + codecParameterjsharing.get("k") + " m="
176                                                         + codecParameterjsharing.get("m"));
177
178                                         Splitter splittershamir= new Splitter(p.getPluginID(), c.getCodecID(),
179                                                         codecParameterjsharing);
180                                         splitters.add(splittershamir);
181                                         
182                                         // Metadaten bauen vorlage
183                                         Map<String, Object> metadatashamir = new TreeMap<String, Object>();
184                                         metadatashamir.put("fragmentsize", (int)8);
185                                         // Beleiebige weitere Metadaten
186                                         
187                                         splitter_metadata_map.put(splittershamir, metadatashamir);
188                                         
189                                         break;
190 ///-----------------------------------------------------------------------------------------------
191                                 case "jerasure-java/JerasureJavaCRS":
192                                         // Codecparameter Bauen
193                                         Map<String, Integer> codecParameter11 = new TreeMap<String, Integer>();
194                                         codecParameter11.put("k", 2);
195                                         codecParameter11.put("m", 2);
196                                         //codecParameter11.put("w", 8);
197                                         //codecParameter11.put("packetsize", 8);
198                                         System.out.println("\t\tinitialisiere mit"
199                                                         + " k=" + codecParameter11.get("k")
200                                                         + " m=" + codecParameter11.get("m") 
201                                                         + " w=" + codecParameter11.get("w")
202                                                         + " packetsize=" + codecParameter11.get("packetsize")
203                                                         );
204                                         // Splitter mit Plugin-ID CodecID und codecparametern
205                                         // initialisieren
206                                         Splitter splitterjerasure11 = new Splitter(p.getPluginID(), c.getCodecID(),
207                                                         codecParameter11);
208                                         splitters.add(splitterjerasure11);
209                                         
210                                         // Metadaten bauen vorlage
211                                         Map<String, Object> metadatajerasure11 = new TreeMap<String, Object>();
212                                         metadatajerasure11.put("fragmentsize", (int) 64);
213                                         // Beleiebige weitere Metadaten
214                                         
215                                         splitter_metadata_map.put(splitterjerasure11, metadatajerasure11);
216                                         break;
217 ///-----------------------------------------------------------------------------------------------
218                                         
219                                 case "JigDFS/crs":
220                                         // Codecparameter Bauen
221                                         Map<String, Integer> codecParameter111 = new TreeMap<String, Integer>();
222                                         codecParameter111.put("k", 2);
223                                         codecParameter111.put("m", 1);
224                                         //codecParameter111.put("chunksize", 16);
225                                         System.out.println("\t\tinitialisiere mit" + " k="
226                                                         + codecParameter111.get("k") + " m="
227                                                         + codecParameter111.get("m")
228                                                         + " chunksize=" + codecParameter111.get("chunksize")
229                                                         );
230                                         // Splitter mit Plugin-ID CodecID und codecparametern
231                                         // initialisieren
232                                         Splitter splitterjerasure111 = new Splitter(p.getPluginID(), c.getCodecID(),
233                                                         codecParameter111);
234                                         splitters.add(splitterjerasure111);
235                                         
236                                         // Metadaten bauen vorlage
237                                         Map<String, Object> metadatajerasure111 = new TreeMap<String, Object>();
238                                         metadatajerasure111.put("fragmentsize", (int) 64);
239                                         metadatajerasure111.put("digest", "SHA-256");
240                                         //metadatajerasure111.put("digest", "MD5");
241                                         // Beleiebige weitere Metadaten
242                                         splitter_metadata_map.put(splitterjerasure111, metadatajerasure111);
243                                         break;
244 ///-----------------------------------------------------------------------------------------------
245                                         
246                                 case "bitsplitter/bitsplitter":
247                                         // Codecparameter Bauen
248                                         Map<String, Integer> codecParameter1111 = new TreeMap<String, Integer>();
249                                         codecParameter1111.put("k", 4);
250                                         codecParameter1111.put("m", 0);
251                                         System.out.println("\t\tinitialisiere mit" + " k="
252                                                         + codecParameter1111.get("k") + " m="
253                                                         + codecParameter1111.get("m"));
254                                         // Splitter mit Plugin-ID CodecID und codecparametern
255                                         // initialisieren
256                                         Splitter splitter1111 = new Splitter(p.getPluginID(), c.getCodecID(),
257                                                         codecParameter1111);
258                                         splitters.add(splitter1111);
259                                         
260                                         // Metadaten bauen vorlage
261                                         Map<String, Object> metadata1111 = new TreeMap<String, Object>();
262                                         metadata1111.put("fragmentsize", (int) 409600);
263                                         metadata1111.put("digest", "SHA-1");
264                                         // Beleiebige weitere Metadaten
265                                         
266                                         splitter_metadata_map.put(splitter1111, metadata1111);
267                                         break;
268 ///-----------------------------------------------------------------------------------------------
269 ///-----------------------------------------------------------------------------------------------
270 ///-----------------------------------------------------------------------------------------------
271 ///-----------------------------------------------------------------------------------------------
272 ///-----------------------------------------------------------------------------------------------
273                                 default:
274                                         try {
275                                                 splitter = new Splitter(p.getPluginID(), c.getCodecID(),4,1);
276                                                 System.out.println("\t\tDefault Splitter created for: "
277                                                                 + p.getPluginID() + "/" + c.getCodecID());                                              
278                                         } catch (Exception e) {
279                                                 System.out.println("\t\tNO Splitter created for: "
280                                                                 + p.getPluginID() + "/" + c.getCodecID() + "\n" + e.getMessage());      
281                                         }
282
283                                         break;
284                                 }
285                         }
286                 }
287
288                 System.out.println("\nListe der Dateien");
289                 Path srcDir = Paths.get("srcDir");
290                 List<Path> srcFileList = getFileList(srcDir);
291                 for (Path entry : srcFileList) {
292                         System.out.println("- " + entry.toString());
293                 }
294
295                 // restoreDir anlegen bzw aufräumen
296                 Path splitDir = Paths.get("splitDir");
297                 checkDirectory(splitDir);
298                 for (Path entry : getFileList(splitDir)) {
299                         try {
300                                 Files.delete(entry);
301                         } catch (IOException e) {
302                                 // TODO Auto-generated catch block
303                                 e.printStackTrace();
304                         }
305                 }
306
307                 // restoreDir anlegen bzw aufräumen
308                 Path restoreDir = Paths.get("restoreDir");
309                 checkDirectory(restoreDir);
310                 for (Path entry : getFileList(restoreDir)) {
311                         try {
312                                 Files.delete(entry);
313                         } catch (IOException e) {
314                                 e.printStackTrace();
315                         }
316                 }
317                 // Jede Datei ...
318                 for (Path srcfile : srcFileList) {
319                         // ... mit jedem initialisierten Splitter bearbeiten
320                         for (Splitter splitter : splitters) {
321                                 System.out.println("Encoding: "
322                                                 + srcfile
323                                                 + "  with "
324                                                 + splitter.getCurrentPlugin().getPluginDescription()
325                                                                 .getPluginID() + "/"
326                                                 + splitter.getCurrentCodecDescription().getCodecID());
327                                 try {
328
329                                         Map<String, Object> metadata = new TreeMap<String, Object>();
330                                         
331                                         for (Entry<String, Object> e: splitter_metadata_map.get(splitter).entrySet()){
332                                                 metadata.put(e.getKey(), e.getValue());
333                                         }
334                                         
335                                         metadata.put("time_encoding_submitted",
336                                                         System.currentTimeMillis());
337                         
338
339                                         // Hier wird codiert. Der Encodingtask
340                                         EncodingTask task = new EncodingTask(srcfile, Paths
341                                                         .get("splitDir"), this, metadata);
342                                         splitter.encode(task);
343                                         running_tasks.add(task);
344                                 } catch (InterruptedException | IOException e) {
345                                         e.printStackTrace();
346                                 }
347
348                         }
349
350                 }
351
352                 System.out.println("-----");
353                 System.out.println("Alle Aufträge an die Splitter übermittelt");
354
355                 printUsage();
356
357                 
358                 // dateien zusammenbauen
359                 @SuppressWarnings("resource")
360                 Scanner in = new Scanner(System.in);
361                 while (true) {
362                         System.out.print(">>>");
363                         if (!in.hasNext()) System.exit(0);
364                         switch (in.next()) {
365                         case "EOF":
366                         case "q":
367                         case "quit":
368                         case "exit":
369                                         System.exit(0);
370                         case "h":
371                         case "help":
372                                 printUsage();
373                                 break;
374                         case "ls":
375                                 switch (in.next()){
376                                 case "enc":
377                                         for (CodingTask t : finished_encoding_task) {
378                                                 System.out.println(""
379                                                                 + finished_encoding_task.lastIndexOf(t) + "\t"
380                                                                 + t.getFilePath().getFileName());
381                                         }
382                                         break;
383                                 case "dec":
384                                         for (CodingTask t : finished_decoding_task) {
385                                                 System.out.println(""
386                                                                 + finished_decoding_task.lastIndexOf(t) + "\t"
387                                                                 + t.getFilePath().getFileName());
388                                         }
389                                         break;
390                                         
391                                 case "frag":
392                                         try {
393                                                 for (Entry<Integer, Path> e : finished_encoding_task
394                                                                 .get(Integer.parseInt(in.next()))
395                                                                 .getFragmentPaths().entrySet()) {
396                                                         System.out.format("\t %-5s %s %s\n", e.getKey(), e
397                                                                         .getValue().toString(), (Files.exists(e
398                                                                         .getValue()) ? "OK" : "Fehlt"));
399                                                         // System.out.println(++"\t"+e.getValue().toString());
400                                                 }
401                                         } catch (Exception e) {
402                                                 System.out.println("Index nicht gefunden");
403                                         }
404                                         break;
405                                         
406                                 case "src":
407                                         System.out.println("noch nicht implementiert");
408                                         break;
409                                         
410                                         
411                                 case "splitter":
412                                         System.out.println("noch nicht implementiert");
413                                         break;
414                                 
415                                 }
416                                 break;
417
418                         case "meta":
419                                 switch(in.next()){
420                                 case "enc":
421                                         try {
422                                                 for (Entry<String, Object> e : finished_encoding_task
423                                                                 .get(Integer.parseInt(in.next())).getMetadata()
424                                                                 .entrySet()) {
425                                                         System.out.format("\t %-25s %-25s %s\n", e.getKey(), e
426                                                                         .getValue().toString(), e.getValue().getClass()
427                                                                         .toString());
428                                                         // System.out.println(++"\t"+e.getValue().toString());
429                                                 }
430                                         } catch (Exception e) {
431                                                 System.out.println("Index nicht gefunden");
432                                         }
433                                         break;
434                                 
435                                 case "dec":
436                                         try {
437                                                 for (Entry<String, Object> e : finished_decoding_task
438                                                                 .get(Integer.parseInt(in.next())).getMetadata()
439                                                                 .entrySet()) {
440                                                         System.out.format("\t %-25s %s\n", e.getKey(), e
441                                                                         .getValue().toString());
442                                                         // System.out.println(++"\t"+e.getValue().toString());
443                                                 }
444                                         } catch (Exception e) {
445                                                 System.out.println("Index nicht gefunden");
446                                         }
447                                         break;
448                                 }
449                                 break;
450
451                         case "rm":
452                                 try {
453                                         int tasknr = Integer.parseInt(in.next());
454                                         int fragmentnr = Integer.parseInt(in.next());
455                                         Map<Integer, Path> fragmentPaths = finished_encoding_task
456                                                         .get(tasknr).getFragmentPaths();
457                                         Path path = fragmentPaths.get(fragmentnr);
458                                         try {
459                                                 Files.delete(path);
460                                         } catch (Exception e) {
461                                                 System.out.println("Konnte fragment nicht löschen "
462                                                                 + e.getMessage());
463
464                                         }
465
466                                 } catch (Exception e) {
467                                         System.out.println("Index nicht gefunden");
468                                 }
469                                 break;
470
471                         case "dec":
472                                 try {
473                                         int tasknr = Integer.parseInt(in.next());
474                                         CodingTask enctask = (CodingTask) finished_encoding_task
475                                                         .get(tasknr);
476                                         Path restorefile = restoreDir.resolve(""
477                                                         + System.currentTimeMillis()
478                                                         + enctask.getFilePath().getFileName());
479
480                                         Map<Integer, Path> fragmentPaths = enctask
481                                                         .getFragmentPaths();
482                                         for (int i = 0; i < fragmentPaths.size(); i++) {
483                                                 Path path = fragmentPaths.get(i);
484                                                 if (path == null || !Files.exists(path)) {
485                                                         fragmentPaths.put(i, null);
486                                                 }
487
488                                         }
489                                         DecodingTask dectask = new DecodingTask(fragmentPaths,
490                                                         restorefile, this, enctask.getMetadataAsDeepCopy());
491                                         for (Splitter spl : splitters) {
492                                                 if (spl.getCurrentPlugin().getPluginDescription()
493                                                                 .getPluginID() == (String) enctask
494                                                                 .getMetadata("pluginid")
495                                                                 && spl.getCurrentCodecDescription()
496                                                                                 .getCodecID() == (String) enctask
497                                                                                 .getMetadata("codecid")) {
498                                                         System.out.println("Auftrag angenommen..."
499                                                                         + restorefile);
500                                                         spl.decode(dectask);
501                                                         running_tasks.add(dectask);
502                                                 }
503                                         }
504
505                                 } catch (Exception e) {
506                                         e.printStackTrace();
507                                         System.out.println("Index nicht gefunden");
508                                 }
509                                 break;
510                         case "enc":
511                                 System.out.println("noch nicht implementiert");
512                                 break;
513                                 
514                         
515                         default:
516                                 printUsage();
517                         }
518
519                 }
520
521         }
522
523         private static List<Path> getFileList(Path path) {
524                 List<Path> files = new LinkedList<Path>();
525                 checkDirectory(path);
526                 try (DirectoryStream<Path> stream = Files.newDirectoryStream(path,
527                                 new DirectoryStream.Filter<Path>() {
528                                         @Override
529                                         public boolean accept(Path entry) throws IOException {
530                                                 return !Files.isDirectory(entry);
531                                         }
532                                 });) {
533                         for (Path entry : stream) {
534                                 files.add(entry);
535                         }
536                 } catch (IOException e) {
537                         e.printStackTrace();
538                 }
539                 return files;
540         }
541
542         private static void checkDirectory(Path path) {
543                 if (!Files.exists(path)) {
544                         try {
545                                 Files.createDirectory(path);
546                         } catch (IOException e) {
547                                 System.err.println("Verzeichnis kann nicht erstellt werden: "
548                                                 + path.toUri());
549                                 e.printStackTrace();
550                         }
551                 }
552         }
553
554         // private static void initSplitter(Splitter splitter) {
555         //
556         // System.out.println("Liste der Codecs:");
557         // Collection<String> codecids = splitter.getCodecIDs();
558         // Iterator<String> it = codecids.iterator();
559         // while (it.hasNext()){
560         // System.out.println("- " + it.next().toString());
561         // }
562         // if (codecids.contains("jerasureparity")){
563         // SplitterConfiguration config = new SplitterConfiguration();
564         // config.setCodecID("jerasureparity");
565         // splitter.setSplitterConfiguration(config);
566         // }
567         // System.out.println();
568         // }
569
570         @Override
571         public void codingFailed(CodingTask task, String reason) {
572                 synchronized (task) { // damit die Ausgabe nicht verwürfelt wird
573                         running_tasks.remove(task);
574                         System.err.println("Coding Failed: "
575                                         + task.getFilePath().toString() + "  Reason:" + reason);
576                 }
577
578         }
579
580         @Override
581         public synchronized void codingSuccessfull(CodingTask task) {
582                 synchronized (task) { // damit die Ausgabe nicht verwürfelt wird
583                         long duration = 0;
584                         running_tasks.remove(task);
585                         if (task instanceof EncodingTask) {
586                                 finished_encoding_task.add(task);
587                                 duration = (long) task.getMetadata("time_encode_end")
588                                                 - (long) task.getMetadata("time_encode_start");
589                         } else if (task instanceof DecodingTask) {
590                                 finished_decoding_task.add(task);
591                                 duration = (long) task.getMetadata("time_decode_end")
592                                                 - (long) task.getMetadata("time_decode_start");
593                         }
594
595                         System.err.println("CodingTask "
596                                         + finished_encoding_task.indexOf(task)
597                                         + " OK: " + task.getFilePath().toString()
598                                         + "  Codec: " + task.getMetadata("pluginid") + "/"
599                                         + task.getMetadata("codecid") + "  T(ms):" + duration);
600                 }
601         }
602
603         public void printUsage() {
604                 System.out.println("Bedienung:"
605                                 //+ "\nls splitter\tlistet alle initialisierten Splitter auf"
606                                 //+ "\nls src\t\tlistet alle Dateien in scrDir auf"
607                                 + "\nls enc\t\tlistet alle fertig encodierten Tasks auf"
608                                 + "\nls dec\t\tlistet alle fertig decodierten Tasks auf"
609                                 + "\nls frag <nr>\tlistet die Fragmentdateien zu Encoding-Task <nr> auf"
610                                 + "\nrm <nr> <frac_nr>\tlöscht aus Encoding-Task <nr> die Fragmentdatei <frac_nr>"
611                                 + "\ndec <nr>\twiederherstellen der Originaldatei aus Encoding-Task <nr> in das Verzeichnis restoreDir"
612                                 //+ "\nenc <scr_nr> <splitter_nr>\tencodieren von Datei <scr_nr> mit Splitter <split-ter_nr>"
613                                 + "\nmeta enc <nr>\tgibt metadaten zu encodingtask <nr> aus"
614                                 + "\nmeta dec <nr>\tgibt metadaten zu decodingtask <nr> aus"
615                                 + "\nq, quit oder exit\tbeenden das Programm"
616                                 //+" \nh oder help\tzeigt die Hilfe an"
617                                 + "");
618         }
619
620 }