]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.repo/src/org/eclipse/aether/deployment/DeployRequest.java
Make logging synchronous during native image build
[gpl/argeo-slc.git] / org.argeo.slc.repo / src / org / eclipse / aether / deployment / DeployRequest.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2012 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Sonatype, Inc. - initial API and implementation
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.RequestTrace;
20 import org.eclipse.aether.artifact.Artifact;
21 import org.eclipse.aether.metadata.Metadata;
22 import org.eclipse.aether.repository.RemoteRepository;
23
24 /**
25 * A request to deploy artifacts and their accompanying metadata into the a remote repository.
26 *
27 * @see RepositorySystem#deploy(RepositorySystemSession, DeployRequest)
28 */
29 public final class DeployRequest
30 {
31
32 private Collection<Artifact> artifacts = Collections.emptyList();
33
34 private Collection<Metadata> metadata = Collections.emptyList();
35
36 private RemoteRepository repository;
37
38 private RequestTrace trace;
39
40 /**
41 * Creates an uninitialized request.
42 */
43 public DeployRequest()
44 {
45 }
46
47 /**
48 * Gets the artifact to deploy.
49 *
50 * @return The artifacts to deploy, never {@code null}.
51 */
52 public Collection<Artifact> getArtifacts()
53 {
54 return artifacts;
55 }
56
57 /**
58 * Sets the artifacts to deploy.
59 *
60 * @param artifacts The artifacts to deploy, may be {@code null}.
61 * @return This request for chaining, never {@code null}.
62 */
63 public DeployRequest setArtifacts( Collection<Artifact> artifacts )
64 {
65 if ( artifacts == null )
66 {
67 this.artifacts = Collections.emptyList();
68 }
69 else
70 {
71 this.artifacts = artifacts;
72 }
73 return this;
74 }
75
76 /**
77 * Adds the specified artifacts for deployment.
78 *
79 * @param artifact The artifact to add, may be {@code null}.
80 * @return This request for chaining, never {@code null}.
81 */
82 public DeployRequest addArtifact( Artifact artifact )
83 {
84 if ( artifact != null )
85 {
86 if ( artifacts.isEmpty() )
87 {
88 artifacts = new ArrayList<Artifact>();
89 }
90 artifacts.add( artifact );
91 }
92 return this;
93 }
94
95 /**
96 * Gets the metadata to deploy.
97 *
98 * @return The metadata to deploy, never {@code null}.
99 */
100 public Collection<Metadata> getMetadata()
101 {
102 return metadata;
103 }
104
105 /**
106 * Sets the metadata to deploy.
107 *
108 * @param metadata The metadata to deploy, may be {@code null}.
109 * @return This request for chaining, never {@code null}.
110 */
111 public DeployRequest setMetadata( Collection<Metadata> metadata )
112 {
113 if ( metadata == null )
114 {
115 this.metadata = Collections.emptyList();
116 }
117 else
118 {
119 this.metadata = metadata;
120 }
121 return this;
122 }
123
124 /**
125 * Adds the specified metadata for deployment.
126 *
127 * @param metadata The metadata to add, may be {@code null}.
128 * @return This request for chaining, never {@code null}.
129 */
130 public DeployRequest addMetadata( Metadata metadata )
131 {
132 if ( metadata != null )
133 {
134 if ( this.metadata.isEmpty() )
135 {
136 this.metadata = new ArrayList<Metadata>();
137 }
138 this.metadata.add( metadata );
139 }
140 return this;
141 }
142
143 /**
144 * Gets the repository to deploy to.
145 *
146 * @return The repository to deploy to or {@code null} if not set.
147 */
148 public RemoteRepository getRepository()
149 {
150 return repository;
151 }
152
153 /**
154 * Sets the repository to deploy to.
155 *
156 * @param repository The repository to deploy to, may be {@code null}.
157 * @return This request for chaining, never {@code null}.
158 */
159 public DeployRequest setRepository( RemoteRepository repository )
160 {
161 this.repository = repository;
162 return this;
163 }
164
165 /**
166 * Gets the trace information that describes the higher level request/operation in which this request is issued.
167 *
168 * @return The trace information about the higher level operation or {@code null} if none.
169 */
170 public RequestTrace getTrace()
171 {
172 return trace;
173 }
174
175 /**
176 * Sets the trace information that describes the higher level request/operation in which this request is issued.
177 *
178 * @param trace The trace information about the higher level operation, may be {@code null}.
179 * @return This request for chaining, never {@code null}.
180 */
181 public DeployRequest setTrace( RequestTrace trace )
182 {
183 this.trace = trace;
184 return this;
185 }
186
187 @Override
188 public String toString()
189 {
190 return getArtifacts() + ", " + getMetadata() + " > " + getRepository();
191 }
192
193 }