1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.aether.deployment;
12
13 import java.util.ArrayList;
14 import java.util.Collection;
15 import java.util.Collections;
16
17 import org.eclipse.aether.RepositorySystem;
18 import org.eclipse.aether.RepositorySystemSession;
19 import org.eclipse.aether.artifact.Artifact;
20 import org.eclipse.aether.metadata.Metadata;
21
22
23
24
25
26
27 public final class DeployResult
28 {
29
30 private final DeployRequest request;
31
32 private Collection<Artifact> artifacts;
33
34 private Collection<Metadata> metadata;
35
36
37
38
39
40
41 public DeployResult( DeployRequest request )
42 {
43 if ( request == null )
44 {
45 throw new IllegalArgumentException( "deploy request has not been specified" );
46 }
47 this.request = request;
48 artifacts = Collections.emptyList();
49 metadata = Collections.emptyList();
50 }
51
52
53
54
55
56
57 public DeployRequest getRequest()
58 {
59 return request;
60 }
61
62
63
64
65
66
67 public Collection<Artifact> getArtifacts()
68 {
69 return artifacts;
70 }
71
72
73
74
75
76
77
78 public DeployResult setArtifacts( Collection<Artifact> artifacts )
79 {
80 if ( artifacts == null )
81 {
82 this.artifacts = Collections.emptyList();
83 }
84 else
85 {
86 this.artifacts = artifacts;
87 }
88 return this;
89 }
90
91
92
93
94
95
96
97 public DeployResult addArtifact( Artifact artifact )
98 {
99 if ( artifact != null )
100 {
101 if ( artifacts.isEmpty() )
102 {
103 artifacts = new ArrayList<Artifact>();
104 }
105 artifacts.add( artifact );
106 }
107 return this;
108 }
109
110
111
112
113
114
115
116 public Collection<Metadata> getMetadata()
117 {
118 return metadata;
119 }
120
121
122
123
124
125
126
127 public DeployResult setMetadata( Collection<Metadata> metadata )
128 {
129 if ( metadata == null )
130 {
131 this.metadata = Collections.emptyList();
132 }
133 else
134 {
135 this.metadata = metadata;
136 }
137 return this;
138 }
139
140
141
142
143
144
145
146 public DeployResult addMetadata( Metadata metadata )
147 {
148 if ( metadata != null )
149 {
150 if ( this.metadata.isEmpty() )
151 {
152 this.metadata = new ArrayList<Metadata>();
153 }
154 this.metadata.add( metadata );
155 }
156 return this;
157 }
158
159 @Override
160 public String toString()
161 {
162 return getArtifacts() + ", " + getMetadata();
163 }
164
165 }