Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 99BB8200B77 for ; Sat, 3 Sep 2016 22:23:36 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 97925160ABB; Sat, 3 Sep 2016 20:23:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1D21B160AD4 for ; Sat, 3 Sep 2016 22:23:33 +0200 (CEST) Received: (qmail 57168 invoked by uid 500); 3 Sep 2016 20:23:28 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 53105 invoked by uid 99); 3 Sep 2016 20:23:25 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Sep 2016 20:23:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6FE3CE058E; Sat, 3 Sep 2016 20:23:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hboutemy@apache.org To: commits@maven.apache.org Date: Sat, 03 Sep 2016 20:24:07 -0000 Message-Id: <9ef49692e7604099a5bc074c77684968@git.apache.org> In-Reply-To: <2cd999b3830b4d988db740ac64710a62@git.apache.org> References: <2cd999b3830b4d988db740ac64710a62@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [44/51] [partial] maven-aether git commit: [MNG-6007] rename Aether to Maven Artifact Resolver archived-at: Sat, 03 Sep 2016 20:23:36 -0000 http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyRequest.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyRequest.java b/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyRequest.java deleted file mode 100644 index 138304a..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyRequest.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.collection.CollectRequest; -import org.eclipse.aether.graph.DependencyFilter; -import org.eclipse.aether.graph.DependencyNode; - -/** - * A request to resolve transitive dependencies. This request can either be supplied with a {@link CollectRequest} to - * calculate the transitive dependencies or with an already resolved dependency graph. - * - * @see RepositorySystem#resolveDependencies(RepositorySystemSession, DependencyRequest) - * @see Artifact#getFile() - */ -public final class DependencyRequest -{ - - private DependencyNode root; - - private CollectRequest collectRequest; - - private DependencyFilter filter; - - private RequestTrace trace; - - /** - * Creates an uninitialized request. Note that either {@link #setRoot(DependencyNode)} or - * {@link #setCollectRequest(CollectRequest)} must eventually be called to create a valid request. - */ - public DependencyRequest() - { - // enables default constructor - } - - /** - * Creates a request for the specified dependency graph and with the given resolution filter. - * - * @param node The root node of the dependency graph whose artifacts should be resolved, may be {@code null}. - * @param filter The resolution filter to use, may be {@code null}. - */ - public DependencyRequest( DependencyNode node, DependencyFilter filter ) - { - setRoot( node ); - setFilter( filter ); - } - - /** - * Creates a request for the specified collect request and with the given resolution filter. - * - * @param request The collect request used to calculate the dependency graph whose artifacts should be resolved, may - * be {@code null}. - * @param filter The resolution filter to use, may be {@code null}. - */ - public DependencyRequest( CollectRequest request, DependencyFilter filter ) - { - setCollectRequest( request ); - setFilter( filter ); - } - - /** - * Gets the root node of the dependency graph whose artifacts should be resolved. - * - * @return The root node of the dependency graph or {@code null} if none. - */ - public DependencyNode getRoot() - { - return root; - } - - /** - * Sets the root node of the dependency graph whose artifacts should be resolved. When this request is processed, - * the nodes of the given dependency graph will be updated to refer to the resolved artifacts. Eventually, either - * {@link #setRoot(DependencyNode)} or {@link #setCollectRequest(CollectRequest)} must be called to create a valid - * request. - * - * @param root The root node of the dependency graph, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public DependencyRequest setRoot( DependencyNode root ) - { - this.root = root; - return this; - } - - /** - * Gets the collect request used to calculate the dependency graph whose artifacts should be resolved. - * - * @return The collect request or {@code null} if none. - */ - public CollectRequest getCollectRequest() - { - return collectRequest; - } - - /** - * Sets the collect request used to calculate the dependency graph whose artifacts should be resolved. Eventually, - * either {@link #setRoot(DependencyNode)} or {@link #setCollectRequest(CollectRequest)} must be called to create a - * valid request. If this request is supplied with a dependency node via {@link #setRoot(DependencyNode)}, the - * collect request is ignored. - * - * @param collectRequest The collect request, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public DependencyRequest setCollectRequest( CollectRequest collectRequest ) - { - this.collectRequest = collectRequest; - return this; - } - - /** - * Gets the resolution filter used to select which artifacts of the dependency graph should be resolved. - * - * @return The resolution filter or {@code null} to resolve all artifacts of the dependency graph. - */ - public DependencyFilter getFilter() - { - return filter; - } - - /** - * Sets the resolution filter used to select which artifacts of the dependency graph should be resolved. For - * example, use this filter to restrict resolution to dependencies of a certain scope. - * - * @param filter The resolution filter, may be {@code null} to resolve all artifacts of the dependency graph. - * @return This request for chaining, never {@code null}. - */ - public DependencyRequest setFilter( DependencyFilter filter ) - { - this.filter = filter; - return this; - } - - /** - * Gets the trace information that describes the higher level request/operation in which this request is issued. - * - * @return The trace information about the higher level operation or {@code null} if none. - */ - public RequestTrace getTrace() - { - return trace; - } - - /** - * Sets the trace information that describes the higher level request/operation in which this request is issued. - * - * @param trace The trace information about the higher level operation, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public DependencyRequest setTrace( RequestTrace trace ) - { - this.trace = trace; - return this; - } - - @Override - public String toString() - { - if ( root != null ) - { - return String.valueOf( root ); - } - return String.valueOf( collectRequest ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyResolutionException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyResolutionException.java b/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyResolutionException.java deleted file mode 100644 index 2c12b57..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyResolutionException.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositoryException; - -/** - * Thrown in case of a unresolvable dependencies. - */ -public class DependencyResolutionException - extends RepositoryException -{ - - private final transient DependencyResult result; - - /** - * Creates a new exception with the specified result and cause. - * - * @param result The dependency result at the point the exception occurred, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public DependencyResolutionException( DependencyResult result, Throwable cause ) - { - super( getMessage( cause ), cause ); - this.result = result; - } - - /** - * Creates a new exception with the specified result, detail message and cause. - * - * @param result The dependency result at the point the exception occurred, may be {@code null}. - * @param message The detail message, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public DependencyResolutionException( DependencyResult result, String message, Throwable cause ) - { - super( message, cause ); - this.result = result; - } - - private static String getMessage( Throwable cause ) - { - String msg = null; - if ( cause != null ) - { - msg = cause.getMessage(); - } - if ( msg == null || msg.length() <= 0 ) - { - msg = "Could not resolve transitive dependencies"; - } - return msg; - } - - /** - * Gets the dependency result at the point the exception occurred. Despite being incomplete, callers might want to - * use this result to fail gracefully and continue their operation with whatever interim data has been gathered. - * - * @return The dependency result or {@code null} if unknown. - */ - public DependencyResult getResult() - { - return result; - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyResult.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyResult.java b/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyResult.java deleted file mode 100644 index 030e923..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/DependencyResult.java +++ /dev/null @@ -1,195 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Collections; -import java.util.List; - -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.graph.DependencyCycle; -import org.eclipse.aether.graph.DependencyNode; - -/** - * The result of a dependency resolution request. - * - * @see RepositorySystem#resolveDependencies(RepositorySystemSession, DependencyRequest) - */ -public final class DependencyResult -{ - - private final DependencyRequest request; - - private DependencyNode root; - - private List cycles; - - private List collectExceptions; - - private List artifactResults; - - /** - * Creates a new result for the specified request. - * - * @param request The resolution request, must not be {@code null}. - */ - public DependencyResult( DependencyRequest request ) - { - if ( request == null ) - { - throw new IllegalArgumentException( "dependency request has not been specified" ); - } - this.request = request; - root = request.getRoot(); - cycles = Collections.emptyList(); - collectExceptions = Collections.emptyList(); - artifactResults = Collections.emptyList(); - } - - /** - * Gets the resolution request that was made. - * - * @return The resolution request, never {@code null}. - */ - public DependencyRequest getRequest() - { - return request; - } - - /** - * Gets the root node of the resolved dependency graph. Note that this dependency graph might be - * incomplete/unfinished in case of {@link #getCollectExceptions()} indicating errors during its calculation. - * - * @return The root node of the resolved dependency graph or {@code null} if none. - */ - public DependencyNode getRoot() - { - return root; - } - - /** - * Sets the root node of the resolved dependency graph. - * - * @param root The root node of the resolved dependency graph, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public DependencyResult setRoot( DependencyNode root ) - { - this.root = root; - return this; - } - - /** - * Gets the dependency cycles that were encountered while building the dependency graph. Note that dependency cycles - * will only be reported here if the underlying request was created from a - * {@link org.eclipse.aether.collection.CollectRequest CollectRequest}. If the underlying {@link DependencyRequest} - * was created from an existing dependency graph, information about cycles will not be available in this result. - * - * @return The dependency cycles in the (raw) graph, never {@code null}. - */ - public List getCycles() - { - return cycles; - } - - /** - * Records the specified dependency cycles while building the dependency graph. - * - * @param cycles The dependency cycles to record, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public DependencyResult setCycles( List cycles ) - { - if ( cycles == null ) - { - this.cycles = Collections.emptyList(); - } - else - { - this.cycles = cycles; - } - return this; - } - - /** - * Gets the exceptions that occurred while building the dependency graph. - * - * @return The exceptions that occurred, never {@code null}. - */ - public List getCollectExceptions() - { - return collectExceptions; - } - - /** - * Records the specified exceptions while building the dependency graph. - * - * @param exceptions The exceptions to record, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public DependencyResult setCollectExceptions( List exceptions ) - { - if ( exceptions == null ) - { - this.collectExceptions = Collections.emptyList(); - } - else - { - this.collectExceptions = exceptions; - } - return this; - } - - /** - * Gets the resolution results for the dependency artifacts that matched {@link DependencyRequest#getFilter()}. - * - * @return The resolution results for the dependency artifacts, never {@code null}. - */ - public List getArtifactResults() - { - return artifactResults; - } - - /** - * Sets the resolution results for the artifacts that matched {@link DependencyRequest#getFilter()}. - * - * @param results The resolution results for the artifacts, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public DependencyResult setArtifactResults( List results ) - { - if ( results == null ) - { - this.artifactResults = Collections.emptyList(); - } - else - { - this.artifactResults = results; - } - return this; - } - - @Override - public String toString() - { - return String.valueOf( artifactResults ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/MetadataRequest.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/MetadataRequest.java b/aether-api/src/main/java/org/eclipse/aether/resolution/MetadataRequest.java deleted file mode 100644 index 86063ff..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/MetadataRequest.java +++ /dev/null @@ -1,232 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.metadata.Metadata; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * A request to resolve metadata from either a remote repository or the local repository. - * - * @see RepositorySystem#resolveMetadata(RepositorySystemSession, java.util.Collection) - * @see Metadata#getFile() - */ -public final class MetadataRequest -{ - - private Metadata metadata; - - private RemoteRepository repository; - - private String context = ""; - - private boolean deleteLocalCopyIfMissing; - - private boolean favorLocalRepository; - - private RequestTrace trace; - - /** - * Creates an uninitialized request. - */ - public MetadataRequest() - { - // enables default constructor - } - - /** - * Creates a request to resolve the specified metadata from the local repository. - * - * @param metadata The metadata to resolve, may be {@code null}. - */ - public MetadataRequest( Metadata metadata ) - { - setMetadata( metadata ); - } - - /** - * Creates a request with the specified properties. - * - * @param metadata The metadata to resolve, may be {@code null}. - * @param repository The repository to resolve the metadata from, may be {@code null} to resolve from the local - * repository. - * @param context The context in which this request is made, may be {@code null}. - */ - public MetadataRequest( Metadata metadata, RemoteRepository repository, String context ) - { - setMetadata( metadata ); - setRepository( repository ); - setRequestContext( context ); - } - - /** - * Gets the metadata to resolve. - * - * @return The metadata or {@code null} if not set. - */ - public Metadata getMetadata() - { - return metadata; - } - - /** - * Sets the metadata to resolve. - * - * @param metadata The metadata, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public MetadataRequest setMetadata( Metadata metadata ) - { - this.metadata = metadata; - return this; - } - - /** - * Gets the repository from which the metadata should be resolved. - * - * @return The repository or {@code null} to resolve from the local repository. - */ - public RemoteRepository getRepository() - { - return repository; - } - - /** - * Sets the repository from which the metadata should be resolved. - * - * @param repository The repository, may be {@code null} to resolve from the local repository. - * @return This request for chaining, never {@code null}. - */ - public MetadataRequest setRepository( RemoteRepository repository ) - { - this.repository = repository; - 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 MetadataRequest setRequestContext( String context ) - { - this.context = ( context != null ) ? context : ""; - return this; - } - - /** - * Indicates whether the locally cached copy of the metadata should be removed if the corresponding file does not - * exist (any more) in the remote repository. - * - * @return {@code true} if locally cached metadata should be deleted if no corresponding remote file exists, - * {@code false} to keep the local copy. - */ - public boolean isDeleteLocalCopyIfMissing() - { - return deleteLocalCopyIfMissing; - } - - /** - * Controls whether the locally cached copy of the metadata should be removed if the corresponding file does not - * exist (any more) in the remote repository. - * - * @param deleteLocalCopyIfMissing {@code true} if locally cached metadata should be deleted if no corresponding - * remote file exists, {@code false} to keep the local copy. - * @return This request for chaining, never {@code null}. - */ - public MetadataRequest setDeleteLocalCopyIfMissing( boolean deleteLocalCopyIfMissing ) - { - this.deleteLocalCopyIfMissing = deleteLocalCopyIfMissing; - return this; - } - - /** - * Indicates whether the metadata resolution should be suppressed if the corresponding metadata of the local - * repository is up-to-date according to the update policy of the remote repository. In this case, the metadata - * resolution will even be suppressed if no local copy of the remote metadata exists yet. - * - * @return {@code true} to suppress resolution of remote metadata if the corresponding metadata of the local - * repository is up-to-date, {@code false} to resolve the remote metadata normally according to the update - * policy. - */ - public boolean isFavorLocalRepository() - { - return favorLocalRepository; - } - - /** - * Controls resolution of remote metadata when already corresponding metadata of the local repository exists. In - * cases where the local repository's metadata is sufficient and going to be preferred, resolution of the remote - * metadata can be suppressed to avoid unnecessary network access. - * - * @param favorLocalRepository {@code true} to suppress resolution of remote metadata if the corresponding metadata - * of the local repository is up-to-date, {@code false} to resolve the remote metadata normally according - * to the update policy. - * @return This request for chaining, never {@code null}. - */ - public MetadataRequest setFavorLocalRepository( boolean favorLocalRepository ) - { - this.favorLocalRepository = favorLocalRepository; - return this; - } - - /** - * Gets the trace information that describes the higher level request/operation in which this request is issued. - * - * @return The trace information about the higher level operation or {@code null} if none. - */ - public RequestTrace getTrace() - { - return trace; - } - - /** - * Sets the trace information that describes the higher level request/operation in which this request is issued. - * - * @param trace The trace information about the higher level operation, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public MetadataRequest setTrace( RequestTrace trace ) - { - this.trace = trace; - return this; - } - - @Override - public String toString() - { - return getMetadata() + " < " + getRepository(); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/MetadataResult.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/MetadataResult.java b/aether-api/src/main/java/org/eclipse/aether/resolution/MetadataResult.java deleted file mode 100644 index 2bba499..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/MetadataResult.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.metadata.Metadata; -import org.eclipse.aether.transfer.MetadataNotFoundException; - -/** - * The result of a metadata resolution request. - * - * @see RepositorySystem#resolveMetadata(RepositorySystemSession, java.util.Collection) - */ -public final class MetadataResult -{ - - private final MetadataRequest request; - - private Exception exception; - - private boolean updated; - - private Metadata metadata; - - /** - * Creates a new result for the specified request. - * - * @param request The resolution request, must not be {@code null}. - */ - public MetadataResult( MetadataRequest request ) - { - if ( request == null ) - { - throw new IllegalArgumentException( "metadata request has not been specified" ); - } - this.request = request; - } - - /** - * Gets the resolution request that was made. - * - * @return The resolution request, never {@code null}. - */ - public MetadataRequest getRequest() - { - return request; - } - - /** - * Gets the resolved metadata (if any). - * - * @return The resolved metadata or {@code null} if the resolution failed. - */ - public Metadata getMetadata() - { - return metadata; - } - - /** - * Sets the resolved metadata. - * - * @param metadata The resolved metadata, may be {@code null} if the resolution failed. - * @return This result for chaining, never {@code null}. - */ - public MetadataResult setMetadata( Metadata metadata ) - { - this.metadata = metadata; - return this; - } - - /** - * Records the specified exception while resolving the metadata. - * - * @param exception The exception to record, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public MetadataResult setException( Exception exception ) - { - this.exception = exception; - return this; - } - - /** - * Gets the exception that occurred while resolving the metadata. - * - * @return The exception that occurred or {@code null} if none. - */ - public Exception getException() - { - return exception; - } - - /** - * Sets the updated flag for the metadata. - * - * @param updated {@code true} if the metadata was actually fetched from the remote repository during the - * resolution, {@code false} if the metadata was resolved from a locally cached copy. - * @return This result for chaining, never {@code null}. - */ - public MetadataResult setUpdated( boolean updated ) - { - this.updated = updated; - return this; - } - - /** - * Indicates whether the metadata was actually fetched from the remote repository or resolved from the local cache. - * If metadata has been locally cached during a previous resolution request and this local copy is still up-to-date - * according to the remote repository's update policy, no remote access is made. - * - * @return {@code true} if the metadata was actually fetched from the remote repository during the resolution, - * {@code false} if the metadata was resolved from a locally cached copy. - */ - public boolean isUpdated() - { - return updated; - } - - /** - * Indicates whether the requested metadata was resolved. Note that the metadata might have been successfully - * resolved (from the local cache) despite {@link #getException()} indicating a transfer error while trying to - * refetch the metadata from the remote repository. - * - * @return {@code true} if the metadata was resolved, {@code false} otherwise. - * @see Metadata#getFile() - */ - public boolean isResolved() - { - return getMetadata() != null && getMetadata().getFile() != null; - } - - /** - * Indicates whether the requested metadata is not present in the remote repository. - * - * @return {@code true} if the metadata is not present in the remote repository, {@code false} otherwise. - */ - public boolean isMissing() - { - return getException() instanceof MetadataNotFoundException; - } - - @Override - public String toString() - { - return getMetadata() + ( isUpdated() ? " (updated)" : " (cached)" ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/ResolutionErrorPolicy.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/ResolutionErrorPolicy.java b/aether-api/src/main/java/org/eclipse/aether/resolution/ResolutionErrorPolicy.java deleted file mode 100644 index 5158fa0..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/ResolutionErrorPolicy.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.metadata.Metadata; - -/** - * Controls the caching of resolution errors for artifacts/metadata from remote repositories. If caching is enabled for - * a given resource, a marker will be set (usually somewhere in the local repository) to suppress repeated resolution - * attempts for the broken resource, thereby avoiding expensive but useless network IO. The error marker is considered - * stale once the repository's update policy has expired at which point a future resolution attempt will be allowed. - * Error caching considers the current network settings such that fixes to the configuration like authentication or - * proxy automatically trigger revalidation with the remote side regardless of the time elapsed since the previous - * resolution error. - * - * @see RepositorySystemSession#getResolutionErrorPolicy() - */ -public interface ResolutionErrorPolicy -{ - - /** - * Bit mask indicating that resolution errors should not be cached in the local repository. This forces the system - * to always query the remote repository for locally missing artifacts/metadata. - */ - int CACHE_DISABLED = 0x00; - - /** - * Bit flag indicating whether missing artifacts/metadata should be cached in the local repository. If caching is - * enabled, resolution will not be reattempted until the update policy for the affected resource has expired. - */ - int CACHE_NOT_FOUND = 0x01; - - /** - * Bit flag indicating whether connectivity/transfer errors (e.g. unreachable host, bad authentication) should be - * cached in the local repository. If caching is enabled, resolution will not be reattempted until the update policy - * for the affected resource has expired. - */ - int CACHE_TRANSFER_ERROR = 0x02; - - /** - * Bit mask indicating that all resolution errors should be cached in the local repository. - */ - int CACHE_ALL = CACHE_NOT_FOUND | CACHE_TRANSFER_ERROR; - - /** - * Gets the error policy for an artifact. - * - * @param session The repository session during which the policy is determined, must not be {@code null}. - * @param request The policy request holding further details, must not be {@code null}. - * @return The bit mask describing the desired error policy. - */ - int getArtifactPolicy( RepositorySystemSession session, ResolutionErrorPolicyRequest request ); - - /** - * Gets the error policy for some metadata. - * - * @param session The repository session during which the policy is determined, must not be {@code null}. - * @param request The policy request holding further details, must not be {@code null}. - * @return The bit mask describing the desired error policy. - */ - int getMetadataPolicy( RepositorySystemSession session, ResolutionErrorPolicyRequest request ); - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/ResolutionErrorPolicyRequest.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/ResolutionErrorPolicyRequest.java b/aether-api/src/main/java/org/eclipse/aether/resolution/ResolutionErrorPolicyRequest.java deleted file mode 100644 index 9126914..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/ResolutionErrorPolicyRequest.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -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(); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeRequest.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeRequest.java b/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeRequest.java deleted file mode 100644 index d6aa16b..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeRequest.java +++ /dev/null @@ -1,190 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * A request to resolve a version range. - * - * @see RepositorySystem#resolveVersionRange(RepositorySystemSession, VersionRangeRequest) - */ -public final class VersionRangeRequest -{ - - private Artifact artifact; - - private List repositories = Collections.emptyList(); - - private String context = ""; - - private RequestTrace trace; - - /** - * Creates an uninitialized request. - */ - public VersionRangeRequest() - { - // enables default constructor - } - - /** - * Creates a request with the specified properties. - * - * @param artifact The artifact whose version range should be resolved, may be {@code null}. - * @param repositories The repositories to resolve the version from, may be {@code null}. - * @param context The context in which this request is made, may be {@code null}. - */ - public VersionRangeRequest( Artifact artifact, List repositories, String context ) - { - setArtifact( artifact ); - setRepositories( repositories ); - setRequestContext( context ); - } - - /** - * Gets the artifact whose version range shall be resolved. - * - * @return The artifact or {@code null} if not set. - */ - public Artifact getArtifact() - { - return artifact; - } - - /** - * Sets the artifact whose version range shall be resolved. - * - * @param artifact The artifact, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public VersionRangeRequest setArtifact( Artifact artifact ) - { - this.artifact = artifact; - return this; - } - - /** - * Gets the repositories to resolve the version range from. - * - * @return The repositories, never {@code null}. - */ - public List getRepositories() - { - return repositories; - } - - /** - * Sets the repositories to resolve the version range from. - * - * @param repositories The repositories, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public VersionRangeRequest setRepositories( List repositories ) - { - if ( repositories == null ) - { - this.repositories = Collections.emptyList(); - } - else - { - this.repositories = repositories; - } - return this; - } - - /** - * Adds the specified repository for the resolution. - * - * @param repository The repository to add, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public VersionRangeRequest addRepository( RemoteRepository repository ) - { - if ( repository != null ) - { - if ( this.repositories.isEmpty() ) - { - this.repositories = new ArrayList(); - } - this.repositories.add( repository ); - } - 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 VersionRangeRequest setRequestContext( String context ) - { - this.context = ( context != null ) ? context : ""; - return this; - } - - /** - * Gets the trace information that describes the higher level request/operation in which this request is issued. - * - * @return The trace information about the higher level operation or {@code null} if none. - */ - public RequestTrace getTrace() - { - return trace; - } - - /** - * Sets the trace information that describes the higher level request/operation in which this request is issued. - * - * @param trace The trace information about the higher level operation, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public VersionRangeRequest setTrace( RequestTrace trace ) - { - this.trace = trace; - return this; - } - - @Override - public String toString() - { - return getArtifact() + " < " + getRepositories(); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeResolutionException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeResolutionException.java b/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeResolutionException.java deleted file mode 100644 index deb0e52..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeResolutionException.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositoryException; - -/** - * Thrown in case of an unparseable or unresolvable version range. - */ -public class VersionRangeResolutionException - extends RepositoryException -{ - - private final transient VersionRangeResult result; - - /** - * Creates a new exception with the specified result. - * - * @param result The version range result at the point the exception occurred, may be {@code null}. - */ - public VersionRangeResolutionException( VersionRangeResult result ) - { - super( getMessage( result ), getCause( result ) ); - this.result = result; - } - - private static String getMessage( VersionRangeResult result ) - { - StringBuilder buffer = new StringBuilder( 256 ); - buffer.append( "Failed to resolve version range" ); - if ( result != null ) - { - buffer.append( " for " ).append( result.getRequest().getArtifact() ); - if ( !result.getExceptions().isEmpty() ) - { - buffer.append( ": " ).append( result.getExceptions().iterator().next().getMessage() ); - } - } - return buffer.toString(); - } - - private static Throwable getCause( VersionRangeResult result ) - { - Throwable cause = null; - if ( result != null && !result.getExceptions().isEmpty() ) - { - cause = result.getExceptions().get( 0 ); - } - return cause; - } - - /** - * Creates a new exception with the specified result and detail message. - * - * @param result The version range result at the point the exception occurred, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public VersionRangeResolutionException( VersionRangeResult result, String message ) - { - super( message ); - this.result = result; - } - - /** - * Creates a new exception with the specified result, detail message and cause. - * - * @param result The version range result at the point the exception occurred, may be {@code null}. - * @param message The detail message, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public VersionRangeResolutionException( VersionRangeResult result, String message, Throwable cause ) - { - super( message, cause ); - this.result = result; - } - - /** - * Gets the version range result at the point the exception occurred. Despite being incomplete, callers might want - * to use this result to fail gracefully and continue their operation with whatever interim data has been gathered. - * - * @return The version range result or {@code null} if unknown. - */ - public VersionRangeResult getResult() - { - return result; - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeResult.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeResult.java b/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeResult.java deleted file mode 100644 index 4749f7c..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRangeResult.java +++ /dev/null @@ -1,240 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.repository.ArtifactRepository; -import org.eclipse.aether.version.Version; -import org.eclipse.aether.version.VersionConstraint; - -/** - * The result of a version range resolution request. - * - * @see RepositorySystem#resolveVersionRange(RepositorySystemSession, VersionRangeRequest) - */ -public final class VersionRangeResult -{ - - private final VersionRangeRequest request; - - private List exceptions; - - private List versions; - - private Map repositories; - - private VersionConstraint versionConstraint; - - /** - * Creates a new result for the specified request. - * - * @param request The resolution request, must not be {@code null}. - */ - public VersionRangeResult( VersionRangeRequest request ) - { - if ( request == null ) - { - throw new IllegalArgumentException( "version range request has not been specified" ); - } - this.request = request; - exceptions = Collections.emptyList(); - versions = Collections.emptyList(); - repositories = Collections.emptyMap(); - } - - /** - * Gets the resolution request that was made. - * - * @return The resolution request, never {@code null}. - */ - public VersionRangeRequest getRequest() - { - return request; - } - - /** - * Gets the exceptions that occurred while resolving the version range. - * - * @return The exceptions that occurred, never {@code null}. - */ - public List getExceptions() - { - return exceptions; - } - - /** - * Records the specified exception while resolving the version range. - * - * @param exception The exception to record, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public VersionRangeResult addException( Exception exception ) - { - if ( exception != null ) - { - if ( exceptions.isEmpty() ) - { - exceptions = new ArrayList(); - } - exceptions.add( exception ); - } - return this; - } - - /** - * Gets the versions (in ascending order) that matched the requested range. - * - * @return The matching versions (if any), never {@code null}. - */ - public List getVersions() - { - return versions; - } - - /** - * Adds the specified version to the result. Note that versions must be added in ascending order. - * - * @param version The version to add, must not be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public VersionRangeResult addVersion( Version version ) - { - if ( versions.isEmpty() ) - { - versions = new ArrayList(); - } - versions.add( version ); - return this; - } - - /** - * Sets the versions (in ascending order) matching the requested range. - * - * @param versions The matching versions, may be empty or {@code null} if none. - * @return This result for chaining, never {@code null}. - */ - public VersionRangeResult setVersions( List versions ) - { - if ( versions == null ) - { - this.versions = Collections.emptyList(); - } - else - { - this.versions = versions; - } - return this; - } - - /** - * Gets the lowest version matching the requested range. - * - * @return The lowest matching version or {@code null} if no versions matched the requested range. - */ - public Version getLowestVersion() - { - if ( versions.isEmpty() ) - { - return null; - } - return versions.get( 0 ); - } - - /** - * Gets the highest version matching the requested range. - * - * @return The highest matching version or {@code null} if no versions matched the requested range. - */ - public Version getHighestVersion() - { - if ( versions.isEmpty() ) - { - return null; - } - return versions.get( versions.size() - 1 ); - } - - /** - * Gets the repository from which the specified version was resolved. - * - * @param version The version whose source repository should be retrieved, must not be {@code null}. - * @return The repository from which the version was resolved or {@code null} if unknown. - */ - public ArtifactRepository getRepository( Version version ) - { - return repositories.get( version ); - } - - /** - * Records the repository from which the specified version was resolved - * - * @param version The version whose source repository is to be recorded, must not be {@code null}. - * @param repository The repository from which the version was resolved, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public VersionRangeResult setRepository( Version version, ArtifactRepository repository ) - { - if ( repository != null ) - { - if ( repositories.isEmpty() ) - { - repositories = new HashMap(); - } - repositories.put( version, repository ); - } - return this; - } - - /** - * Gets the version constraint that was parsed from the artifact's version string. - * - * @return The parsed version constraint or {@code null}. - */ - public VersionConstraint getVersionConstraint() - { - return versionConstraint; - } - - /** - * Sets the version constraint that was parsed from the artifact's version string. - * - * @param versionConstraint The parsed version constraint, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public VersionRangeResult setVersionConstraint( VersionConstraint versionConstraint ) - { - this.versionConstraint = versionConstraint; - return this; - } - - @Override - public String toString() - { - return String.valueOf( repositories ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRequest.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRequest.java b/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRequest.java deleted file mode 100644 index 3dde7dd..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionRequest.java +++ /dev/null @@ -1,190 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * A request to resolve a metaversion. - * - * @see RepositorySystem#resolveVersion(RepositorySystemSession, VersionRequest) - */ -public final class VersionRequest -{ - - private Artifact artifact; - - private List repositories = Collections.emptyList(); - - private String context = ""; - - private RequestTrace trace; - - /** - * Creates an uninitialized request. - */ - public VersionRequest() - { - // enables default constructor - } - - /** - * Creates a request with the specified properties. - * - * @param artifact The artifact whose (meta-)version should be resolved, may be {@code null}. - * @param repositories The repositories to resolve the version from, may be {@code null}. - * @param context The context in which this request is made, may be {@code null}. - */ - public VersionRequest( Artifact artifact, List repositories, String context ) - { - setArtifact( artifact ); - setRepositories( repositories ); - setRequestContext( context ); - } - - /** - * Gets the artifact whose (meta-)version shall be resolved. - * - * @return The artifact or {@code null} if not set. - */ - public Artifact getArtifact() - { - return artifact; - } - - /** - * Sets the artifact whose (meta-)version shall be resolved. - * - * @param artifact The artifact, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public VersionRequest setArtifact( Artifact artifact ) - { - this.artifact = artifact; - return this; - } - - /** - * Gets the repositories to resolve the version from. - * - * @return The repositories, never {@code null}. - */ - public List getRepositories() - { - return repositories; - } - - /** - * Sets the repositories to resolve the version from. - * - * @param repositories The repositories, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public VersionRequest setRepositories( List repositories ) - { - if ( repositories == null ) - { - this.repositories = Collections.emptyList(); - } - else - { - this.repositories = repositories; - } - return this; - } - - /** - * Adds the specified repository for the resolution. - * - * @param repository The repository to add, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public VersionRequest addRepository( RemoteRepository repository ) - { - if ( repository != null ) - { - if ( this.repositories.isEmpty() ) - { - this.repositories = new ArrayList(); - } - this.repositories.add( repository ); - } - 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 VersionRequest setRequestContext( String context ) - { - this.context = ( context != null ) ? context : ""; - return this; - } - - /** - * Gets the trace information that describes the higher level request/operation in which this request is issued. - * - * @return The trace information about the higher level operation or {@code null} if none. - */ - public RequestTrace getTrace() - { - return trace; - } - - /** - * Sets the trace information that describes the higher level request/operation in which this request is issued. - * - * @param trace The trace information about the higher level operation, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - public VersionRequest setTrace( RequestTrace trace ) - { - this.trace = trace; - return this; - } - - @Override - public String toString() - { - return getArtifact() + " < " + getRepositories(); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/VersionResolutionException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionResolutionException.java b/aether-api/src/main/java/org/eclipse/aether/resolution/VersionResolutionException.java deleted file mode 100644 index 1aca861..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionResolutionException.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositoryException; - -/** - * Thrown in case of an unresolvable metaversion. - */ -public class VersionResolutionException - extends RepositoryException -{ - - private final transient VersionResult result; - - /** - * Creates a new exception with the specified result. - * - * @param result The version result at the point the exception occurred, may be {@code null}. - */ - public VersionResolutionException( VersionResult result ) - { - super( getMessage( result ), getCause( result ) ); - this.result = result; - } - - private static String getMessage( VersionResult result ) - { - StringBuilder buffer = new StringBuilder( 256 ); - buffer.append( "Failed to resolve version" ); - if ( result != null ) - { - buffer.append( " for " ).append( result.getRequest().getArtifact() ); - if ( !result.getExceptions().isEmpty() ) - { - buffer.append( ": " ).append( result.getExceptions().iterator().next().getMessage() ); - } - } - return buffer.toString(); - } - - private static Throwable getCause( VersionResult result ) - { - Throwable cause = null; - if ( result != null && !result.getExceptions().isEmpty() ) - { - cause = result.getExceptions().get( 0 ); - } - return cause; - } - - /** - * Creates a new exception with the specified result and detail message. - * - * @param result The version result at the point the exception occurred, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public VersionResolutionException( VersionResult result, String message ) - { - super( message, getCause( result ) ); - this.result = result; - } - - /** - * Creates a new exception with the specified result, detail message and cause. - * - * @param result The version result at the point the exception occurred, may be {@code null}. - * @param message The detail message, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public VersionResolutionException( VersionResult result, String message, Throwable cause ) - { - super( message, cause ); - this.result = result; - } - - /** - * Gets the version result at the point the exception occurred. Despite being incomplete, callers might want to use - * this result to fail gracefully and continue their operation with whatever interim data has been gathered. - * - * @return The version result or {@code null} if unknown. - */ - public VersionResult getResult() - { - return result; - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/VersionResult.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionResult.java b/aether-api/src/main/java/org/eclipse/aether/resolution/VersionResult.java deleted file mode 100644 index 5125773..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/VersionResult.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.eclipse.aether.resolution; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.repository.ArtifactRepository; - -/** - * The result of a version resolution request. - * - * @see RepositorySystem#resolveVersion(RepositorySystemSession, VersionRequest) - */ -public final class VersionResult -{ - - private final VersionRequest request; - - private List exceptions; - - private String version; - - private ArtifactRepository repository; - - /** - * Creates a new result for the specified request. - * - * @param request The resolution request, must not be {@code null}. - */ - public VersionResult( VersionRequest request ) - { - if ( request == null ) - { - throw new IllegalArgumentException( "version request has not been specified" ); - } - this.request = request; - exceptions = Collections.emptyList(); - } - - /** - * Gets the resolution request that was made. - * - * @return The resolution request, never {@code null}. - */ - public VersionRequest getRequest() - { - return request; - } - - /** - * Gets the exceptions that occurred while resolving the version. - * - * @return The exceptions that occurred, never {@code null}. - */ - public List getExceptions() - { - return exceptions; - } - - /** - * Records the specified exception while resolving the version. - * - * @param exception The exception to record, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public VersionResult addException( Exception exception ) - { - if ( exception != null ) - { - if ( exceptions.isEmpty() ) - { - exceptions = new ArrayList(); - } - exceptions.add( exception ); - } - return this; - } - - /** - * Gets the resolved version. - * - * @return The resolved version or {@code null} if the resolution failed. - */ - public String getVersion() - { - return version; - } - - /** - * Sets the resolved version. - * - * @param version The resolved version, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public VersionResult setVersion( String version ) - { - this.version = version; - return this; - } - - /** - * Gets the repository from which the version was eventually resolved. - * - * @return The repository from which the version was resolved or {@code null} if unknown. - */ - public ArtifactRepository getRepository() - { - return repository; - } - - /** - * Sets the repository from which the version was resolved. - * - * @param repository The repository from which the version was resolved, may be {@code null}. - * @return This result for chaining, never {@code null}. - */ - public VersionResult setRepository( ArtifactRepository repository ) - { - this.repository = repository; - return this; - } - - @Override - public String toString() - { - return getVersion() + " @ " + getRepository(); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/resolution/package-info.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/resolution/package-info.java b/aether-api/src/main/java/org/eclipse/aether/resolution/package-info.java deleted file mode 100644 index 33f9ef8..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/resolution/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -// CHECKSTYLE_OFF: RegexpHeader -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/** - * The types supporting the resolution of artifacts and metadata from repositories. - */ -package org.eclipse.aether.resolution; - http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/transfer/AbstractTransferListener.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/AbstractTransferListener.java b/aether-api/src/main/java/org/eclipse/aether/transfer/AbstractTransferListener.java deleted file mode 100644 index 5691e31..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/AbstractTransferListener.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.eclipse.aether.transfer; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * A skeleton implementation for custom transfer listeners. The callback methods in this class do nothing. - */ -public abstract class AbstractTransferListener - implements TransferListener -{ - - /** - * Enables subclassing. - */ - protected AbstractTransferListener() - { - } - - public void transferInitiated( TransferEvent event ) - throws TransferCancelledException - { - } - - public void transferStarted( TransferEvent event ) - throws TransferCancelledException - { - } - - public void transferProgressed( TransferEvent event ) - throws TransferCancelledException - { - } - - public void transferCorrupted( TransferEvent event ) - throws TransferCancelledException - { - } - - public void transferSucceeded( TransferEvent event ) - { - } - - public void transferFailed( TransferEvent event ) - { - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/transfer/ArtifactNotFoundException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/ArtifactNotFoundException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/ArtifactNotFoundException.java deleted file mode 100644 index 89a50d4..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/ArtifactNotFoundException.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.eclipse.aether.transfer; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.artifact.ArtifactProperties; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * Thrown when an artifact was not found in a particular repository. - */ -public class ArtifactNotFoundException - extends ArtifactTransferException -{ - - /** - * Creates a new exception with the specified artifact and repository. - * - * @param artifact The missing artifact, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - */ - public ArtifactNotFoundException( Artifact artifact, RemoteRepository repository ) - { - super( artifact, repository, getMessage( artifact, repository ) ); - } - - private static String getMessage( Artifact artifact, RemoteRepository repository ) - { - StringBuilder buffer = new StringBuilder( 256 ); - buffer.append( "Could not find artifact " ).append( artifact ); - buffer.append( getString( " in ", repository ) ); - if ( artifact != null ) - { - String localPath = artifact.getProperty( ArtifactProperties.LOCAL_PATH, null ); - if ( localPath != null && repository == null ) - { - buffer.append( " at specified path " ).append( localPath ); - } - String downloadUrl = artifact.getProperty( ArtifactProperties.DOWNLOAD_URL, null ); - if ( downloadUrl != null ) - { - buffer.append( ", try downloading from " ).append( downloadUrl ); - } - } - return buffer.toString(); - } - - /** - * Creates a new exception with the specified artifact, repository and detail message. - * - * @param artifact The missing artifact, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public ArtifactNotFoundException( Artifact artifact, RemoteRepository repository, String message ) - { - super( artifact, repository, message ); - } - - /** - * Creates a new exception with the specified artifact, repository and detail message. - * - * @param artifact The missing artifact, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - * @param message The detail message, may be {@code null}. - * @param fromCache {@code true} if the exception was played back from the error cache, {@code false} if the - * exception actually just occurred. - */ - public ArtifactNotFoundException( Artifact artifact, RemoteRepository repository, String message, boolean fromCache ) - { - super( artifact, repository, message, fromCache ); - } - - /** - * Creates a new exception with the specified artifact, repository, detail message and cause. - * - * @param artifact The missing artifact, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - * @param message The detail message, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public ArtifactNotFoundException( Artifact artifact, RemoteRepository repository, String message, Throwable cause ) - { - super( artifact, repository, message, cause ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-aether/blob/27f8bd73/aether-api/src/main/java/org/eclipse/aether/transfer/ArtifactTransferException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/ArtifactTransferException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/ArtifactTransferException.java deleted file mode 100644 index 087040f..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/ArtifactTransferException.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.eclipse.aether.transfer; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositoryException; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * Thrown when an artifact could not be uploaded/downloaded to/from a particular remote repository. - */ -public class ArtifactTransferException - extends RepositoryException -{ - - private final transient Artifact artifact; - - private final transient RemoteRepository repository; - - private final boolean fromCache; - - static String getString( String prefix, RemoteRepository repository ) - { - if ( repository == null ) - { - return ""; - } - else - { - return prefix + repository.getId() + " (" + repository.getUrl() + ")"; - } - } - - /** - * Creates a new exception with the specified artifact, repository and detail message. - * - * @param artifact The untransferable artifact, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public ArtifactTransferException( Artifact artifact, RemoteRepository repository, String message ) - { - this( artifact, repository, message, false ); - } - - /** - * Creates a new exception with the specified artifact, repository and detail message. - * - * @param artifact The untransferable artifact, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - * @param message The detail message, may be {@code null}. - * @param fromCache {@code true} if the exception was played back from the error cache, {@code false} if the - * exception actually just occurred. - */ - public ArtifactTransferException( Artifact artifact, RemoteRepository repository, String message, boolean fromCache ) - { - super( message ); - this.artifact = artifact; - this.repository = repository; - this.fromCache = fromCache; - } - - /** - * Creates a new exception with the specified artifact, repository and cause. - * - * @param artifact The untransferable artifact, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public ArtifactTransferException( Artifact artifact, RemoteRepository repository, Throwable cause ) - { - this( artifact, repository, "Could not transfer artifact " + artifact + getString( " from/to ", repository ) - + getMessage( ": ", cause ), cause ); - } - - /** - * Creates a new exception with the specified artifact, repository, detail message and cause. - * - * @param artifact The untransferable artifact, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - * @param message The detail message, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public ArtifactTransferException( Artifact artifact, RemoteRepository repository, String message, Throwable cause ) - { - super( message, cause ); - this.artifact = artifact; - this.repository = repository; - this.fromCache = false; - } - - /** - * Gets the artifact that could not be transferred. - * - * @return The troublesome artifact or {@code null} if unknown. - */ - public Artifact getArtifact() - { - return artifact; - } - - /** - * Gets the remote repository involved in the transfer. - * - * @return The involved remote repository or {@code null} if unknown. - */ - public RemoteRepository getRepository() - { - return repository; - } - - /** - * Indicates whether this exception actually just occurred or was played back from the error cache. - * - * @return {@code true} if the exception was played back from the error cache, {@code false} if the exception - * actually occurred just now. - */ - public boolean isFromCache() - { - return fromCache; - } - -}