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 org
.eclipse
.aether
.RepositorySystemSession
;
14 import org
.eclipse
.aether
.metadata
.Metadata
;
17 * A query to the local repository for the existence of metadata.
19 * @see LocalRepositoryManager#find(RepositorySystemSession, LocalMetadataRequest)
21 public final class LocalMetadataRequest
24 private Metadata metadata
;
26 private String context
= "";
28 private RemoteRepository repository
= null;
31 * Creates an uninitialized query.
33 public LocalMetadataRequest()
35 // enables default constructor
39 * Creates a query with the specified properties.
41 * @param metadata The metadata to query for, may be {@code null}.
42 * @param repository The source remote repository for the metadata, may be {@code null} for local metadata.
43 * @param context The resolution context for the metadata, may be {@code null}.
45 public LocalMetadataRequest( Metadata metadata
, RemoteRepository repository
, String context
)
47 setMetadata( metadata
);
48 setRepository( repository
);
49 setContext( context
);
53 * Gets the metadata to query for.
55 * @return The metadata or {@code null} if not set.
57 public Metadata
getMetadata()
63 * Sets the metadata to query for.
65 * @param metadata The metadata, may be {@code null}.
66 * @return This query for chaining, never {@code null}.
68 public LocalMetadataRequest
setMetadata( Metadata metadata
)
70 this.metadata
= metadata
;
75 * Gets the resolution context.
77 * @return The resolution context, never {@code null}.
79 public String
getContext()
85 * Sets the resolution context.
87 * @param context The resolution context, may be {@code null}.
88 * @return This query for chaining, never {@code null}.
90 public LocalMetadataRequest
setContext( String context
)
92 this.context
= ( context
!= null ) ? context
: "";
97 * Gets the remote repository to use as source of the metadata.
99 * @return The remote repositories, may be {@code null} for local metadata.
101 public RemoteRepository
getRepository()
107 * Sets the remote repository to use as sources of the metadata.
109 * @param repository The remote repository, may be {@code null}.
110 * @return This query for chaining, may be {@code null} for local metadata.
112 public LocalMetadataRequest
setRepository( RemoteRepository repository
)
114 this.repository
= repository
;
119 public String
toString()
121 return getMetadata() + " @ " + getRepository();