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
;
15 import org
.eclipse
.aether
.RepositorySystemSession
;
18 * A result from the local repository about the existence of metadata.
20 * @see LocalRepositoryManager#find(RepositorySystemSession, LocalMetadataRequest)
22 public final class LocalMetadataResult
25 private final LocalMetadataRequest request
;
29 private boolean stale
;
32 * Creates a new result for the specified request.
34 * @param request The local metadata request, must not be {@code null}.
36 public LocalMetadataResult( LocalMetadataRequest request
)
38 if ( request
== null )
40 throw new IllegalArgumentException( "local metadata request has not been specified" );
42 this.request
= request
;
46 * Gets the request corresponding to this result.
48 * @return The corresponding request, never {@code null}.
50 public LocalMetadataRequest
getRequest()
56 * Gets the file to the requested metadata if the metadata is available in the local repository.
58 * @return The file to the requested metadata or {@code null}.
66 * Sets the file to requested metadata.
68 * @param file The metadata file, may be {@code null}.
69 * @return This result for chaining, never {@code null}.
71 public LocalMetadataResult
setFile( File file
)
78 * This value indicates whether the metadata is stale and should be updated.
80 * @return {@code true} if the metadata is stale and should be updated, {@code false} otherwise.
82 public boolean isStale()
88 * Sets whether the metadata is stale.
90 * @param stale {@code true} if the metadata is stale and should be updated, {@code false} otherwise.
91 * @return This result for chaining, never {@code null}.
93 public LocalMetadataResult
setStale( boolean stale
)
100 public String
toString()
102 return request
.toString() + "(" + getFile() + ")";