]>
git.argeo.org Git - gpl/argeo-slc.git/blob - cms/org.argeo.slc.repo/src/org/eclipse/aether/installation/InstallRequest.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
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.aether
.installation
;
13 import java
.util
.ArrayList
;
14 import java
.util
.Collection
;
15 import java
.util
.Collections
;
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
;
24 * A request to install artifacts and their accompanying metadata into the local repository.
26 * @see RepositorySystem#install(RepositorySystemSession, InstallRequest)
28 public final class InstallRequest
31 private Collection
<Artifact
> artifacts
= Collections
.emptyList();
33 private Collection
<Metadata
> metadata
= Collections
.emptyList();
35 private RequestTrace trace
;
38 * Creates an uninitialized request.
40 public InstallRequest()
45 * Gets the artifact to install.
47 * @return The artifacts to install, never {@code null}.
49 public Collection
<Artifact
> getArtifacts()
55 * Sets the artifacts to install.
57 * @param artifacts The artifacts to install, may be {@code null}.
58 * @return This request for chaining, never {@code null}.
60 public InstallRequest
setArtifacts( Collection
<Artifact
> artifacts
)
62 if ( artifacts
== null )
64 this.artifacts
= Collections
.emptyList();
68 this.artifacts
= artifacts
;
74 * Adds the specified artifacts for installation.
76 * @param artifact The artifact to add, may be {@code null}.
77 * @return This request for chaining, never {@code null}.
79 public InstallRequest
addArtifact( Artifact artifact
)
81 if ( artifact
!= null )
83 if ( artifacts
.isEmpty() )
85 artifacts
= new ArrayList
<Artifact
>();
87 artifacts
.add( artifact
);
93 * Gets the metadata to install.
95 * @return The metadata to install, never {@code null}.
97 public Collection
<Metadata
> getMetadata()
103 * Sets the metadata to install.
105 * @param metadata The metadata to install.
106 * @return This request for chaining, never {@code null}.
108 public InstallRequest
setMetadata( Collection
<Metadata
> metadata
)
110 if ( metadata
== null )
112 this.metadata
= Collections
.emptyList();
116 this.metadata
= metadata
;
122 * Adds the specified metadata for installation.
124 * @param metadata The metadata to add, may be {@code null}.
125 * @return This request for chaining, never {@code null}.
127 public InstallRequest
addMetadata( Metadata metadata
)
129 if ( metadata
!= null )
131 if ( this.metadata
.isEmpty() )
133 this.metadata
= new ArrayList
<Metadata
>();
135 this.metadata
.add( metadata
);
141 * Gets the trace information that describes the higher level request/operation in which this request is issued.
143 * @return The trace information about the higher level operation or {@code null} if none.
145 public RequestTrace
getTrace()
151 * Sets the trace information that describes the higher level request/operation in which this request is issued.
153 * @param trace The trace information about the higher level operation, may be {@code null}.
154 * @return This request for chaining, never {@code null}.
156 public InstallRequest
setTrace( RequestTrace trace
)
163 public String
toString()
165 return getArtifacts() + ", " + getMetadata();