http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/TransporterFactory.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/TransporterFactory.java b/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/TransporterFactory.java deleted file mode 100644 index 999908a..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/TransporterFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.eclipse.aether.spi.connector.transport; - -/* - * 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.repository.RemoteRepository; -import org.eclipse.aether.transfer.NoTransporterException; - -/** - * A factory to create transporters. A transporter is responsible for uploads/downloads to/from a remote repository - * using a particular transport protocol. When the repository system needs a transporter for a given remote repository, - * it iterates the registered factories in descending order of their priority and calls - * {@link #newInstance(RepositorySystemSession, RemoteRepository)} on them. The first transporter returned by a factory - * will then be used for the transfer. - */ -public interface TransporterFactory -{ - - /** - * Tries to create a transporter for the specified remote repository. Typically, a factory will inspect - * {@link RemoteRepository#getProtocol()} to determine whether it can handle a repository. - * - * @param session The repository system session from which to configure the transporter, must not be {@code null}. - * In particular, a transporter should obey the timeouts configured for the session. - * @param repository The remote repository to create a transporter for, must not be {@code null}. - * @return The transporter for the given repository, never {@code null}. - * @throws NoTransporterException If the factory cannot create a transporter for the specified remote repository. - */ - Transporter newInstance( RepositorySystemSession session, RemoteRepository repository ) - throws NoTransporterException; - - /** - * The priority of this factory. When multiple factories can handle a given repository, factories with higher - * priority are preferred over those with lower priority. - * - * @return The priority of this factory. - */ - float getPriority(); - -}
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/TransporterProvider.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/TransporterProvider.java b/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/TransporterProvider.java deleted file mode 100644 index b855042..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/TransporterProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.eclipse.aether.spi.connector.transport; - -/* - * 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.repository.RemoteRepository; -import org.eclipse.aether.transfer.NoTransporterException; - -/** - * Retrieves a transporter from the installed transporter factories. - * - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface TransporterProvider -{ - - /** - * Tries to create a transporter for the specified remote repository. - * - * @param session The repository system session from which to configure the transporter, must not be {@code null}. - * @param repository The remote repository to create a transporter for, must not be {@code null}. - * @return The transporter for the given repository, never {@code null}. - * @throws NoTransporterException If none of the installed transporter factories can provide a transporter for the - * specified remote repository. - */ - Transporter newTransporter( RepositorySystemSession session, RemoteRepository repository ) - throws NoTransporterException; - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/package-info.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/package-info.java b/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/package-info.java deleted file mode 100644 index 26796ba..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/connector/transport/package-info.java +++ /dev/null @@ -1,26 +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 contract to download/upload URI-based resources using custom transport protocols. By implementing a - * {@link org.eclipse.aether.spi.connector.transport.TransporterFactory} and registering it with the repository system, - * an application enables access to remote repositories that use new URI schemes. - */ -package org.eclipse.aether.spi.connector.transport; - http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/io/FileProcessor.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/io/FileProcessor.java b/aether-spi/src/main/java/org/eclipse/aether/spi/io/FileProcessor.java deleted file mode 100644 index 1de21a0..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/io/FileProcessor.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.eclipse.aether.spi.io; - -/* - * 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 java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; - -/** - * A utility component to perform file-based operations. - */ -public interface FileProcessor -{ - - /** - * Creates the directory named by the given abstract pathname, including any necessary but nonexistent parent - * directories. Note that if this operation fails it may have succeeded in creating some of the necessary parent - * directories. - * - * @param directory The directory to create, may be {@code null}. - * @return {@code true} if and only if the directory was created, along with all necessary parent directories; - * {@code false} otherwise - */ - boolean mkdirs( File directory ); - - /** - * Writes the given data to a file. UTF-8 is assumed as encoding for the data. Creates the necessary directories for - * the target file. In case of an error, the created directories will be left on the file system. - * - * @param target The file to write to, must not be {@code null}. This file will be overwritten. - * @param data The data to write, may be {@code null}. - * @throws IOException If an I/O error occurs. - */ - void write( File target, String data ) - throws IOException; - - /** - * Writes the given stream to a file. Creates the necessary directories for the target file. In case of an error, - * the created directories will be left on the file system. - * - * @param target The file to write to, must not be {@code null}. This file will be overwritten. - * @param source The stream to write to the file, must not be {@code null}. - * @throws IOException If an I/O error occurs. - */ - void write( File target, InputStream source ) - throws IOException; - - /** - * Moves the specified source file to the given target file. If the target file already exists, it is overwritten. - * Creates the necessary directories for the target file. In case of an error, the created directories will be left - * on the file system. - * - * @param source The file to move from, must not be {@code null}. - * @param target The file to move to, must not be {@code null}. - * @throws IOException If an I/O error occurs. - */ - void move( File source, File target ) - throws IOException; - - /** - * Copies the specified source file to the given target file. Creates the necessary directories for the target file. - * In case of an error, the created directories will be left on the file system. - * - * @param source The file to copy from, must not be {@code null}. - * @param target The file to copy to, must not be {@code null}. - * @throws IOException If an I/O error occurs. - */ - void copy( File source, File target ) - throws IOException; - - /** - * Copies the specified source file to the given target file. Creates the necessary directories for the target file. - * In case of an error, the created directories will be left on the file system. - * - * @param source The file to copy from, must not be {@code null}. - * @param target The file to copy to, must not be {@code null}. - * @param listener The listener to notify about the copy progress, may be {@code null}. - * @return The number of copied bytes. - * @throws IOException If an I/O error occurs. - */ - long copy( File source, File target, ProgressListener listener ) - throws IOException; - - /** - * A listener object that is notified for every progress made while copying files. - * - * @see FileProcessor#copy(File, File, ProgressListener) - */ - public interface ProgressListener - { - - void progressed( ByteBuffer buffer ) - throws IOException; - - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/io/package-info.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/io/package-info.java b/aether-spi/src/main/java/org/eclipse/aether/spi/io/package-info.java deleted file mode 100644 index ec5c122..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/io/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. - */ -/** - * I/O related support infrastructure for components. - */ -package org.eclipse.aether.spi.io; - http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/localrepo/LocalRepositoryManagerFactory.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/localrepo/LocalRepositoryManagerFactory.java b/aether-spi/src/main/java/org/eclipse/aether/spi/localrepo/LocalRepositoryManagerFactory.java deleted file mode 100644 index 518f90e..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/localrepo/LocalRepositoryManagerFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.eclipse.aether.spi.localrepo; - -/* - * 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.repository.LocalRepository; -import org.eclipse.aether.repository.LocalRepositoryManager; -import org.eclipse.aether.repository.NoLocalRepositoryManagerException; - -/** - * A factory to create managers for the local repository. A local repository manager needs to keep track of artifacts - * and metadata and manage access. When the repository system needs a repository manager for a given local repository, - * it iterates the registered factories in descending order of their priority and calls - * {@link #newInstance(RepositorySystemSession, LocalRepository)} on them. The first manager returned by a factory will - * then be used for the local repository. - */ -public interface LocalRepositoryManagerFactory -{ - - /** - * Tries to create a repository manager for the specified local repository. The distinguishing property of a local - * repository is its {@link LocalRepository#getContentType() type}, which may for example denote the used directory - * structure. - * - * @param session The repository system session from which to configure the manager, must not be {@code null}. - * @param repository The local repository to create a manager for, must not be {@code null}. - * @return The manager for the given repository, never {@code null}. - * @throws NoLocalRepositoryManagerException If the factory cannot create a manager for the specified local - * repository. - */ - LocalRepositoryManager newInstance( RepositorySystemSession session, LocalRepository repository ) - throws NoLocalRepositoryManagerException; - - /** - * The priority of this factory. Factories with higher priority are preferred over those with lower priority. - * - * @return The priority of this factory. - */ - float getPriority(); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/localrepo/package-info.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/localrepo/package-info.java b/aether-spi/src/main/java/org/eclipse/aether/spi/localrepo/package-info.java deleted file mode 100644 index afd64cf..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/localrepo/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 contract for custom local repository implementations. - */ -package org.eclipse.aether.spi.localrepo; - http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/locator/Service.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/locator/Service.java b/aether-spi/src/main/java/org/eclipse/aether/spi/locator/Service.java deleted file mode 100644 index ffe36b0..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/locator/Service.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.eclipse.aether.spi.locator; - -/* - * 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 stateless component of the repository system. The primary purpose of this interface is to provide a convenient - * means to programmatically wire the several components of the repository system together when it is used outside of an - * IoC container. - */ -public interface Service -{ - - /** - * Provides the opportunity to initialize this service and to acquire other services for its operation from the - * locator. A service must not save the reference to the provided service locator. - * - * @param locator The service locator, must not be {@code null}. - */ - void initService( ServiceLocator locator ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/locator/ServiceLocator.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/locator/ServiceLocator.java b/aether-spi/src/main/java/org/eclipse/aether/spi/locator/ServiceLocator.java deleted file mode 100644 index 0160ac9..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/locator/ServiceLocator.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.eclipse.aether.spi.locator; - -/* - * 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.List; - -/** - * A simple infrastructure to programmatically wire the various components of the repository system together when it is - * used outside of an IoC container. Once a concrete implementation of a service locator has been setup, clients could - * use - * - * <pre> - * RepositorySystem repoSystem = serviceLocator.getService( RepositorySystem.class ); - * </pre> - * - * to acquire the repository system. Components that implement {@link Service} will be given an opportunity to acquire - * further components from the locator, thereby allowing to create the complete object graph of the repository system. - */ -public interface ServiceLocator -{ - - /** - * Gets an instance of the specified service. - * - * @param <T> The service type. - * @param type The interface describing the service, must not be {@code null}. - * @return The service instance or {@code null} if the service could not be located/initialized. - */ - <T> T getService( Class<T> type ); - - /** - * Gets all available instances of the specified service. - * - * @param <T> The service type. - * @param type The interface describing the service, must not be {@code null}. - * @return The (read-only) list of available service instances, never {@code null}. - */ - <T> List<T> getServices( Class<T> type ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/locator/package-info.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/locator/package-info.java b/aether-spi/src/main/java/org/eclipse/aether/spi/locator/package-info.java deleted file mode 100644 index 2d47ceb..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/locator/package-info.java +++ /dev/null @@ -1,31 +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 lightweight service locator infrastructure to help components acquire dependent components. The implementation of - * the repository system is decomposed into many sub components that interact with each other via interfaces, allowing - * an application to customize the system by swapping in different implementation classes for these interfaces. The - * service locator defined by this package is one means for components to get hold of the proper implementation for its - * dependencies. While not the most popular approach to component wiring, this service locator enables applications - * that do not wish to pull in more sophisticated solutions like dependency injection containers to have a small - * footprint. Therefore, all components should implement {@link org.eclipse.aether.spi.locator.Service} to support this - * goal. - */ -package org.eclipse.aether.spi.locator; - http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/log/Logger.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/log/Logger.java b/aether-spi/src/main/java/org/eclipse/aether/spi/log/Logger.java deleted file mode 100644 index 8b4bfb3..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/log/Logger.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.aether.spi.log; - -/* - * 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 simple logger to facilitate emission of diagnostic messages. In general, unrecoverable errors should be reported - * via exceptions and informational notifications should be reported via events, hence this logger interface focuses on - * support for tracing. - */ -public interface Logger -{ - - /** - * Indicates whether debug logging is enabled. - * - * @return {@code true} if debug logging is enabled, {@code false} otherwise. - */ - boolean isDebugEnabled(); - - /** - * Emits the specified message. - * - * @param msg The message to log, must not be {@code null}. - */ - void debug( String msg ); - - /** - * Emits the specified message along with a stack trace of the given exception. - * - * @param msg The message to log, must not be {@code null}. - * @param error The exception to log, may be {@code null}. - */ - void debug( String msg, Throwable error ); - - /** - * Indicates whether warn logging is enabled. - * - * @return {@code true} if warn logging is enabled, {@code false} otherwise. - */ - boolean isWarnEnabled(); - - /** - * Emits the specified message. - * - * @param msg The message to log, must not be {@code null}. - */ - void warn( String msg ); - - /** - * Emits the specified message along with a stack trace of the given exception. - * - * @param msg The message to log, must not be {@code null}. - * @param error The exception to log, may be {@code null}. - */ - void warn( String msg, Throwable error ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/log/LoggerFactory.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/log/LoggerFactory.java b/aether-spi/src/main/java/org/eclipse/aether/spi/log/LoggerFactory.java deleted file mode 100644 index 9f66eb1..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/log/LoggerFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.eclipse.aether.spi.log; - -/* - * 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 factory to create loggers. - */ -public interface LoggerFactory -{ - - /** - * Gets a logger for a class with the specified name. - * - * @param name The name of the class requesting a logger, must not be {@code null}. - * @return The requested logger, never {@code null}. - */ - Logger getLogger( String name ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/log/NullLogger.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/log/NullLogger.java b/aether-spi/src/main/java/org/eclipse/aether/spi/log/NullLogger.java deleted file mode 100644 index 8fb7745..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/log/NullLogger.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.eclipse.aether.spi.log; - -/* - * 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 logger that disables any logging. - */ -final class NullLogger - implements Logger -{ - - public boolean isDebugEnabled() - { - return false; - } - - public void debug( String msg ) - { - } - - public void debug( String msg, Throwable error ) - { - } - - public boolean isWarnEnabled() - { - return false; - } - - public void warn( String msg ) - { - } - - public void warn( String msg, Throwable error ) - { - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/log/NullLoggerFactory.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/log/NullLoggerFactory.java b/aether-spi/src/main/java/org/eclipse/aether/spi/log/NullLoggerFactory.java deleted file mode 100644 index bea659f..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/log/NullLoggerFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.eclipse.aether.spi.log; - -/* - * 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 logger factory that disables any logging. - */ -public final class NullLoggerFactory - implements LoggerFactory -{ - - /** - * The singleton instance of this factory. - */ - public static final LoggerFactory INSTANCE = new NullLoggerFactory(); - - /** - * The singleton logger used by this factory. - */ - public static final Logger LOGGER = new NullLogger(); - - public Logger getLogger( String name ) - { - return LOGGER; - } - - private NullLoggerFactory() - { - // hide constructor - } - - /** - * Gets a logger from the specified factory for the given class, falling back to a logger from this factory if the - * specified factory is {@code null} or fails to provide a logger. - * - * @param loggerFactory The logger factory from which to get the logger, may be {@code null}. - * @param type The class for which to get the logger, must not be {@code null}. - * @return The requested logger, never {@code null}. - */ - public static Logger getSafeLogger( LoggerFactory loggerFactory, Class<?> type ) - { - if ( loggerFactory == null ) - { - return LOGGER; - } - Logger logger = loggerFactory.getLogger( type.getName() ); - if ( logger == null ) - { - return LOGGER; - } - return logger; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/main/java/org/eclipse/aether/spi/log/package-info.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/main/java/org/eclipse/aether/spi/log/package-info.java b/aether-spi/src/main/java/org/eclipse/aether/spi/log/package-info.java deleted file mode 100644 index 9584292..0000000 --- a/aether-spi/src/main/java/org/eclipse/aether/spi/log/package-info.java +++ /dev/null @@ -1,28 +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 simple logging infrastructure for diagnostic messages. The primary purpose of the - * {@link org.eclipse.aether.spi.log.LoggerFactory} defined here is to avoid a mandatory dependency on a 3rd party - * logging system/facade. Some applications might find the events fired by the repository system sufficient and prefer - * a small footprint. Components that do not share this concern are free to ignore this package and directly employ - * whatever logging system they desire. - */ -package org.eclipse.aether.spi.log; - http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-spi/src/site/site.xml ---------------------------------------------------------------------- diff --git a/aether-spi/src/site/site.xml b/aether-spi/src/site/site.xml deleted file mode 100644 index 27a4aac..0000000 --- a/aether-spi/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="SPI"> - <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-spi/src/test/java/org/eclipse/aether/spi/connector/layout/ChecksumTest.java ---------------------------------------------------------------------- diff --git a/aether-spi/src/test/java/org/eclipse/aether/spi/connector/layout/ChecksumTest.java b/aether-spi/src/test/java/org/eclipse/aether/spi/connector/layout/ChecksumTest.java deleted file mode 100644 index bcd49b4..0000000 --- a/aether-spi/src/test/java/org/eclipse/aether/spi/connector/layout/ChecksumTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.eclipse.aether.spi.connector.layout; - -/* - * 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.net.URI; - -import org.junit.Test; - -import org.eclipse.aether.spi.connector.layout.RepositoryLayout.Checksum; - -public class ChecksumTest -{ - - @Test - public void testForLocation() - { - Checksum cs = Checksum.forLocation( URI.create( "dir/sub%20dir/file.txt" ), "SHA-1" ); - assertEquals( "SHA-1", cs.getAlgorithm() ); - assertEquals( "dir/sub%20dir/file.txt.sha1", cs.getLocation().toString() ); - - cs = Checksum.forLocation( URI.create( "dir/sub%20dir/file.txt" ), "MD5" ); - assertEquals( "MD5", cs.getAlgorithm() ); - assertEquals( "dir/sub%20dir/file.txt.md5", cs.getLocation().toString() ); - } - - @Test( expected = IllegalArgumentException.class ) - public void testForLocation_WithQueryParams() - { - Checksum.forLocation( URI.create( "file.php?param=1" ), "SHA-1" ); - } - - @Test( expected = IllegalArgumentException.class ) - public void testForLocation_WithFragment() - { - Checksum.forLocation( URI.create( "file.html#fragment" ), "SHA-1" ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-test-util/pom.xml ---------------------------------------------------------------------- diff --git a/aether-test-util/pom.xml b/aether-test-util/pom.xml deleted file mode 100644 index 118a51a..0000000 --- a/aether-test-util/pom.xml +++ /dev/null @@ -1,59 +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/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.maven.aether</groupId> - <artifactId>aether</artifactId> - <version>1.0.3-SNAPSHOT</version> - </parent> - - <artifactId>aether-test-util</artifactId> - - <name>Aether Test Utilities</name> - <description> - A collection of utility classes to ease testing of the repository system. - </description> - - <dependencies> - <dependency> - <groupId>org.apache.maven.aether</groupId> - <artifactId>aether-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.maven.aether</groupId> - <artifactId>aether-spi</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-library</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/ArtifactDefinition.java ---------------------------------------------------------------------- diff --git a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/ArtifactDefinition.java b/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/ArtifactDefinition.java deleted file mode 100644 index 0a760cc..0000000 --- a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/ArtifactDefinition.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.eclipse.aether.internal.test.util; - -/* - * 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. - */ - -class ArtifactDefinition -{ - private String groupId; - - private String artifactId; - - private String extension; - - private String version; - - private String scope = ""; - - private String definition; - - private String id; - - private String reference; - - private Boolean optional; - - public ArtifactDefinition( String def ) - { - this.definition = def.trim(); - - if ( definition.startsWith( "(" ) ) - { - int idx = definition.indexOf( ')' ); - this.id = definition.substring( 1, idx ); - this.definition = definition.substring( idx + 1 ); - } - else if ( definition.startsWith( "^" ) ) - { - this.reference = definition.substring( 1 ); - return; - } - - String[] split = definition.split( ":" ); - if ( split.length < 4 ) - { - throw new IllegalArgumentException( "Need definition like 'gid:aid:ext:ver[:scope]', but was: " - + definition ); - } - groupId = split[0]; - artifactId = split[1]; - extension = split[2]; - version = split[3]; - if ( split.length > 4 ) - { - scope = split[4]; - } - if ( split.length > 5 ) - { - if ( "optional".equalsIgnoreCase( split[5] ) ) - { - optional = true; - } - else if ( "!optional".equalsIgnoreCase( split[5] ) ) - { - optional = false; - } - } - } - - public String getGroupId() - { - return groupId; - } - - public String getArtifactId() - { - return artifactId; - } - - public String getExtension() - { - return extension; - } - - public String getVersion() - { - return version; - } - - public String getScope() - { - return scope; - } - - @Override - public String toString() - { - return definition; - } - - public String getId() - { - return id; - } - - public String getReference() - { - return reference; - } - - public boolean isReference() - { - return reference != null; - } - - public boolean hasId() - { - return id != null; - } - - public Boolean getOptional() - { - return optional; - } -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/ArtifactDescription.java ---------------------------------------------------------------------- diff --git a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/ArtifactDescription.java b/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/ArtifactDescription.java deleted file mode 100644 index bdb5c7f..0000000 --- a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/ArtifactDescription.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.eclipse.aether.internal.test.util; - -/* - * 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.List; - -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.graph.Dependency; -import org.eclipse.aether.repository.RemoteRepository; - -/** - */ -class ArtifactDescription -{ - - private List<RemoteRepository> repositories; - - private List<Dependency> managedDependencies; - - private List<Dependency> dependencies; - - private Artifact relocation; - - ArtifactDescription( Artifact relocation, List<Dependency> dependencies, List<Dependency> managedDependencies, - List<RemoteRepository> repositories ) - { - this.relocation = relocation; - this.dependencies = dependencies; - this.managedDependencies = managedDependencies; - this.repositories = repositories; - } - - public Artifact getRelocation() - { - return relocation; - } - - public List<RemoteRepository> getRepositories() - { - return repositories; - } - - public List<Dependency> getManagedDependencies() - { - return managedDependencies; - } - - public List<Dependency> getDependencies() - { - return dependencies; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/DependencyGraphParser.java ---------------------------------------------------------------------- diff --git a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/DependencyGraphParser.java b/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/DependencyGraphParser.java deleted file mode 100644 index a745ccf..0000000 --- a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/DependencyGraphParser.java +++ /dev/null @@ -1,555 +0,0 @@ -package org.eclipse.aether.internal.test.util; - -/* - * 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.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.artifact.DefaultArtifact; -import org.eclipse.aether.graph.DefaultDependencyNode; -import org.eclipse.aether.graph.Dependency; -import org.eclipse.aether.graph.DependencyNode; -import org.eclipse.aether.version.InvalidVersionSpecificationException; -import org.eclipse.aether.version.VersionScheme; - -/** - * Creates a dependency graph from a text description. <h2>Definition</h2> Each (non-empty) line in the input defines - * one node of the resulting graph: - * - * <pre> - * line ::= (indent? ("(null)" | node | reference))? comment? - * comment ::= "#" rest-of-line - * indent ::= "| "* ("+" | "\\") "- " - * reference ::= "^" id - * node ::= coords (range)? space (scope("<" premanagedScope)?)? space "optional"? space ("relocations=" coords ("," coords)*)? ("(" id ")")? - * coords ::= groupId ":" artifactId (":" extension (":" classifier)?)? ":" version - * </pre> - * - * The special token {@code (null)} may be used to indicate an "empty" root node with no dependency. - * <p> - * If {@code indent} is empty, the line defines the root node. Only one root node may be defined. The level is - * calculated by the distance from the beginning of the line. One level is three characters of indentation. - * <p> - * The {@code ^id} syntax allows to reuse a previously built node to share common sub graphs among different parent - * nodes. - * <h2>Example</h2> - * - * <pre> - * gid:aid:ver - * +- gid:aid2:ver scope - * | \- gid:aid3:ver (id1) # assign id for reference below - * +- gid:aid4:ext:ver scope - * \- ^id1 # reuse previous node - * </pre> - * - * <h2>Multiple definitions in one resource</h2> - * <p> - * By using {@link #parseMultiResource(String)}, definitions divided by a line beginning with "---" can be read from the - * same resource. The rest of the line is ignored. - * <h2>Substitutions</h2> - * <p> - * You may define substitutions (see {@link #setSubstitutions(String...)}, - * {@link #DependencyGraphParser(String, Collection)}). Every '%s' in the definition will be substituted by the next - * String in the defined substitutions. - * <h3>Example</h3> - * - * <pre> - * parser.setSubstitutions( "foo", "bar" ); - * String def = "gid:%s:ext:ver\n" + "+- gid:%s:ext:ver"; - * </pre> - * - * The first node will have "foo" as its artifact id, the second node (child to the first) will have "bar" as its - * artifact id. - */ -public class DependencyGraphParser -{ - - private final VersionScheme versionScheme; - - private final String prefix; - - private Collection<String> substitutions; - - /** - * Create a parser with the given prefix and the given substitution strings. - * - * @see DependencyGraphParser#parseResource(String) - */ - public DependencyGraphParser( String prefix, Collection<String> substitutions ) - { - this.prefix = prefix; - this.substitutions = substitutions; - versionScheme = new TestVersionScheme(); - } - - /** - * Create a parser with the given prefix. - * - * @see DependencyGraphParser#parseResource(String) - */ - public DependencyGraphParser( String prefix ) - { - this( prefix, Collections.<String>emptyList() ); - } - - /** - * Create a parser with an empty prefix. - */ - public DependencyGraphParser() - { - this( "" ); - } - - /** - * Parse the given graph definition. - */ - public DependencyNode parseLiteral( String dependencyGraph ) - throws IOException - { - BufferedReader reader = new BufferedReader( new StringReader( dependencyGraph ) ); - DependencyNode node = parse( reader ); - reader.close(); - return node; - } - - /** - * Parse the graph definition read from the given classpath resource. If a prefix is set, this method will load the - * resource from 'prefix + resource'. - */ - public DependencyNode parseResource( String resource ) - throws IOException - { - URL res = this.getClass().getClassLoader().getResource( prefix + resource ); - if ( res == null ) - { - throw new IOException( "Could not find classpath resource " + prefix + resource ); - } - return parse( res ); - } - - /** - * Parse multiple graphs in one resource, divided by "---". - */ - public List<DependencyNode> parseMultiResource( String resource ) - throws IOException - { - URL res = this.getClass().getClassLoader().getResource( prefix + resource ); - if ( res == null ) - { - throw new IOException( "Could not find classpath resource " + prefix + resource ); - } - - BufferedReader reader = new BufferedReader( new InputStreamReader( res.openStream(), "UTF-8" ) ); - - List<DependencyNode> ret = new ArrayList<DependencyNode>(); - DependencyNode root = null; - while ( ( root = parse( reader ) ) != null ) - { - ret.add( root ); - } - return ret; - } - - /** - * Parse the graph definition read from the given URL. - */ - public DependencyNode parse( URL resource ) - throws IOException - { - InputStream stream = null; - try - { - stream = resource.openStream(); - return parse( new BufferedReader( new InputStreamReader( stream, "UTF-8" ) ) ); - } - finally - { - if ( stream != null ) - { - stream.close(); - } - } - } - - private DependencyNode parse( BufferedReader in ) - throws IOException - { - Iterator<String> substitutionIterator = ( substitutions != null ) ? substitutions.iterator() : null; - - String line = null; - - DependencyNode root = null; - DependencyNode node = null; - int prevLevel = 0; - - Map<String, DependencyNode> nodes = new HashMap<String, DependencyNode>(); - LinkedList<DependencyNode> stack = new LinkedList<DependencyNode>(); - boolean isRootNode = true; - - while ( ( line = in.readLine() ) != null ) - { - line = cutComment( line ); - - if ( isEmpty( line ) ) - { - // skip empty line - continue; - } - - if ( isEOFMarker( line ) ) - { - // stop parsing - break; - } - - while ( line.contains( "%s" ) ) - { - if ( !substitutionIterator.hasNext() ) - { - throw new IllegalArgumentException( "not enough substitutions to fill placeholders" ); - } - line = line.replaceFirst( "%s", substitutionIterator.next() ); - } - - LineContext ctx = createContext( line ); - if ( prevLevel < ctx.getLevel() ) - { - // previous node is new parent - stack.add( node ); - } - - // get to real parent - while ( prevLevel > ctx.getLevel() ) - { - stack.removeLast(); - prevLevel -= 1; - } - - prevLevel = ctx.getLevel(); - - if ( ctx.getDefinition() != null && ctx.getDefinition().reference != null ) - { - String reference = ctx.getDefinition().reference; - DependencyNode child = nodes.get( reference ); - if ( child == null ) - { - throw new IllegalArgumentException( "undefined reference " + reference ); - } - node.getChildren().add( child ); - } - else - { - - node = build( isRootNode ? null : stack.getLast(), ctx, isRootNode ); - - if ( isRootNode ) - { - root = node; - isRootNode = false; - } - - if ( ctx.getDefinition() != null && ctx.getDefinition().id != null ) - { - nodes.put( ctx.getDefinition().id, node ); - } - } - } - - return root; - } - - private boolean isEOFMarker( String line ) - { - return line.startsWith( "---" ); - } - - private static boolean isEmpty( String line ) - { - return line == null || line.length() == 0; - } - - private static String cutComment( String line ) - { - int idx = line.indexOf( '#' ); - - if ( idx != -1 ) - { - line = line.substring( 0, idx ); - } - - return line; - } - - private DependencyNode build( DependencyNode parent, LineContext ctx, boolean isRoot ) - { - NodeDefinition def = ctx.getDefinition(); - if ( !isRoot && parent == null ) - { - throw new IllegalArgumentException( "dangling node: " + def ); - } - else if ( ctx.getLevel() == 0 && parent != null ) - { - throw new IllegalArgumentException( "inconsistent leveling (parent for level 0?): " + def ); - } - - DefaultDependencyNode node; - if ( def != null ) - { - DefaultArtifact artifact = new DefaultArtifact( def.coords, def.properties ); - Dependency dependency = new Dependency( artifact, def.scope, def.optional ); - node = new DefaultDependencyNode( dependency ); - int managedBits = 0; - if ( def.premanagedScope != null ) - { - managedBits |= DependencyNode.MANAGED_SCOPE; - node.setData( "premanaged.scope", def.premanagedScope ); - } - if ( def.premanagedVersion != null ) - { - managedBits |= DependencyNode.MANAGED_VERSION; - node.setData( "premanaged.version", def.premanagedVersion ); - } - node.setManagedBits( managedBits ); - if ( def.relocations != null ) - { - List<Artifact> relocations = new ArrayList<Artifact>(); - for ( String relocation : def.relocations ) - { - relocations.add( new DefaultArtifact( relocation ) ); - } - node.setRelocations( relocations ); - } - try - { - node.setVersion( versionScheme.parseVersion( artifact.getVersion() ) ); - node.setVersionConstraint( versionScheme.parseVersionConstraint( def.range != null ? def.range - : artifact.getVersion() ) ); - } - catch ( InvalidVersionSpecificationException e ) - { - throw new IllegalArgumentException( "bad version: " + e.getMessage(), e ); - } - } - else - { - node = new DefaultDependencyNode( (Dependency) null ); - } - - if ( parent != null ) - { - parent.getChildren().add( node ); - } - - return node; - } - - public String dump( DependencyNode root ) - { - StringBuilder ret = new StringBuilder(); - - List<NodeEntry> entries = new ArrayList<NodeEntry>(); - - addNode( root, 0, entries ); - - for ( NodeEntry nodeEntry : entries ) - { - char[] level = new char[( nodeEntry.getLevel() * 3 )]; - Arrays.fill( level, ' ' ); - - if ( level.length != 0 ) - { - level[level.length - 3] = '+'; - level[level.length - 2] = '-'; - } - - String definition = nodeEntry.getDefinition(); - - ret.append( level ).append( definition ).append( "\n" ); - } - - return ret.toString(); - - } - - private void addNode( DependencyNode root, int level, List<NodeEntry> entries ) - { - - NodeEntry entry = new NodeEntry(); - Dependency dependency = root.getDependency(); - StringBuilder defBuilder = new StringBuilder(); - if ( dependency == null ) - { - defBuilder.append( "(null)" ); - } - else - { - Artifact artifact = dependency.getArtifact(); - - defBuilder.append( artifact.getGroupId() ).append( ":" ).append( artifact.getArtifactId() ).append( ":" ).append( artifact.getExtension() ).append( ":" ).append( artifact.getVersion() ); - if ( dependency.getScope() != null && ( !"".equals( dependency.getScope() ) ) ) - { - defBuilder.append( ":" ).append( dependency.getScope() ); - } - - Map<String, String> properties = artifact.getProperties(); - if ( !( properties == null || properties.isEmpty() ) ) - { - for ( Map.Entry<String, String> prop : properties.entrySet() ) - { - defBuilder.append( ";" ).append( prop.getKey() ).append( "=" ).append( prop.getValue() ); - } - } - } - - entry.setDefinition( defBuilder.toString() ); - entry.setLevel( level++ ); - - entries.add( entry ); - - for ( DependencyNode node : root.getChildren() ) - { - addNode( node, level, entries ); - } - - } - - class NodeEntry - { - int level; - - String definition; - - Map<String, String> properties; - - public int getLevel() - { - return level; - } - - public void setLevel( int level ) - { - this.level = level; - } - - public String getDefinition() - { - return definition; - } - - public void setDefinition( String definition ) - { - this.definition = definition; - } - - public Map<String, String> getProperties() - { - return properties; - } - - public void setProperties( Map<String, String> properties ) - { - this.properties = properties; - } - } - - private static LineContext createContext( String line ) - { - LineContext ctx = new LineContext(); - String definition; - - String[] split = line.split( "- " ); - if ( split.length == 1 ) // root - { - ctx.setLevel( 0 ); - definition = split[0]; - } - else - { - ctx.setLevel( (int) Math.ceil( (double) split[0].length() / (double) 3 ) ); - definition = split[1]; - } - - if ( "(null)".equalsIgnoreCase( definition ) ) - { - return ctx; - } - - ctx.setDefinition( new NodeDefinition( definition ) ); - - return ctx; - } - - static class LineContext - { - NodeDefinition definition; - - int level; - - public NodeDefinition getDefinition() - { - return definition; - } - - public void setDefinition( NodeDefinition definition ) - { - this.definition = definition; - } - - public int getLevel() - { - return level; - } - - public void setLevel( int level ) - { - this.level = level; - } - } - - public Collection<String> getSubstitutions() - { - return substitutions; - } - - public void setSubstitutions( Collection<String> substitutions ) - { - this.substitutions = substitutions; - } - - public void setSubstitutions( String... substitutions ) - { - setSubstitutions( Arrays.asList( substitutions ) ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/IniArtifactDataReader.java ---------------------------------------------------------------------- diff --git a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/IniArtifactDataReader.java b/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/IniArtifactDataReader.java deleted file mode 100644 index 4253544..0000000 --- a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/IniArtifactDataReader.java +++ /dev/null @@ -1,382 +0,0 @@ -package org.eclipse.aether.internal.test.util; - -/* - * 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.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.artifact.DefaultArtifact; -import org.eclipse.aether.graph.Dependency; -import org.eclipse.aether.graph.Exclusion; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * @see IniArtifactDescriptorReader - */ -class IniArtifactDataReader -{ - - private String prefix = ""; - - /** - * Constructs a data reader with the prefix {@code ""}. - */ - public IniArtifactDataReader() - { - this( "" ); - } - - /** - * Constructs a data reader with the given prefix. - * - * @param prefix the prefix to use for loading resources from the classpath. - */ - public IniArtifactDataReader( String prefix ) - { - this.prefix = prefix; - - } - - /** - * Load an artifact description from the classpath and parse it. - */ - public ArtifactDescription parse( String resource ) - throws IOException - { - URL res = this.getClass().getClassLoader().getResource( prefix + resource ); - - if ( res == null ) - { - throw new IOException( "cannot find resource: " + resource ); - } - return parse( res ); - } - - /** - * Open the given URL and parse ist. - */ - public ArtifactDescription parse( URL res ) - throws IOException - { - return parse( new InputStreamReader( res.openStream(), "UTF-8" ) ); - } - - /** - * Parse the given String. - */ - public ArtifactDescription parseLiteral( String description ) - throws IOException - { - StringReader reader = new StringReader( description ); - return parse( reader ); - } - - private enum State - { - NONE, RELOCATION, DEPENDENCIES, MANAGEDDEPENDENCIES, REPOSITORIES - } - - private ArtifactDescription parse( Reader reader ) - throws IOException - { - String line = null; - - State state = State.NONE; - - Map<State, List<String>> sections = new HashMap<State, List<String>>(); - - BufferedReader in = new BufferedReader( reader ); - try - { - while ( ( line = in.readLine() ) != null ) - { - - line = cutComment( line ); - if ( isEmpty( line ) ) - { - continue; - } - - if ( line.startsWith( "[" ) ) - { - try - { - String name = line.substring( 1, line.length() - 1 ); - name = name.replace( "-", "" ).toUpperCase( Locale.ENGLISH ); - state = State.valueOf( name ); - sections.put( state, new ArrayList<String>() ); - } - catch ( IllegalArgumentException e ) - { - throw new IOException( "unknown section: " + line ); - } - } - else - { - List<String> lines = sections.get( state ); - if ( lines == null ) - { - throw new IOException( "missing section: " + line ); - } - lines.add( line.trim() ); - } - } - } - finally - { - in.close(); - } - - Artifact relocation = relocation( sections.get( State.RELOCATION ) ); - List<Dependency> dependencies = dependencies( sections.get( State.DEPENDENCIES ), false ); - List<Dependency> managedDependencies = dependencies( sections.get( State.MANAGEDDEPENDENCIES ), true ); - List<RemoteRepository> repositories = repositories( sections.get( State.REPOSITORIES ) ); - - ArtifactDescription description = - new ArtifactDescription( relocation, dependencies, managedDependencies, repositories ); - return description; - } - - private List<RemoteRepository> repositories( List<String> list ) - { - ArrayList<RemoteRepository> ret = new ArrayList<RemoteRepository>(); - if ( list == null ) - { - return ret; - } - for ( String coords : list ) - { - String[] split = coords.split( ":", 3 ); - String id = split[0]; - String type = split[1]; - String url = split[2]; - - ret.add( new RemoteRepository.Builder( id, type, url ).build() ); - } - return ret; - } - - private List<Dependency> dependencies( List<String> list, boolean managed ) - { - List<Dependency> ret = new ArrayList<Dependency>(); - if ( list == null ) - { - return ret; - } - - Collection<Exclusion> exclusions = new ArrayList<Exclusion>(); - - Boolean optional = null; - Artifact artifact = null; - String scope = null; - - for ( String coords : list ) - { - if ( coords.startsWith( "-" ) ) - { - coords = coords.substring( 1 ); - String[] split = coords.split( ":" ); - exclusions.add( new Exclusion( split[0], split[1], "*", "*" ) ); - } - else - { - if ( artifact != null ) - { - // commit dependency - Dependency dep = new Dependency( artifact, scope, optional, exclusions ); - ret.add( dep ); - - exclusions = new ArrayList<Exclusion>(); - } - - ArtifactDefinition def = new ArtifactDefinition( coords ); - - optional = managed ? def.getOptional() : Boolean.valueOf( Boolean.TRUE.equals( def.getOptional() ) ); - - scope = "".equals( def.getScope() ) && !managed ? "compile" : def.getScope(); - - artifact = - new DefaultArtifact( def.getGroupId(), def.getArtifactId(), "", def.getExtension(), - def.getVersion() ); - } - } - if ( artifact != null ) - { - // commit dependency - Dependency dep = new Dependency( artifact, scope, optional, exclusions ); - ret.add( dep ); - } - - return ret; - } - - private Artifact relocation( List<String> list ) - { - if ( list == null || list.isEmpty() ) - { - return null; - } - String coords = list.get( 0 ); - ArtifactDefinition def = new ArtifactDefinition( coords ); - return new DefaultArtifact( def.getGroupId(), def.getArtifactId(), "", def.getExtension(), def.getVersion() ); - } - - private static boolean isEmpty( String line ) - { - return line == null || line.length() == 0; - } - - private static String cutComment( String line ) - { - int idx = line.indexOf( '#' ); - - if ( idx != -1 ) - { - line = line.substring( 0, idx ); - } - - return line; - } - - static class Definition - { - private String groupId; - - private String artifactId; - - private String extension; - - private String version; - - private String scope = ""; - - private String definition; - - private String id = null; - - private String reference = null; - - private boolean optional = false; - - public Definition( String def ) - { - this.definition = def.trim(); - - if ( definition.startsWith( "(" ) ) - { - int idx = definition.indexOf( ')' ); - this.id = definition.substring( 1, idx ); - this.definition = definition.substring( idx + 1 ); - } - else if ( definition.startsWith( "^" ) ) - { - this.reference = definition.substring( 1 ); - return; - } - - String[] split = definition.split( ":" ); - if ( split.length < 4 ) - { - throw new IllegalArgumentException( "Need definition like 'gid:aid:ext:ver[:scope]', but was: " - + definition ); - } - groupId = split[0]; - artifactId = split[1]; - extension = split[2]; - version = split[3]; - if ( split.length > 4 ) - { - scope = split[4]; - } - if ( split.length > 5 && "true".equalsIgnoreCase( split[5] ) ) - { - optional = true; - } - } - - public String getGroupId() - { - return groupId; - } - - public String getArtifactId() - { - return artifactId; - } - - public String getType() - { - return extension; - } - - public String getVersion() - { - return version; - } - - public String getScope() - { - return scope; - } - - @Override - public String toString() - { - return definition; - } - - public String getId() - { - return id; - } - - public String getReference() - { - return reference; - } - - public boolean isReference() - { - return reference != null; - } - - public boolean hasId() - { - return id != null; - } - - public boolean isOptional() - { - return optional; - } - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/IniArtifactDescriptorReader.java ---------------------------------------------------------------------- diff --git a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/IniArtifactDescriptorReader.java b/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/IniArtifactDescriptorReader.java deleted file mode 100644 index 4efe880..0000000 --- a/aether-test-util/src/main/java/org/eclipse/aether/internal/test/util/IniArtifactDescriptorReader.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.eclipse.aether.internal.test.util; - -/* - * 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.resolution.ArtifactDescriptorException; -import org.eclipse.aether.resolution.ArtifactDescriptorRequest; -import org.eclipse.aether.resolution.ArtifactDescriptorResult; - -/** - * An artifact descriptor reader that gets data from a simple text file on the classpath. The data file for an artifact - * with the coordinates {@code gid:aid:ext:ver} is expected to be named {@code gid_aid_ver.ini} and can optionally have - * some prefix. The data file can have the following sections: - * <ul> - * <li>relocation</li> - * <li>dependencies</li> - * <li>managedDependencies</li> - * <li>repositories</li> - * </ul> - * The relocation and dependency sections contain artifact coordinates of the form: - * - * <pre> - * gid:aid:ext:ver[:scope][:optional] - * </pre> - * - * The dependency sections may also specify exclusions: - * - * <pre> - * -gid:aid - * </pre> - * - * A repository definition is of the form: - * - * <pre> - * id:type:url - * </pre> - * - * <h2>Example</h2> - * - * <pre> - * [relocation] - * gid:aid:ext:ver - * - * [dependencies] - * gid:aid:ext:ver:scope - * -exclusion:aid - * gid:aid2:ext:ver:scope:optional - * - * [managed-dependencies] - * gid:aid2:ext:ver2:scope - * -gid:aid - * -gid:aid - * - * [repositories] - * id:type:file:///test-repo - * </pre> - */ -public class IniArtifactDescriptorReader -{ - private IniArtifactDataReader reader; - - /** - * Use the given prefix to load the artifact descriptions from the classpath. - */ - public IniArtifactDescriptorReader( String prefix ) - { - reader = new IniArtifactDataReader( prefix ); - } - - /** - * Parses the resource {@code $prefix/gid_aid_ver.ini} from the request artifact as an artifact description and - * wraps it into an ArtifactDescriptorResult. - */ - public ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session, - ArtifactDescriptorRequest request ) - throws ArtifactDescriptorException - { - ArtifactDescriptorResult result = new ArtifactDescriptorResult( request ); - for ( Artifact artifact = request.getArtifact();; ) - { - String resourceName = - String.format( "%s_%s_%s.ini", artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); - try - { - ArtifactDescription data = reader.parse( resourceName ); - if ( data.getRelocation() != null ) - { - result.addRelocation( artifact ); - artifact = data.getRelocation(); - } - else - { - result.setArtifact( artifact ); - result.setDependencies( data.getDependencies() ); - result.setManagedDependencies( data.getManagedDependencies() ); - result.setRepositories( data.getRepositories() ); - return result; - } - } - catch ( Exception e ) - { - throw new ArtifactDescriptorException( result, e.getMessage(), e ); - } - } - } - -}