]>
git.argeo.org Git - gpl/argeo-jcr.git/blob - org.argeo.slc.repo/src/org/eclipse/aether/repository/LocalArtifactRequest.java
3cc67f858ff2e5df3d35838d0d851b300cb2f155
1 /*******************************************************************************
2 * Copyright (c) 2010, 2011 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
.repository
;
13 import java
.util
.Collections
;
14 import java
.util
.List
;
16 import org
.eclipse
.aether
.RepositorySystemSession
;
17 import org
.eclipse
.aether
.artifact
.Artifact
;
20 * A query to the local repository for the existence of an artifact.
22 * @see LocalRepositoryManager#find(RepositorySystemSession, LocalArtifactRequest)
24 public final class LocalArtifactRequest
27 private Artifact artifact
;
29 private String context
= "";
31 private List
<RemoteRepository
> repositories
= Collections
.emptyList();
34 * Creates an uninitialized query.
36 public LocalArtifactRequest()
38 // enables default constructor
42 * Creates a query with the specified properties.
44 * @param artifact The artifact to query for, may be {@code null}.
45 * @param repositories The remote repositories that should be considered as potential sources for the artifact, may
46 * be {@code null} or empty to only consider locally installed artifacts.
47 * @param context The resolution context for the artifact, may be {@code null}.
49 public LocalArtifactRequest( Artifact artifact
, List
<RemoteRepository
> repositories
, String context
)
51 setArtifact( artifact
);
52 setRepositories( repositories
);
53 setContext( context
);
57 * Gets the artifact to query for.
59 * @return The artifact or {@code null} if not set.
61 public Artifact
getArtifact()
67 * Sets the artifact to query for.
69 * @param artifact The artifact, may be {@code null}.
70 * @return This query for chaining, never {@code null}.
72 public LocalArtifactRequest
setArtifact( Artifact artifact
)
74 this.artifact
= artifact
;
79 * Gets the resolution context.
81 * @return The resolution context, never {@code null}.
83 public String
getContext()
89 * Sets the resolution context.
91 * @param context The resolution context, may be {@code null}.
92 * @return This query for chaining, never {@code null}.
94 public LocalArtifactRequest
setContext( String context
)
96 this.context
= ( context
!= null ) ? context
: "";
101 * Gets the remote repositories to consider as sources of the artifact.
103 * @return The remote repositories, never {@code null}.
105 public List
<RemoteRepository
> getRepositories()
111 * Sets the remote repositories to consider as sources of the artifact.
113 * @param repositories The remote repositories, may be {@code null} or empty to only consider locally installed
115 * @return This query for chaining, never {@code null}.
117 public LocalArtifactRequest
setRepositories( List
<RemoteRepository
> repositories
)
119 if ( repositories
!= null )
121 this.repositories
= repositories
;
125 this.repositories
= Collections
.emptyList();
131 public String
toString()
133 return getArtifact() + " @ " + getRepositories();