X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2Frepository%2FLocalMetadataRequest.java;fp=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2Frepository%2FLocalMetadataRequest.java;h=0ee4dc5e7ba50b2be7072643ef01ffa7e5b66e9c;hb=825d60c5348dbe3f5be25b0bccf7bdebfe694219;hp=0000000000000000000000000000000000000000;hpb=5e991fff5cba01858dcc5747a27e637325bc5c8e;p=gpl%2Fargeo-jcr.git diff --git a/org.argeo.slc.repo/src/org/eclipse/aether/repository/LocalMetadataRequest.java b/org.argeo.slc.repo/src/org/eclipse/aether/repository/LocalMetadataRequest.java new file mode 100644 index 0000000..0ee4dc5 --- /dev/null +++ b/org.argeo.slc.repo/src/org/eclipse/aether/repository/LocalMetadataRequest.java @@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.repository; + +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.metadata.Metadata; + +/** + * A query to the local repository for the existence of metadata. + * + * @see LocalRepositoryManager#find(RepositorySystemSession, LocalMetadataRequest) + */ +public final class LocalMetadataRequest +{ + + private Metadata metadata; + + private String context = ""; + + private RemoteRepository repository = null; + + /** + * Creates an uninitialized query. + */ + public LocalMetadataRequest() + { + // enables default constructor + } + + /** + * Creates a query with the specified properties. + * + * @param metadata The metadata to query for, may be {@code null}. + * @param repository The source remote repository for the metadata, may be {@code null} for local metadata. + * @param context The resolution context for the metadata, may be {@code null}. + */ + public LocalMetadataRequest( Metadata metadata, RemoteRepository repository, String context ) + { + setMetadata( metadata ); + setRepository( repository ); + setContext( context ); + } + + /** + * Gets the metadata to query for. + * + * @return The metadata or {@code null} if not set. + */ + public Metadata getMetadata() + { + return metadata; + } + + /** + * Sets the metadata to query for. + * + * @param metadata The metadata, may be {@code null}. + * @return This query for chaining, never {@code null}. + */ + public LocalMetadataRequest setMetadata( Metadata metadata ) + { + this.metadata = metadata; + return this; + } + + /** + * Gets the resolution context. + * + * @return The resolution context, never {@code null}. + */ + public String getContext() + { + return context; + } + + /** + * Sets the resolution context. + * + * @param context The resolution context, may be {@code null}. + * @return This query for chaining, never {@code null}. + */ + public LocalMetadataRequest setContext( String context ) + { + this.context = ( context != null ) ? context : ""; + return this; + } + + /** + * Gets the remote repository to use as source of the metadata. + * + * @return The remote repositories, may be {@code null} for local metadata. + */ + public RemoteRepository getRepository() + { + return repository; + } + + /** + * Sets the remote repository to use as sources of the metadata. + * + * @param repository The remote repository, may be {@code null}. + * @return This query for chaining, may be {@code null} for local metadata. + */ + public LocalMetadataRequest setRepository( RemoteRepository repository ) + { + this.repository = repository; + return this; + } + + @Override + public String toString() + { + return getMetadata() + " @ " + getRepository(); + } + +}