http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/ChecksumFailureException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/ChecksumFailureException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/ChecksumFailureException.java deleted file mode 100644 index 1dbc6b0..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/ChecksumFailureException.java +++ /dev/null @@ -1,131 +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; - -/** - * Thrown in case of a checksum failure during an artifact/metadata download. - */ -public class ChecksumFailureException - extends RepositoryException -{ - - private final String expected; - - private final String actual; - - private final boolean retryWorthy; - - /** - * Creates a new exception with the specified expected and actual checksum. The resulting exception is - * {@link #isRetryWorthy() retry-worthy}. - * - * @param expected The expected checksum as declared by the hosting repository, may be {@code null}. - * @param actual The actual checksum as computed from the local bytes, may be {@code null}. - */ - public ChecksumFailureException( String expected, String actual ) - { - super( "Checksum validation failed, expected " + expected + " but is " + actual ); - this.expected = expected; - this.actual = actual; - retryWorthy = true; - } - - /** - * Creates a new exception with the specified detail message. The resulting exception is not - * {@link #isRetryWorthy() retry-worthy}. - * - * @param message The detail message, may be {@code null}. - */ - public ChecksumFailureException( String message ) - { - this( false, message, null ); - } - - /** - * Creates a new exception with the specified cause. The resulting exception is not {@link #isRetryWorthy() - * retry-worthy}. - * - * @param cause The exception that caused this one, may be {@code null}. - */ - public ChecksumFailureException( Throwable cause ) - { - this( "Checksum validation failed" + getMessage( ": ", cause ), cause ); - } - - /** - * Creates a new exception with the specified detail message and cause. The resulting exception is not - * {@link #isRetryWorthy() retry-worthy}. - * - * @param message The detail message, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public ChecksumFailureException( String message, Throwable cause ) - { - this( false, message, cause ); - } - - /** - * Creates a new exception with the specified retry flag, detail message and cause. - * - * @param retryWorthy {@code true} if the exception is retry-worthy, {@code false} otherwise. - * @param message The detail message, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public ChecksumFailureException( boolean retryWorthy, String message, Throwable cause ) - { - super( message, cause ); - expected = actual = ""; - this.retryWorthy = retryWorthy; - } - - /** - * Gets the expected checksum for the downloaded artifact/metadata. - * - * @return The expected checksum as declared by the hosting repository or {@code null} if unknown. - */ - public String getExpected() - { - return expected; - } - - /** - * Gets the actual checksum for the downloaded artifact/metadata. - * - * @return The actual checksum as computed from the local bytes or {@code null} if unknown. - */ - public String getActual() - { - return actual; - } - - /** - * Indicates whether the corresponding download is retry-worthy. - * - * @return {@code true} if retrying the download might solve the checksum failure, {@code false} if the checksum - * failure is non-recoverable. - */ - public boolean isRetryWorthy() - { - return retryWorthy; - } - -}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/MetadataNotFoundException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/MetadataNotFoundException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/MetadataNotFoundException.java deleted file mode 100644 index 9642621..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/MetadataNotFoundException.java +++ /dev/null @@ -1,106 +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.metadata.Metadata; -import org.eclipse.aether.repository.LocalRepository; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * Thrown when metadata was not found in a particular repository. - */ -public class MetadataNotFoundException - extends MetadataTransferException -{ - - /** - * Creates a new exception with the specified metadata and local repository. - * - * @param metadata The missing metadata, may be {@code null}. - * @param repository The involved local repository, may be {@code null}. - */ - public MetadataNotFoundException( Metadata metadata, LocalRepository repository ) - { - super( metadata, null, "Could not find metadata " + metadata + getString( " in ", repository ) ); - } - - private static String getString( String prefix, LocalRepository repository ) - { - if ( repository == null ) - { - return ""; - } - else - { - return prefix + repository.getId() + " (" + repository.getBasedir() + ")"; - } - } - - /** - * Creates a new exception with the specified metadata and repository. - * - * @param metadata The missing metadata, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - */ - public MetadataNotFoundException( Metadata metadata, RemoteRepository repository ) - { - super( metadata, repository, "Could not find metadata " + metadata + getString( " in ", repository ) ); - } - - /** - * Creates a new exception with the specified metadata, repository and detail message. - * - * @param metadata The missing metadata, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public MetadataNotFoundException( Metadata metadata, RemoteRepository repository, String message ) - { - super( metadata, repository, message ); - } - - /** - * Creates a new exception with the specified metadata, repository and detail message. - * - * @param metadata The missing metadata, 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 MetadataNotFoundException( Metadata metadata, RemoteRepository repository, String message, boolean fromCache ) - { - super( metadata, repository, message, fromCache ); - } - - /** - * Creates a new exception with the specified metadata, repository, detail message and cause. - * - * @param metadata The missing metadata, 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 MetadataNotFoundException( Metadata metadata, RemoteRepository repository, String message, Throwable cause ) - { - super( metadata, repository, message, cause ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/MetadataTransferException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/MetadataTransferException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/MetadataTransferException.java deleted file mode 100644 index df6374c..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/MetadataTransferException.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.metadata.Metadata; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * Thrown when metadata could not be uploaded/downloaded to/from a particular remote repository. - */ -public class MetadataTransferException - extends RepositoryException -{ - - private final transient Metadata metadata; - - 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 metadata, repository and detail message. - * - * @param metadata The untransferable metadata, may be {@code null}. - * @param repository The involved remote repository, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public MetadataTransferException( Metadata metadata, RemoteRepository repository, String message ) - { - this( metadata, repository, message, false ); - } - - /** - * Creates a new exception with the specified metadata, repository and detail message. - * - * @param metadata The untransferable metadata, 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 MetadataTransferException( Metadata metadata, RemoteRepository repository, String message, boolean fromCache ) - { - super( message ); - this.metadata = metadata; - this.repository = repository; - this.fromCache = fromCache; - } - - /** - * Creates a new exception with the specified metadata, repository and cause. - * - * @param metadata The untransferable metadata, 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 MetadataTransferException( Metadata metadata, RemoteRepository repository, Throwable cause ) - { - this( metadata, repository, "Could not transfer metadata " + metadata + getString( " from/to ", repository ) - + getMessage( ": ", cause ), cause ); - } - - /** - * Creates a new exception with the specified metadata, repository, detail message and cause. - * - * @param metadata The untransferable metadata, 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 MetadataTransferException( Metadata metadata, RemoteRepository repository, String message, Throwable cause ) - { - super( message, cause ); - this.metadata = metadata; - this.repository = repository; - this.fromCache = false; - } - - /** - * Gets the metadata that could not be transferred. - * - * @return The troublesome metadata or {@code null} if unknown. - */ - public Metadata getMetadata() - { - return metadata; - } - - /** - * 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; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/NoRepositoryConnectorException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/NoRepositoryConnectorException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/NoRepositoryConnectorException.java deleted file mode 100644 index 3140569..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/NoRepositoryConnectorException.java +++ /dev/null @@ -1,103 +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.repository.RemoteRepository; - -/** - * Thrown in case of an unsupported remote repository type. - */ -public class NoRepositoryConnectorException - extends RepositoryException -{ - - private final transient RemoteRepository repository; - - /** - * Creates a new exception with the specified repository. - * - * @param repository The remote repository whose content type is not supported, may be {@code null}. - */ - public NoRepositoryConnectorException( RemoteRepository repository ) - { - this( repository, toMessage( repository ) ); - } - - /** - * Creates a new exception with the specified repository and detail message. - * - * @param repository The remote repository whose content type is not supported, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public NoRepositoryConnectorException( RemoteRepository repository, String message ) - { - super( message ); - this.repository = repository; - } - - /** - * Creates a new exception with the specified repository and cause. - * - * @param repository The remote repository whose content type is not supported, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public NoRepositoryConnectorException( RemoteRepository repository, Throwable cause ) - { - this( repository, toMessage( repository ), cause ); - } - - /** - * Creates a new exception with the specified repository, detail message and cause. - * - * @param repository The remote repository whose content type is not supported, 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 NoRepositoryConnectorException( RemoteRepository repository, String message, Throwable cause ) - { - super( message, cause ); - this.repository = repository; - } - - private static String toMessage( RemoteRepository repository ) - { - if ( repository != null ) - { - return "No connector available to access repository " + repository.getId() + " (" + repository.getUrl() - + ") of type " + repository.getContentType(); - } - else - { - return "No connector available to access repository"; - } - } - - /** - * Gets the remote repository whose content type is not supported. - * - * @return The unsupported remote repository or {@code null} if unknown. - */ - public RemoteRepository getRepository() - { - return repository; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/NoRepositoryLayoutException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/NoRepositoryLayoutException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/NoRepositoryLayoutException.java deleted file mode 100644 index 3fc05bb..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/NoRepositoryLayoutException.java +++ /dev/null @@ -1,102 +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.repository.RemoteRepository; - -/** - * Thrown in case of an unsupported repository layout. - */ -public class NoRepositoryLayoutException - extends RepositoryException -{ - - private final transient RemoteRepository repository; - - /** - * Creates a new exception with the specified repository. - * - * @param repository The remote repository whose layout is not supported, may be {@code null}. - */ - public NoRepositoryLayoutException( RemoteRepository repository ) - { - this( repository, toMessage( repository ) ); - } - - /** - * Creates a new exception with the specified repository and detail message. - * - * @param repository The remote repository whose layout is not supported, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public NoRepositoryLayoutException( RemoteRepository repository, String message ) - { - super( message ); - this.repository = repository; - } - - /** - * Creates a new exception with the specified repository and cause. - * - * @param repository The remote repository whose layout is not supported, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public NoRepositoryLayoutException( RemoteRepository repository, Throwable cause ) - { - this( repository, toMessage( repository ), cause ); - } - - /** - * Creates a new exception with the specified repository, detail message and cause. - * - * @param repository The remote repository whose layout is not supported, 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 NoRepositoryLayoutException( RemoteRepository repository, String message, Throwable cause ) - { - super( message, cause ); - this.repository = repository; - } - - private static String toMessage( RemoteRepository repository ) - { - if ( repository != null ) - { - return "Unsupported repository layout " + repository.getContentType(); - } - else - { - return "Unsupported repository layout"; - } - } - - /** - * Gets the remote repository whose layout is not supported. - * - * @return The unsupported remote repository or {@code null} if unknown. - */ - public RemoteRepository getRepository() - { - return repository; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/NoTransporterException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/NoTransporterException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/NoTransporterException.java deleted file mode 100644 index 5d98558..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/NoTransporterException.java +++ /dev/null @@ -1,102 +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.repository.RemoteRepository; - -/** - * Thrown in case of an unsupported transport protocol. - */ -public class NoTransporterException - extends RepositoryException -{ - - private final transient RemoteRepository repository; - - /** - * Creates a new exception with the specified repository. - * - * @param repository The remote repository whose transport layout is not supported, may be {@code null}. - */ - public NoTransporterException( RemoteRepository repository ) - { - this( repository, toMessage( repository ) ); - } - - /** - * Creates a new exception with the specified repository and detail message. - * - * @param repository The remote repository whose transport layout is not supported, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public NoTransporterException( RemoteRepository repository, String message ) - { - super( message ); - this.repository = repository; - } - - /** - * Creates a new exception with the specified repository and cause. - * - * @param repository The remote repository whose transport layout is not supported, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public NoTransporterException( RemoteRepository repository, Throwable cause ) - { - this( repository, toMessage( repository ), cause ); - } - - /** - * Creates a new exception with the specified repository, detail message and cause. - * - * @param repository The remote repository whose transport layout is not supported, 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 NoTransporterException( RemoteRepository repository, String message, Throwable cause ) - { - super( message, cause ); - this.repository = repository; - } - - private static String toMessage( RemoteRepository repository ) - { - if ( repository != null ) - { - return "Unsupported transport protocol " + repository.getProtocol(); - } - else - { - return "Unsupported transport protocol"; - } - } - - /** - * Gets the remote repository whose transport protocol is not supported. - * - * @return The unsupported remote repository or {@code null} if unknown. - */ - public RemoteRepository getRepository() - { - return repository; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/RepositoryOfflineException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/RepositoryOfflineException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/RepositoryOfflineException.java deleted file mode 100644 index 02d4680..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/RepositoryOfflineException.java +++ /dev/null @@ -1,79 +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.repository.RemoteRepository; - -/** - * Thrown when a transfer could not be performed because a remote repository is not accessible in offline mode. - */ -public class RepositoryOfflineException - extends RepositoryException -{ - - private final transient RemoteRepository repository; - - private static String getMessage( RemoteRepository repository ) - { - if ( repository == null ) - { - return "Cannot access remote repositories in offline mode"; - } - else - { - return "Cannot access " + repository.getId() + " (" + repository.getUrl() + ") in offline mode"; - } - } - - /** - * Creates a new exception with the specified repository. - * - * @param repository The inaccessible remote repository, may be {@code null}. - */ - public RepositoryOfflineException( RemoteRepository repository ) - { - super( getMessage( repository ) ); - this.repository = repository; - } - - /** - * Creates a new exception with the specified repository and detail message. - * - * @param repository The inaccessible remote repository, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public RepositoryOfflineException( RemoteRepository repository, String message ) - { - super( message ); - this.repository = repository; - } - - /** - * Gets the remote repository that could not be accessed due to offline mode. - * - * @return The inaccessible remote repository or {@code null} if unknown. - */ - public RemoteRepository getRepository() - { - return repository; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/TransferCancelledException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/TransferCancelledException.java b/aether-api/src/main/java/org/eclipse/aether/transfer/TransferCancelledException.java deleted file mode 100644 index 88caa13..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/TransferCancelledException.java +++ /dev/null @@ -1,60 +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; - -/** - * Thrown in case an upload/download was cancelled (e.g. due to user request). - */ -public class TransferCancelledException - extends RepositoryException -{ - - /** - * Creates a new exception with a stock detail message. - */ - public TransferCancelledException() - { - super( "The operation was cancelled." ); - } - - /** - * Creates a new exception with the specified detail message. - * - * @param message The detail message, may be {@code null}. - */ - public TransferCancelledException( String message ) - { - super( message ); - } - - /** - * Creates a new exception with the specified detail message and cause. - * - * @param message The detail message, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public TransferCancelledException( String message, Throwable cause ) - { - super( message, cause ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/TransferEvent.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/TransferEvent.java b/aether-api/src/main/java/org/eclipse/aether/transfer/TransferEvent.java deleted file mode 100644 index 1599a82..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/TransferEvent.java +++ /dev/null @@ -1,432 +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 java.nio.ByteBuffer; - -import org.eclipse.aether.RepositorySystemSession; - -/** - * An event fired to a transfer listener during an artifact/metadata transfer. - * - * @see TransferListener - * @see TransferEvent.Builder - */ -public final class TransferEvent -{ - - /** - * The type of the event. - */ - public enum EventType - { - - /** - * @see TransferListener#transferInitiated(TransferEvent) - */ - INITIATED, - - /** - * @see TransferListener#transferStarted(TransferEvent) - */ - STARTED, - - /** - * @see TransferListener#transferProgressed(TransferEvent) - */ - PROGRESSED, - - /** - * @see TransferListener#transferCorrupted(TransferEvent) - */ - CORRUPTED, - - /** - * @see TransferListener#transferSucceeded(TransferEvent) - */ - SUCCEEDED, - - /** - * @see TransferListener#transferFailed(TransferEvent) - */ - FAILED - - } - - /** - * The type of the request/transfer being performed. - */ - public enum RequestType - { - - /** - * Download artifact/metadata. - */ - GET, - - /** - * Check artifact/metadata existence only. - */ - GET_EXISTENCE, - - /** - * Upload artifact/metadata. - */ - PUT, - - } - - private final EventType type; - - private final RequestType requestType; - - private final RepositorySystemSession session; - - private final TransferResource resource; - - private final ByteBuffer dataBuffer; - - private final long transferredBytes; - - private final Exception exception; - - TransferEvent( Builder builder ) - { - type = builder.type; - requestType = builder.requestType; - session = builder.session; - resource = builder.resource; - dataBuffer = builder.dataBuffer; - transferredBytes = builder.transferredBytes; - exception = builder.exception; - } - - /** - * Gets the type of the event. - * - * @return The type of the event, never {@code null}. - */ - public EventType getType() - { - return type; - } - - /** - * Gets the type of the request/transfer. - * - * @return The type of the request/transfer, never {@code null}. - */ - public RequestType getRequestType() - { - return requestType; - } - - /** - * Gets the repository system session during which the event occurred. - * - * @return The repository system session during which the event occurred, never {@code null}. - */ - public RepositorySystemSession getSession() - { - return session; - } - - /** - * Gets the resource that is being transferred. - * - * @return The resource being transferred, never {@code null}. - */ - public TransferResource getResource() - { - return resource; - } - - /** - * Gets the total number of bytes that have been transferred since the download/upload of the resource was started. - * If a download has been resumed, the returned count includes the bytes that were already downloaded during the - * previous attempt. In other words, the ratio of transferred bytes to the content length of the resource indicates - * the percentage of transfer completion. - * - * @return The total number of bytes that have been transferred since the transfer started, never negative. - * @see #getDataLength() - * @see TransferResource#getResumeOffset() - */ - public long getTransferredBytes() - { - return transferredBytes; - } - - /** - * Gets the byte buffer holding the transferred bytes since the last event. A listener must assume this buffer to be - * owned by the event source and must not change any byte in this buffer. Also, the buffer is only valid for the - * duration of the event callback, i.e. the next event might reuse the same buffer (with updated contents). - * Therefore, if the actual event processing is deferred, the byte buffer would have to be cloned to create an - * immutable snapshot of its contents. - * - * @return The (read-only) byte buffer or {@code null} if not applicable to the event, i.e. if the event type is not - * {@link EventType#PROGRESSED}. - */ - public ByteBuffer getDataBuffer() - { - return ( dataBuffer != null ) ? dataBuffer.asReadOnlyBuffer() : null; - } - - /** - * Gets the number of bytes that have been transferred since the last event. - * - * @return The number of bytes that have been transferred since the last event, possibly zero but never negative. - * @see #getTransferredBytes() - */ - public int getDataLength() - { - return ( dataBuffer != null ) ? dataBuffer.remaining() : 0; - } - - /** - * Gets the error that occurred during the transfer. - * - * @return The error that occurred or {@code null} if none. - */ - public Exception getException() - { - return exception; - } - - @Override - public String toString() - { - return getRequestType() + " " + getType() + " " + getResource(); - } - - /** - * A builder to create transfer events. - */ - public static final class Builder - { - - EventType type; - - RequestType requestType; - - RepositorySystemSession session; - - TransferResource resource; - - ByteBuffer dataBuffer; - - long transferredBytes; - - Exception exception; - - /** - * Creates a new transfer event builder for the specified session and the given resource. - * - * @param session The repository system session, must not be {@code null}. - * @param resource The resource being transferred, must not be {@code null}. - */ - public Builder( RepositorySystemSession session, TransferResource resource ) - { - if ( session == null ) - { - throw new IllegalArgumentException( "session not specified" ); - } - if ( resource == null ) - { - throw new IllegalArgumentException( "transfer resource not specified" ); - } - this.session = session; - this.resource = resource; - type = EventType.INITIATED; - requestType = RequestType.GET; - } - - private Builder( Builder prototype ) - { - session = prototype.session; - resource = prototype.resource; - type = prototype.type; - requestType = prototype.requestType; - dataBuffer = prototype.dataBuffer; - transferredBytes = prototype.transferredBytes; - exception = prototype.exception; - } - - /** - * Creates a new transfer event builder from the current values of this builder. The state of this builder - * remains unchanged. - * - * @return The new event builder, never {@code null}. - */ - public Builder copy() - { - return new Builder( this ); - } - - /** - * Sets the type of the event and resets event-specific fields. In more detail, the data buffer and the - * exception fields are set to {@code null}. Furthermore, the total number of transferred bytes is set to - * {@code 0} if the event type is {@link EventType#STARTED}. - * - * @param type The type of the event, must not be {@code null}. - * @return This event builder for chaining, never {@code null}. - */ - public Builder resetType( EventType type ) - { - if ( type == null ) - { - throw new IllegalArgumentException( "event type not specified" ); - } - this.type = type; - dataBuffer = null; - exception = null; - switch ( type ) - { - case INITIATED: - case STARTED: - transferredBytes = 0; - default: - } - return this; - } - - /** - * Sets the type of the event. When re-using the same builder to generate a sequence of events for one transfer, - * {@link #resetType(TransferEvent.EventType)} might be more handy. - * - * @param type The type of the event, must not be {@code null}. - * @return This event builder for chaining, never {@code null}. - */ - public Builder setType( EventType type ) - { - if ( type == null ) - { - throw new IllegalArgumentException( "event type not specified" ); - } - this.type = type; - return this; - } - - /** - * Sets the type of the request/transfer. - * - * @param requestType The request/transfer type, must not be {@code null}. - * @return This event builder for chaining, never {@code null}. - */ - public Builder setRequestType( RequestType requestType ) - { - if ( requestType == null ) - { - throw new IllegalArgumentException( "request type not specified" ); - } - this.requestType = requestType; - return this; - } - - /** - * Sets the total number of bytes that have been transferred so far during the download/upload of the resource. - * If a download is being resumed, the count must include the bytes that were already downloaded in the previous - * attempt and from which the current transfer started. In this case, the event type {@link EventType#STARTED} - * should indicate from what byte the download resumes. - * - * @param transferredBytes The total number of bytes that have been transferred so far during the - * download/upload of the resource, must not be negative. - * @return This event builder for chaining, never {@code null}. - * @see TransferResource#setResumeOffset(long) - */ - public Builder setTransferredBytes( long transferredBytes ) - { - if ( transferredBytes < 0 ) - { - throw new IllegalArgumentException( "number of transferred bytes cannot be negative" ); - } - this.transferredBytes = transferredBytes; - return this; - } - - /** - * Increments the total number of bytes that have been transferred so far during the download/upload. - * - * @param transferredBytes The number of bytes that have been transferred since the last event, must not be - * negative. - * @return This event builder for chaining, never {@code null}. - */ - public Builder addTransferredBytes( long transferredBytes ) - { - if ( transferredBytes < 0 ) - { - throw new IllegalArgumentException( "number of transferred bytes cannot be negative" ); - } - this.transferredBytes += transferredBytes; - return this; - } - - /** - * Sets the byte buffer holding the transferred bytes since the last event. - * - * @param buffer The byte buffer holding the transferred bytes since the last event, may be {@code null} if not - * applicable to the event. - * @param offset The starting point of valid bytes in the array. - * @param length The number of valid bytes, must not be negative. - * @return This event builder for chaining, never {@code null}. - */ - public Builder setDataBuffer( byte[] buffer, int offset, int length ) - { - return setDataBuffer( ( buffer != null ) ? ByteBuffer.wrap( buffer, offset, length ) : null ); - } - - /** - * Sets the byte buffer holding the transferred bytes since the last event. - * - * @param dataBuffer The byte buffer holding the transferred bytes since the last event, may be {@code null} if - * not applicable to the event. - * @return This event builder for chaining, never {@code null}. - */ - public Builder setDataBuffer( ByteBuffer dataBuffer ) - { - this.dataBuffer = dataBuffer; - return this; - } - - /** - * Sets the error that occurred during the transfer. - * - * @param exception The error that occurred during the transfer, may be {@code null} if none. - * @return This event builder for chaining, never {@code null}. - */ - public Builder setException( Exception exception ) - { - this.exception = exception; - return this; - } - - /** - * Builds a new transfer event from the current values of this builder. The state of the builder itself remains - * unchanged. - * - * @return The transfer event, never {@code null}. - */ - public TransferEvent build() - { - return new TransferEvent( this ); - } - - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/TransferListener.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/TransferListener.java b/aether-api/src/main/java/org/eclipse/aether/transfer/TransferListener.java deleted file mode 100644 index 18019a9..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/TransferListener.java +++ /dev/null @@ -1,100 +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 listener being notified of artifact/metadata transfers from/to remote repositories. The listener may be called from - * an arbitrary thread. Reusing common regular expression syntax, the sequence of events is roughly as follows: - * - * <pre> - * INITIATED ( STARTED PROGRESSED* CORRUPTED? )* ( SUCCEEDED | FAILED ) - * </pre> - * - * <em>Note:</em> Implementors are strongly advised to inherit from {@link AbstractTransferListener} instead of directly - * implementing this interface. - * - * @see org.eclipse.aether.RepositorySystemSession#getTransferListener() - * @see org.eclipse.aether.RepositoryListener - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface TransferListener -{ - - /** - * Notifies the listener about the initiation of a transfer. This event gets fired before any actual network access - * to the remote repository and usually indicates some thread is now about to perform the transfer. For a given - * transfer request, this event is the first one being fired and it must be emitted exactly once. - * - * @param event The event details, must not be {@code null}. - * @throws TransferCancelledException If the transfer should be aborted. - */ - void transferInitiated( TransferEvent event ) - throws TransferCancelledException; - - /** - * Notifies the listener about the start of a data transfer. This event indicates a successful connection to the - * remote repository. In case of a download, the requested remote resource exists and its size is given by - * {@link TransferResource#getContentLength()} if possible. This event may be fired multiple times for given - * transfer request if said transfer needs to be repeated (e.g. in response to an authentication challenge). - * - * @param event The event details, must not be {@code null}. - * @throws TransferCancelledException If the transfer should be aborted. - */ - void transferStarted( TransferEvent event ) - throws TransferCancelledException; - - /** - * Notifies the listener about some progress in the data transfer. This event may even be fired if actually zero - * bytes have been transferred since the last event, for instance to enable cancellation. - * - * @param event The event details, must not be {@code null}. - * @throws TransferCancelledException If the transfer should be aborted. - */ - void transferProgressed( TransferEvent event ) - throws TransferCancelledException; - - /** - * Notifies the listener that a checksum validation failed. {@link TransferEvent#getException()} will be of type - * {@link ChecksumFailureException} and can be used to query further details about the expected/actual checksums. - * - * @param event The event details, must not be {@code null}. - * @throws TransferCancelledException If the transfer should be aborted. - */ - void transferCorrupted( TransferEvent event ) - throws TransferCancelledException; - - /** - * Notifies the listener about the successful completion of a transfer. This event must be fired exactly once for a - * given transfer request unless said request failed. - * - * @param event The event details, must not be {@code null}. - */ - void transferSucceeded( TransferEvent event ); - - /** - * Notifies the listener about the unsuccessful termination of a transfer. {@link TransferEvent#getException()} will - * provide further information about the failure. - * - * @param event The event details, must not be {@code null}. - */ - void transferFailed( TransferEvent event ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/TransferResource.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/TransferResource.java b/aether-api/src/main/java/org/eclipse/aether/transfer/TransferResource.java deleted file mode 100644 index cbe0230..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/TransferResource.java +++ /dev/null @@ -1,201 +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 java.io.File; - -import org.eclipse.aether.RequestTrace; - -/** - * Describes a resource being uploaded or downloaded by the repository system. - */ -public final class TransferResource -{ - - private final String repositoryUrl; - - private final String resourceName; - - private final File file; - - private final long startTime; - - private final RequestTrace trace; - - private long contentLength = -1; - - private long resumeOffset; - - /** - * Creates a new transfer resource with the specified properties. - * - * @param repositoryUrl The base URL of the repository, may be {@code null} or empty if unknown. If not empty, a - * trailing slash will automatically be added if missing. - * @param resourceName The relative path to the resource within the repository, may be {@code null}. A leading slash - * (if any) will be automatically removed. - * @param file The source/target file involved in the transfer, may be {@code null}. - * @param trace The trace information, may be {@code null}. - */ - public TransferResource( String repositoryUrl, String resourceName, File file, RequestTrace trace ) - { - if ( repositoryUrl == null || repositoryUrl.length() <= 0 ) - { - this.repositoryUrl = ""; - } - else if ( repositoryUrl.endsWith( "/" ) ) - { - this.repositoryUrl = repositoryUrl; - } - else - { - this.repositoryUrl = repositoryUrl + '/'; - } - - if ( resourceName == null || resourceName.length() <= 0 ) - { - this.resourceName = ""; - } - else if ( resourceName.startsWith( "/" ) ) - { - this.resourceName = resourceName.substring( 1 ); - } - else - { - this.resourceName = resourceName; - } - - this.file = file; - - this.trace = trace; - - startTime = System.currentTimeMillis(); - } - - /** - * The base URL of the repository, e.g. "http://repo1.maven.org/maven2/". Unless the URL is unknown, it will be - * terminated by a trailing slash. - * - * @return The base URL of the repository or an empty string if unknown, never {@code null}. - */ - public String getRepositoryUrl() - { - return repositoryUrl; - } - - /** - * The path of the resource relative to the repository's base URL, e.g. "org/apache/maven/maven/3.0/maven-3.0.pom". - * - * @return The path of the resource, never {@code null}. - */ - public String getResourceName() - { - return resourceName; - } - - /** - * Gets the local file being uploaded or downloaded. When the repository system merely checks for the existence of a - * remote resource, no local file will be involved in the transfer. - * - * @return The source/target file involved in the transfer or {@code null} if none. - */ - public File getFile() - { - return file; - } - - /** - * The size of the resource in bytes. Note that the size of a resource during downloads might be unknown to the - * client which is usually the case when transfers employ compression like gzip. In general, the content length is - * not known until the transfer has {@link TransferListener#transferStarted(TransferEvent) started}. - * - * @return The size of the resource in bytes or a negative value if unknown. - */ - public long getContentLength() - { - return contentLength; - } - - /** - * Sets the size of the resource in bytes. - * - * @param contentLength The size of the resource in bytes or a negative value if unknown. - * @return This resource for chaining, never {@code null}. - */ - public TransferResource setContentLength( long contentLength ) - { - this.contentLength = contentLength; - return this; - } - - /** - * Gets the byte offset within the resource from which the download starts. A positive offset indicates a previous - * download attempt is being resumed, {@code 0} means the transfer starts at the first byte. - * - * @return The zero-based index of the first byte being transferred, never negative. - */ - public long getResumeOffset() - { - return resumeOffset; - } - - /** - * Sets the byte offset within the resource at which the download starts. - * - * @param resumeOffset The zero-based index of the first byte being transferred, must not be negative. - * @return This resource for chaining, never {@code null}. - */ - public TransferResource setResumeOffset( long resumeOffset ) - { - if ( resumeOffset < 0 ) - { - throw new IllegalArgumentException( "resume offset cannot be negative" ); - } - this.resumeOffset = resumeOffset; - return this; - } - - /** - * Gets the timestamp when the transfer of this resource was started. - * - * @return The timestamp when the transfer of this resource was started. - */ - public long getTransferStartTime() - { - return startTime; - } - - /** - * Gets the trace information that describes the higher level request/operation during which this resource is - * transferred. - * - * @return The trace information about the higher level operation or {@code null} if none. - */ - public RequestTrace getTrace() - { - return trace; - } - - @Override - public String toString() - { - return getRepositoryUrl() + getResourceName() + " <> " + getFile(); - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/transfer/package-info.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/transfer/package-info.java b/aether-api/src/main/java/org/eclipse/aether/transfer/package-info.java deleted file mode 100644 index 541b244..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/transfer/package-info.java +++ /dev/null @@ -1,25 +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. - */ -/** - * A listener and various exception types dealing with the transfer of a resource between the local system and a remote - * repository. - */ -package org.eclipse.aether.transfer; - http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/version/InvalidVersionSpecificationException.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/version/InvalidVersionSpecificationException.java b/aether-api/src/main/java/org/eclipse/aether/version/InvalidVersionSpecificationException.java deleted file mode 100644 index a576844..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/version/InvalidVersionSpecificationException.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.eclipse.aether.version; - -/* - * 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 when a version or version range could not be parsed. - */ -public class InvalidVersionSpecificationException - extends RepositoryException -{ - - private final String version; - - /** - * Creates a new exception with the specified version and detail message. - * - * @param version The invalid version specification, may be {@code null}. - * @param message The detail message, may be {@code null}. - */ - public InvalidVersionSpecificationException( String version, String message ) - { - super( message ); - this.version = version; - } - - /** - * Creates a new exception with the specified version and cause. - * - * @param version The invalid version specification, may be {@code null}. - * @param cause The exception that caused this one, may be {@code null}. - */ - public InvalidVersionSpecificationException( String version, Throwable cause ) - { - super( "Could not parse version specification " + version + getMessage( ": ", cause ), cause ); - this.version = version; - } - - /** - * Creates a new exception with the specified version, detail message and cause. - * - * @param version The invalid version specification, 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 InvalidVersionSpecificationException( String version, String message, Throwable cause ) - { - super( message, cause ); - this.version = version; - } - - /** - * Gets the version or version range that could not be parsed. - * - * @return The invalid version specification or {@code null} if unknown. - */ - public String getVersion() - { - return version; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/version/Version.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/version/Version.java b/aether-api/src/main/java/org/eclipse/aether/version/Version.java deleted file mode 100644 index 41c02c0..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/version/Version.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.eclipse.aether.version; - -/* - * 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 parsed artifact version. - */ -public interface Version - extends Comparable<Version> -{ - - /** - * Gets the original string representation of the version. - * - * @return The string representation of the version, never {@code null}. - */ - String toString(); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/version/VersionConstraint.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/version/VersionConstraint.java b/aether-api/src/main/java/org/eclipse/aether/version/VersionConstraint.java deleted file mode 100644 index 1c68587..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/version/VersionConstraint.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.aether.version; - -/* - * 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 constraint on versions for a dependency. A constraint can either consist of a version range (e.g. "[1, ]") or a - * single version (e.g. "1.1"). In the first case, the constraint expresses a hard requirement on a version matching the - * range. In the second case, the constraint expresses a soft requirement on a specific version (i.e. a recommendation). - */ -public interface VersionConstraint -{ - - /** - * Gets the version range of this constraint. - * - * @return The version range or {@code null} if none. - */ - VersionRange getRange(); - - /** - * Gets the version recommended by this constraint. - * - * @return The recommended version or {@code null} if none. - */ - Version getVersion(); - - /** - * Determines whether the specified version satisfies this constraint. In more detail, a version satisfies this - * constraint if it matches its version range or if this constraint has no version range and the specified version - * equals the version recommended by the constraint. - * - * @param version The version to test, must not be {@code null}. - * @return {@code true} if the specified version satisfies this constraint, {@code false} otherwise. - */ - boolean containsVersion( Version version ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/version/VersionRange.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/version/VersionRange.java b/aether-api/src/main/java/org/eclipse/aether/version/VersionRange.java deleted file mode 100644 index e355cf5..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/version/VersionRange.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.eclipse.aether.version; - -/* - * 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 range of versions. - */ -public interface VersionRange -{ - - /** - * Determines whether the specified version is contained within this range. - * - * @param version The version to test, must not be {@code null}. - * @return {@code true} if this range contains the specified version, {@code false} otherwise. - */ - boolean containsVersion( Version version ); - - /** - * Gets a lower bound (if any) for this range. If existent, this range does not contain any version smaller than its - * lower bound. Note that complex version ranges might exclude some versions even within their bounds. - * - * @return A lower bound for this range or {@code null} is there is none. - */ - Bound getLowerBound(); - - /** - * Gets an upper bound (if any) for this range. If existent, this range does not contain any version greater than - * its upper bound. Note that complex version ranges might exclude some versions even within their bounds. - * - * @return An upper bound for this range or {@code null} is there is none. - */ - Bound getUpperBound(); - - /** - * A bound of a version range. - */ - static final class Bound - { - - private final Version version; - - private final boolean inclusive; - - /** - * Creates a new bound with the specified properties. - * - * @param version The bounding version, must not be {@code null}. - * @param inclusive A flag whether the specified version is included in the range or not. - */ - public Bound( Version version, boolean inclusive ) - { - if ( version == null ) - { - throw new IllegalArgumentException( "version missing" ); - } - this.version = version; - this.inclusive = inclusive; - } - - /** - * Gets the bounding version. - * - * @return The bounding version, never {@code null}. - */ - public Version getVersion() - { - return version; - } - - /** - * Indicates whether the bounding version is included in the range or not. - * - * @return {@code true} if the bounding version is included in the range, {@code false} if not. - */ - public boolean isInclusive() - { - return inclusive; - } - - @Override - public boolean equals( Object obj ) - { - if ( obj == this ) - { - return true; - } - else if ( obj == null || !getClass().equals( obj.getClass() ) ) - { - return false; - } - - Bound that = (Bound) obj; - return inclusive == that.inclusive && version.equals( that.version ); - } - - @Override - public int hashCode() - { - int hash = 17; - hash = hash * 31 + version.hashCode(); - hash = hash * 31 + ( inclusive ? 1 : 0 ); - return hash; - } - - @Override - public String toString() - { - return String.valueOf( version ); - } - - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/version/VersionScheme.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/version/VersionScheme.java b/aether-api/src/main/java/org/eclipse/aether/version/VersionScheme.java deleted file mode 100644 index c765a03..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/version/VersionScheme.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.eclipse.aether.version; - -/* - * 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 version scheme that handles interpretation of version strings to facilitate their comparison. - */ -public interface VersionScheme -{ - - /** - * Parses the specified version string, for example "1.0". - * - * @param version The version string to parse, must not be {@code null}. - * @return The parsed version, never {@code null}. - * @throws InvalidVersionSpecificationException If the string violates the syntax rules of this scheme. - */ - Version parseVersion( String version ) - throws InvalidVersionSpecificationException; - - /** - * Parses the specified version range specification, for example "[1.0,2.0)". - * - * @param range The range specification to parse, must not be {@code null}. - * @return The parsed version range, never {@code null}. - * @throws InvalidVersionSpecificationException If the range specification violates the syntax rules of this scheme. - */ - VersionRange parseVersionRange( String range ) - throws InvalidVersionSpecificationException; - - /** - * Parses the specified version constraint specification, for example "1.0" or "[1.0,2.0),(2.0,)". - * - * @param constraint The constraint specification to parse, must not be {@code null}. - * @return The parsed version constraint, never {@code null}. - * @throws InvalidVersionSpecificationException If the constraint specification violates the syntax rules of this - * scheme. - */ - VersionConstraint parseVersionConstraint( final String constraint ) - throws InvalidVersionSpecificationException; - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/version/package-info.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/version/package-info.java b/aether-api/src/main/java/org/eclipse/aether/version/package-info.java deleted file mode 100644 index a16dd64..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/version/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 definition of a version scheme for parsing and comparing versions. - */ -package org.eclipse.aether.version; - http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/site/site.xml ---------------------------------------------------------------------- diff --git a/aether-api/src/site/site.xml b/aether-api/src/site/site.xml deleted file mode 100644 index 033a8c4..0000000 --- a/aether-api/src/site/site.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- -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. ---> - -<project xmlns="http://maven.apache.org/DECORATION/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd" - name="API"> - <body> - <menu name="Overview"> - <item name="Introduction" href="index.html"/> - <item name="JavaDocs" href="apidocs/index.html"/> - <item name="Source Xref" href="xref/index.html"/> - <!--item name="FAQ" href="faq.html"/--> - </menu> - - <menu ref="parent"/> - <menu ref="reports"/> - </body> -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/test/java/org/eclipse/aether/AbstractForwardingRepositorySystemSessionTest.java ---------------------------------------------------------------------- diff --git a/aether-api/src/test/java/org/eclipse/aether/AbstractForwardingRepositorySystemSessionTest.java b/aether-api/src/test/java/org/eclipse/aether/AbstractForwardingRepositorySystemSessionTest.java deleted file mode 100644 index 5ad2475..0000000 --- a/aether-api/src/test/java/org/eclipse/aether/AbstractForwardingRepositorySystemSessionTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.aether; - -/* - * 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 static org.junit.Assert.*; - -import java.lang.reflect.Method; - -import org.junit.Test; - -public class AbstractForwardingRepositorySystemSessionTest -{ - - @Test - public void testAllMethodsImplemented() - throws Exception - { - for ( Method method : RepositorySystemSession.class.getMethods() ) - { - Method m = - AbstractForwardingRepositorySystemSession.class.getDeclaredMethod( method.getName(), - method.getParameterTypes() ); - assertNotNull( method.toString(), m ); - } - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/test/java/org/eclipse/aether/AbstractRepositoryListenerTest.java ---------------------------------------------------------------------- diff --git a/aether-api/src/test/java/org/eclipse/aether/AbstractRepositoryListenerTest.java b/aether-api/src/test/java/org/eclipse/aether/AbstractRepositoryListenerTest.java deleted file mode 100644 index 74c617f..0000000 --- a/aether-api/src/test/java/org/eclipse/aether/AbstractRepositoryListenerTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.eclipse.aether; - -/* - * 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 static org.junit.Assert.*; - -import java.lang.reflect.Method; - -import org.eclipse.aether.AbstractRepositoryListener; -import org.eclipse.aether.RepositoryListener; -import org.junit.Test; - -/** - */ -public class AbstractRepositoryListenerTest -{ - - @Test - public void testAllEventTypesHandled() - throws Exception - { - for ( Method method : RepositoryListener.class.getMethods() ) - { - assertNotNull( AbstractRepositoryListener.class.getDeclaredMethod( method.getName(), - method.getParameterTypes() ) ); - } - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/test/java/org/eclipse/aether/DefaultRepositoryCacheTest.java ---------------------------------------------------------------------- diff --git a/aether-api/src/test/java/org/eclipse/aether/DefaultRepositoryCacheTest.java b/aether-api/src/test/java/org/eclipse/aether/DefaultRepositoryCacheTest.java deleted file mode 100644 index ad5dfc5..0000000 --- a/aether-api/src/test/java/org/eclipse/aether/DefaultRepositoryCacheTest.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.eclipse.aether; - -/* - * 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 static org.junit.Assert.*; - -import java.util.UUID; -import java.util.concurrent.atomic.AtomicReference; - -import org.junit.Test; - -public class DefaultRepositoryCacheTest -{ - - private DefaultRepositoryCache cache = new DefaultRepositoryCache(); - - private RepositorySystemSession session = new DefaultRepositorySystemSession(); - - private Object get( Object key ) - { - return cache.get( session, key ); - } - - private void put( Object key, Object value ) - { - cache.put( session, key, value ); - } - - @Test( expected = RuntimeException.class ) - public void testGet_NullKey() - { - get( null ); - } - - @Test( expected = RuntimeException.class ) - public void testPut_NullKey() - { - put( null, "data" ); - } - - @Test - public void testGetPut() - { - Object key = "key"; - assertNull( get( key ) ); - put( key, "value" ); - assertEquals( "value", get( key ) ); - put( key, "changed" ); - assertEquals( "changed", get( key ) ); - put( key, null ); - assertNull( get( key ) ); - } - - @Test( timeout = 10000 ) - public void testConcurrency() - throws Exception - { - final AtomicReference<Throwable> error = new AtomicReference<Throwable>(); - Thread threads[] = new Thread[20]; - for ( int i = 0; i < threads.length; i++ ) - { - threads[i] = new Thread() - { - @Override - public void run() - { - for ( int i = 0; i < 100; i++ ) - { - String key = UUID.randomUUID().toString(); - try - { - put( key, Boolean.TRUE ); - assertEquals( Boolean.TRUE, get( key ) ); - } - catch ( Throwable t ) - { - error.compareAndSet( null, t ); - t.printStackTrace(); - } - } - } - }; - } - for ( Thread thread : threads ) - { - thread.start(); - } - for ( Thread thread : threads ) - { - thread.join(); - } - assertNull( String.valueOf( error.get() ), error.get() ); - } - -}