X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2Fresolution%2FArtifactDescriptorPolicyRequest.java;fp=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2Fresolution%2FArtifactDescriptorPolicyRequest.java;h=2edf0c5383c2bd77a6cc1109f7e298d49fe586bc;hb=825d60c5348dbe3f5be25b0bccf7bdebfe694219;hp=0000000000000000000000000000000000000000;hpb=5e991fff5cba01858dcc5747a27e637325bc5c8e;p=gpl%2Fargeo-jcr.git diff --git a/org.argeo.slc.repo/src/org/eclipse/aether/resolution/ArtifactDescriptorPolicyRequest.java b/org.argeo.slc.repo/src/org/eclipse/aether/resolution/ArtifactDescriptorPolicyRequest.java new file mode 100644 index 0000000..2edf0c5 --- /dev/null +++ b/org.argeo.slc.repo/src/org/eclipse/aether/resolution/ArtifactDescriptorPolicyRequest.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * 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.artifact.Artifact; + +/** + * A query for the error policy for a given artifact's descriptor. + * + * @see ArtifactDescriptorPolicy + */ +public final class ArtifactDescriptorPolicyRequest +{ + + private Artifact artifact; + + private String context = ""; + + /** + * Creates an uninitialized request. + */ + public ArtifactDescriptorPolicyRequest() + { + // enables default constructor + } + + /** + * Creates a request for the specified artifact. + * + * @param artifact The artifact for whose descriptor to determine the error policy, may be {@code null}. + * @param context The context in which this request is made, may be {@code null}. + */ + public ArtifactDescriptorPolicyRequest( Artifact artifact, String context ) + { + setArtifact( artifact ); + setRequestContext( context ); + } + + /** + * Gets the artifact for whose descriptor to determine the error policy. + * + * @return The artifact for whose descriptor to determine the error policy or {@code null} if not set. + */ + public Artifact getArtifact() + { + return artifact; + } + + /** + * Sets the artifact for whose descriptor to determine the error policy. + * + * @param artifact The artifact for whose descriptor to determine the error policy, may be {@code null}. + * @return This request for chaining, never {@code null}. + */ + public ArtifactDescriptorPolicyRequest setArtifact( Artifact artifact ) + { + this.artifact = artifact; + return this; + } + + /** + * Gets the context in which this request is made. + * + * @return The context, never {@code null}. + */ + public String getRequestContext() + { + return context; + } + + /** + * Sets the context in which this request is made. + * + * @param context The context, may be {@code null}. + * @return This request for chaining, never {@code null}. + */ + public ArtifactDescriptorPolicyRequest setRequestContext( String context ) + { + this.context = ( context != null ) ? context : ""; + return this; + } + + @Override + public String toString() + { + return String.valueOf( getArtifact() ); + } + +}