01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18: package org.apache.ivy.core.event.retrieve;
19:
20: import org.apache.ivy.core.module.id.ModuleRevisionId;
21: import org.apache.ivy.core.retrieve.RetrieveOptions;
22:
23: public class EndRetrieveEvent extends RetrieveEvent {
24: public static final String NAME = "post-retrieve";
25:
26: private long duration;
27:
28: private int nbCopied;
29:
30: private int nbUpToDate;
31:
32: private long totalCopiedSize;
33:
34: public EndRetrieveEvent(ModuleRevisionId mrid, String[] confs,
35: long elapsedTime, int targetsCopied, int targetsUpToDate,
36: long totalCopiedSize, RetrieveOptions options) {
37: super (NAME, mrid, confs, options);
38:
39: this .duration = elapsedTime;
40: this .nbCopied = targetsCopied;
41: this .nbUpToDate = targetsUpToDate;
42: this .totalCopiedSize = totalCopiedSize;
43: addAttribute("duration", String.valueOf(elapsedTime));
44: addAttribute("size", String.valueOf(totalCopiedSize));
45: addAttribute("nbCopied", String.valueOf(targetsCopied));
46: addAttribute("nbUptodate", String.valueOf(targetsUpToDate));
47: }
48:
49: /**
50: * Duration of the retrieve operation, in ms.
51: *
52: * @return Duration of the retrieve operation, in ms.
53: */
54: public long getDuration() {
55: return duration;
56: }
57:
58: /**
59: * Number of artifacts which were copied (or symlinked) during the retrieve
60: *
61: * @return Number of artifacts which were copied during the retrieve.
62: */
63: public int getNbCopied() {
64: return nbCopied;
65: }
66:
67: /**
68: * Number of artifacts which were not copied since they were already present and up to date.
69: *
70: * @return Number of artifacts which were not copied since they were already present and up to
71: * date.
72: */
73: public int getNbUpToDate() {
74: return nbUpToDate;
75: }
76:
77: /**
78: * Total size of all copied (or symlinked) artifacts, in bytes.
79: * @return Total size of all copied (or symlinked) artifacts, in bytes.
80: */
81: public long getTotalCopiedSize() {
82: return totalCopiedSize;
83: }
84: }
|