X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2Fresolution%2FResolutionErrorPolicyRequest.java;fp=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2Fresolution%2FResolutionErrorPolicyRequest.java;h=6d05cf33ebb775f36af342f4a1553454e8a74626;hb=825d60c5348dbe3f5be25b0bccf7bdebfe694219;hp=0000000000000000000000000000000000000000;hpb=5e991fff5cba01858dcc5747a27e637325bc5c8e;p=gpl%2Fargeo-jcr.git diff --git a/org.argeo.slc.repo/src/org/eclipse/aether/resolution/ResolutionErrorPolicyRequest.java b/org.argeo.slc.repo/src/org/eclipse/aether/resolution/ResolutionErrorPolicyRequest.java new file mode 100644 index 0000000..6d05cf3 --- /dev/null +++ b/org.argeo.slc.repo/src/org/eclipse/aether/resolution/ResolutionErrorPolicyRequest.java @@ -0,0 +1,98 @@ +/******************************************************************************* + * Copyright (c) 2012 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.resolution; + +import org.eclipse.aether.repository.RemoteRepository; + +/** + * A query for the resolution error policy for a given artifact/metadata. + * + * @param The type of the affected repository item (artifact or metadata). + * @see ResolutionErrorPolicy + */ +public final class ResolutionErrorPolicyRequest +{ + + private T item; + + private RemoteRepository repository; + + /** + * Creates an uninitialized request. + */ + public ResolutionErrorPolicyRequest() + { + // enables default constructor + } + + /** + * Creates a request for the specified artifact/metadata and remote repository. + * + * @param item The artifact/metadata for which to determine the error policy, may be {@code null}. + * @param repository The repository from which the resolution is attempted, may be {@code null}. + */ + public ResolutionErrorPolicyRequest( T item, RemoteRepository repository ) + { + setItem( item ); + setRepository( repository ); + } + + /** + * Gets the artifact/metadata for which to determine the error policy. + * + * @return The artifact/metadata for which to determine the error policy or {@code null} if not set. + */ + public T getItem() + { + return item; + } + + /** + * Sets the artifact/metadata for which to determine the error policy. + * + * @param item The artifact/metadata for which to determine the error policy, may be {@code null}. + * @return This request for chaining, never {@code null}. + */ + public ResolutionErrorPolicyRequest setItem( T item ) + { + this.item = item; + return this; + } + + /** + * Gets the remote repository from which the resolution of the artifact/metadata is attempted. + * + * @return The involved remote repository or {@code null} if not set. + */ + public RemoteRepository getRepository() + { + return repository; + } + + /** + * Sets the remote repository from which the resolution of the artifact/metadata is attempted. + * + * @param repository The repository from which the resolution is attempted, may be {@code null}. + * @return This request for chaining, never {@code null}. + */ + public ResolutionErrorPolicyRequest setRepository( RemoteRepository repository ) + { + this.repository = repository; + return this; + } + + @Override + public String toString() + { + return getItem() + " < " + getRepository(); + } + +}