KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > event > download > EndArtifactDownloadEvent


1 /*
2  * This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
3  * Copyright Jayasoft 2005 - All rights reserved
4  *
5  * #SNAPSHOT#
6  */

7 package fr.jayasoft.ivy.event.download;
8
9 import java.io.File JavaDoc;
10
11 import fr.jayasoft.ivy.Artifact;
12 import fr.jayasoft.ivy.ArtifactOrigin;
13 import fr.jayasoft.ivy.DependencyResolver;
14 import fr.jayasoft.ivy.Ivy;
15 import fr.jayasoft.ivy.report.ArtifactDownloadReport;
16
17 public class EndArtifactDownloadEvent extends DownloadEvent {
18     public static final String JavaDoc NAME = "post-download-artifact";
19
20     private DependencyResolver _resolver;
21     private ArtifactDownloadReport _report;
22
23     public EndArtifactDownloadEvent(Ivy source, DependencyResolver resolver, Artifact artifact, ArtifactDownloadReport report, File JavaDoc dest) {
24         super(source, NAME, artifact);
25         _resolver = resolver;
26         _report = report;
27         addAttribute("resolver", _resolver.getName());
28         addAttribute("status", _report.getDownloadStatus().toString());
29         addAttribute("size", String.valueOf(_report.getSize()));
30         addAttribute("file", dest.getAbsolutePath());
31         ArtifactOrigin origin = report.getArtifactOrigin();
32         if (origin != null) {
33             addAttribute("origin", _report.getArtifactOrigin().getLocation());
34             addAttribute("local", String.valueOf(_report.getArtifactOrigin().isLocal()));
35         } else {
36             addAttribute("origin", "");
37             addAttribute("local", "");
38         }
39     }
40
41     public ArtifactDownloadReport getReport() {
42         return _report;
43     }
44
45     public DependencyResolver getResolver() {
46         return _resolver;
47     }
48
49 }
50
Popular Tags