Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9B982200C21 for ; Sun, 15 Jan 2017 20:23:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 9A666160B32; Sun, 15 Jan 2017 19:23:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 92D27160B4F for ; Sun, 15 Jan 2017 20:23:47 +0100 (CET) Received: (qmail 38671 invoked by uid 500); 15 Jan 2017 19:23:39 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 34526 invoked by uid 99); 15 Jan 2017 19:23:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Jan 2017 19:23:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C26A7E947B; Sun, 15 Jan 2017 19:23:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hboutemy@apache.org To: commits@maven.apache.org Date: Sun, 15 Jan 2017 19:24:23 -0000 Message-Id: In-Reply-To: <805a49320ef143988d626fd421af1ea3@git.apache.org> References: <805a49320ef143988d626fd421af1ea3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [49/53] [abbrv] [partial] maven-resolver git commit: [MNG-6007] renamed Aether to Maven Artifact Resolver archived-at: Sun, 15 Jan 2017 19:23:49 -0000 http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/RepositorySystem.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/RepositorySystem.java b/aether-api/src/main/java/org/eclipse/aether/RepositorySystem.java deleted file mode 100644 index 8706f89..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/RepositorySystem.java +++ /dev/null @@ -1,277 +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 java.util.Collection; -import java.util.List; - -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.collection.CollectRequest; -import org.eclipse.aether.collection.CollectResult; -import org.eclipse.aether.collection.DependencyCollectionException; -import org.eclipse.aether.deployment.DeployRequest; -import org.eclipse.aether.deployment.DeployResult; -import org.eclipse.aether.deployment.DeploymentException; -import org.eclipse.aether.installation.InstallRequest; -import org.eclipse.aether.installation.InstallResult; -import org.eclipse.aether.installation.InstallationException; -import org.eclipse.aether.metadata.Metadata; -import org.eclipse.aether.repository.LocalRepository; -import org.eclipse.aether.repository.LocalRepositoryManager; -import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.resolution.ArtifactDescriptorException; -import org.eclipse.aether.resolution.ArtifactDescriptorRequest; -import org.eclipse.aether.resolution.ArtifactDescriptorResult; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResolutionException; -import org.eclipse.aether.resolution.ArtifactResult; -import org.eclipse.aether.resolution.DependencyRequest; -import org.eclipse.aether.resolution.DependencyResolutionException; -import org.eclipse.aether.resolution.DependencyResult; -import org.eclipse.aether.resolution.MetadataRequest; -import org.eclipse.aether.resolution.MetadataResult; -import org.eclipse.aether.resolution.VersionRangeRequest; -import org.eclipse.aether.resolution.VersionRangeResolutionException; -import org.eclipse.aether.resolution.VersionRangeResult; -import org.eclipse.aether.resolution.VersionRequest; -import org.eclipse.aether.resolution.VersionResolutionException; -import org.eclipse.aether.resolution.VersionResult; - -/** - * The main entry point to the repository system and its functionality. Note that obtaining a concrete implementation of - * this interface (e.g. via dependency injection, service locator, etc.) is dependent on the application and its - * specific needs, please consult the online documentation for examples and directions on booting the system. - * - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface RepositorySystem -{ - - /** - * Expands a version range to a list of matching versions, in ascending order. For example, resolves "[3.8,4.0)" to - * "3.8", "3.8.1", "3.8.2". Note that the returned list of versions is only dependent on the configured repositories - * and their contents, the list is not processed by the {@link RepositorySystemSession#getVersionFilter() session's - * version filter}. - *

- * The supplied request may also refer to a single concrete version rather than a version range. In this case - * though, the result contains simply the (parsed) input version, regardless of the repositories and their contents. - * - * @param session The repository session, must not be {@code null}. - * @param request The version range request, must not be {@code null}. - * @return The version range result, never {@code null}. - * @throws VersionRangeResolutionException If the requested range could not be parsed. Note that an empty range does - * not raise an exception. - * @see #newResolutionRepositories(RepositorySystemSession, List) - */ - VersionRangeResult resolveVersionRange( RepositorySystemSession session, VersionRangeRequest request ) - throws VersionRangeResolutionException; - - /** - * Resolves an artifact's meta version (if any) to a concrete version. For example, resolves "1.0-SNAPSHOT" to - * "1.0-20090208.132618-23". - * - * @param session The repository session, must not be {@code null}. - * @param request The version request, must not be {@code null}. - * @return The version result, never {@code null}. - * @throws VersionResolutionException If the metaversion could not be resolved. - * @see #newResolutionRepositories(RepositorySystemSession, List) - */ - VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request ) - throws VersionResolutionException; - - /** - * Gets information about an artifact like its direct dependencies and potential relocations. - * - * @param session The repository session, must not be {@code null}. - * @param request The descriptor request, must not be {@code null}. - * @return The descriptor result, never {@code null}. - * @throws ArtifactDescriptorException If the artifact descriptor could not be read. - * @see RepositorySystemSession#getArtifactDescriptorPolicy() - * @see #newResolutionRepositories(RepositorySystemSession, List) - */ - ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session, ArtifactDescriptorRequest request ) - throws ArtifactDescriptorException; - - /** - * Collects the transitive dependencies of an artifact and builds a dependency graph. Note that this operation is - * only concerned about determining the coordinates of the transitive dependencies. To also resolve the actual - * artifact files, use {@link #resolveDependencies(RepositorySystemSession, DependencyRequest)}. - * - * @param session The repository session, must not be {@code null}. - * @param request The collection request, must not be {@code null}. - * @return The collection result, never {@code null}. - * @throws DependencyCollectionException If the dependency tree could not be built. - * @see RepositorySystemSession#getDependencyTraverser() - * @see RepositorySystemSession#getDependencyManager() - * @see RepositorySystemSession#getDependencySelector() - * @see RepositorySystemSession#getVersionFilter() - * @see RepositorySystemSession#getDependencyGraphTransformer() - * @see #newResolutionRepositories(RepositorySystemSession, List) - */ - CollectResult collectDependencies( RepositorySystemSession session, CollectRequest request ) - throws DependencyCollectionException; - - /** - * Collects and resolves the transitive dependencies of an artifact. This operation is essentially a combination of - * {@link #collectDependencies(RepositorySystemSession, CollectRequest)} and - * {@link #resolveArtifacts(RepositorySystemSession, Collection)}. - * - * @param session The repository session, must not be {@code null}. - * @param request The dependency request, must not be {@code null}. - * @return The dependency result, never {@code null}. - * @throws DependencyResolutionException If the dependency tree could not be built or any dependency artifact could - * not be resolved. - * @see #newResolutionRepositories(RepositorySystemSession, List) - */ - DependencyResult resolveDependencies( RepositorySystemSession session, DependencyRequest request ) - throws DependencyResolutionException; - - /** - * Resolves the path for an artifact. The artifact will be downloaded to the local repository if necessary. An - * artifact that is already resolved will be skipped and is not re-resolved. In general, callers must not assume any - * relationship between an artifact's resolved filename and its coordinates. Note that this method assumes that any - * relocations have already been processed. - * - * @param session The repository session, must not be {@code null}. - * @param request The resolution request, must not be {@code null}. - * @return The resolution result, never {@code null}. - * @throws ArtifactResolutionException If the artifact could not be resolved. - * @see Artifact#getFile() - * @see #newResolutionRepositories(RepositorySystemSession, List) - */ - ArtifactResult resolveArtifact( RepositorySystemSession session, ArtifactRequest request ) - throws ArtifactResolutionException; - - /** - * Resolves the paths for a collection of artifacts. Artifacts will be downloaded to the local repository if - * necessary. Artifacts that are already resolved will be skipped and are not re-resolved. In general, callers must - * not assume any relationship between an artifact's filename and its coordinates. Note that this method assumes - * that any relocations have already been processed. - * - * @param session The repository session, must not be {@code null}. - * @param requests The resolution requests, must not be {@code null}. - * @return The resolution results (in request order), never {@code null}. - * @throws ArtifactResolutionException If any artifact could not be resolved. - * @see Artifact#getFile() - * @see #newResolutionRepositories(RepositorySystemSession, List) - */ - List resolveArtifacts( RepositorySystemSession session, - Collection requests ) - throws ArtifactResolutionException; - - /** - * Resolves the paths for a collection of metadata. Metadata will be downloaded to the local repository if - * necessary, e.g. because it hasn't been cached yet or the cache is deemed outdated. - * - * @param session The repository session, must not be {@code null}. - * @param requests The resolution requests, must not be {@code null}. - * @return The resolution results (in request order), never {@code null}. - * @see Metadata#getFile() - * @see #newResolutionRepositories(RepositorySystemSession, List) - */ - List resolveMetadata( RepositorySystemSession session, - Collection requests ); - - /** - * Installs a collection of artifacts and their accompanying metadata to the local repository. - * - * @param session The repository session, must not be {@code null}. - * @param request The installation request, must not be {@code null}. - * @return The installation result, never {@code null}. - * @throws InstallationException If any artifact/metadata from the request could not be installed. - */ - InstallResult install( RepositorySystemSession session, InstallRequest request ) - throws InstallationException; - - /** - * Uploads a collection of artifacts and their accompanying metadata to a remote repository. - * - * @param session The repository session, must not be {@code null}. - * @param request The deployment request, must not be {@code null}. - * @return The deployment result, never {@code null}. - * @throws DeploymentException If any artifact/metadata from the request could not be deployed. - * @see #newDeploymentRepository(RepositorySystemSession, RemoteRepository) - */ - DeployResult deploy( RepositorySystemSession session, DeployRequest request ) - throws DeploymentException; - - /** - * Creates a new manager for the specified local repository. If the specified local repository has no type, the - * default local repository type of the system will be used. Note: It is expected that this method - * invocation is one of the last steps of setting up a new session, in particular any configuration properties - * should have been set already. - * - * @param session The repository system session from which to configure the manager, must not be {@code null}. - * @param localRepository The local repository to create a manager for, must not be {@code null}. - * @return The local repository manager, never {@code null}. - * @throws IllegalArgumentException If the specified repository type is not recognized or no base directory is - * given. - */ - LocalRepositoryManager newLocalRepositoryManager( RepositorySystemSession session, LocalRepository localRepository ); - - /** - * Creates a new synchronization context. - * - * @param session The repository session during which the context will be used, must not be {@code null}. - * @param shared A flag indicating whether access to the artifacts/metadata associated with the new context can be - * shared among concurrent readers or whether access needs to be exclusive to the calling thread. - * @return The synchronization context, never {@code null}. - */ - SyncContext newSyncContext( RepositorySystemSession session, boolean shared ); - - /** - * Forms remote repositories suitable for artifact resolution by applying the session's authentication selector and - * similar network configuration to the given repository prototypes. As noted for - * {@link RepositorySystemSession#getAuthenticationSelector()} etc. the remote repositories passed to e.g. - * {@link #resolveArtifact(RepositorySystemSession, ArtifactRequest) resolveArtifact()} are used as is and expected - * to already carry any required authentication or proxy configuration. This method can be used to apply the - * authentication/proxy configuration from a session to a bare repository definition to obtain the complete - * repository definition for use in the resolution request. - * - * @param session The repository system session from which to configure the repositories, must not be {@code null}. - * @param repositories The repository prototypes from which to derive the resolution repositories, must not be - * {@code null} or contain {@code null} elements. - * @return The resolution repositories, never {@code null}. Note that there is generally no 1:1 relationship of the - * obtained repositories to the original inputs due to mirror selection potentially aggregating multiple - * repositories. - * @see #newDeploymentRepository(RepositorySystemSession, RemoteRepository) - */ - List newResolutionRepositories( RepositorySystemSession session, - List repositories ); - - /** - * Forms a remote repository suitable for artifact deployment by applying the session's authentication selector and - * similar network configuration to the given repository prototype. As noted for - * {@link RepositorySystemSession#getAuthenticationSelector()} etc. the remote repository passed to - * {@link #deploy(RepositorySystemSession, DeployRequest) deploy()} is used as is and expected to already carry any - * required authentication or proxy configuration. This method can be used to apply the authentication/proxy - * configuration from a session to a bare repository definition to obtain the complete repository definition for use - * in the deploy request. - * - * @param session The repository system session from which to configure the repository, must not be {@code null}. - * @param repository The repository prototype from which to derive the deployment repository, must not be - * {@code null}. - * @return The deployment repository, never {@code null}. - * @see #newResolutionRepositories(RepositorySystemSession, List) - */ - RemoteRepository newDeploymentRepository( RepositorySystemSession session, RemoteRepository repository ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java b/aether-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java deleted file mode 100644 index 888f29c..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java +++ /dev/null @@ -1,263 +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 java.util.Map; - -import org.eclipse.aether.artifact.ArtifactTypeRegistry; -import org.eclipse.aether.collection.DependencyGraphTransformer; -import org.eclipse.aether.collection.DependencyManager; -import org.eclipse.aether.collection.DependencySelector; -import org.eclipse.aether.collection.DependencyTraverser; -import org.eclipse.aether.collection.VersionFilter; -import org.eclipse.aether.repository.AuthenticationSelector; -import org.eclipse.aether.repository.LocalRepository; -import org.eclipse.aether.repository.LocalRepositoryManager; -import org.eclipse.aether.repository.MirrorSelector; -import org.eclipse.aether.repository.ProxySelector; -import org.eclipse.aether.repository.RepositoryPolicy; -import org.eclipse.aether.repository.WorkspaceReader; -import org.eclipse.aether.resolution.ArtifactDescriptorPolicy; -import org.eclipse.aether.resolution.ResolutionErrorPolicy; -import org.eclipse.aether.transfer.TransferListener; - -/** - * Defines settings and components that control the repository system. Once initialized, the session object itself is - * supposed to be immutable and hence can safely be shared across an entire application and any concurrent threads - * reading it. Components that wish to tweak some aspects of an existing session should use the copy constructor of - * {@link DefaultRepositorySystemSession} and its mutators to derive a custom session. - * - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface RepositorySystemSession -{ - - /** - * Indicates whether the repository system operates in offline mode and avoids/refuses any access to remote - * repositories. - * - * @return {@code true} if the repository system is in offline mode, {@code false} otherwise. - */ - boolean isOffline(); - - /** - * Indicates whether repositories declared in artifact descriptors should be ignored during transitive dependency - * collection. If enabled, only the repositories originally provided with the collect request will be considered. - * - * @return {@code true} if additional repositories from artifact descriptors are ignored, {@code false} to merge - * those with the originally specified repositories. - */ - boolean isIgnoreArtifactDescriptorRepositories(); - - /** - * Gets the policy which controls whether resolutions errors from remote repositories should be cached. - * - * @return The resolution error policy for this session or {@code null} if resolution errors should generally not be - * cached. - */ - ResolutionErrorPolicy getResolutionErrorPolicy(); - - /** - * Gets the policy which controls how errors related to reading artifact descriptors should be handled. - * - * @return The descriptor error policy for this session or {@code null} if descriptor errors should generally not be - * tolerated. - */ - ArtifactDescriptorPolicy getArtifactDescriptorPolicy(); - - /** - * Gets the global checksum policy. If set, the global checksum policy overrides the checksum policies of the remote - * repositories being used for resolution. - * - * @return The global checksum policy or {@code null}/empty if not set and the per-repository policies apply. - * @see RepositoryPolicy#CHECKSUM_POLICY_FAIL - * @see RepositoryPolicy#CHECKSUM_POLICY_IGNORE - * @see RepositoryPolicy#CHECKSUM_POLICY_WARN - */ - String getChecksumPolicy(); - - /** - * Gets the global update policy. If set, the global update policy overrides the update policies of the remote - * repositories being used for resolution. - * - * @return The global update policy or {@code null}/empty if not set and the per-repository policies apply. - * @see RepositoryPolicy#UPDATE_POLICY_ALWAYS - * @see RepositoryPolicy#UPDATE_POLICY_DAILY - * @see RepositoryPolicy#UPDATE_POLICY_NEVER - */ - String getUpdatePolicy(); - - /** - * Gets the local repository used during this session. This is a convenience method for - * {@link LocalRepositoryManager#getRepository()}. - * - * @return The local repository being during this session, never {@code null}. - */ - LocalRepository getLocalRepository(); - - /** - * Gets the local repository manager used during this session. - * - * @return The local repository manager used during this session, never {@code null}. - */ - LocalRepositoryManager getLocalRepositoryManager(); - - /** - * Gets the workspace reader used during this session. If set, the workspace reader will usually be consulted first - * to resolve artifacts. - * - * @return The workspace reader for this session or {@code null} if none. - */ - WorkspaceReader getWorkspaceReader(); - - /** - * Gets the listener being notified of actions in the repository system. - * - * @return The repository listener or {@code null} if none. - */ - RepositoryListener getRepositoryListener(); - - /** - * Gets the listener being notified of uploads/downloads by the repository system. - * - * @return The transfer listener or {@code null} if none. - */ - TransferListener getTransferListener(); - - /** - * Gets the system properties to use, e.g. for processing of artifact descriptors. System properties are usually - * collected from the runtime environment like {@link System#getProperties()} and environment variables. - * - * @return The (read-only) system properties, never {@code null}. - */ - Map getSystemProperties(); - - /** - * Gets the user properties to use, e.g. for processing of artifact descriptors. User properties are similar to - * system properties but are set on the discretion of the user and hence are considered of higher priority than - * system properties. - * - * @return The (read-only) user properties, never {@code null}. - */ - Map getUserProperties(); - - /** - * Gets the configuration properties used to tweak internal aspects of the repository system (e.g. thread pooling, - * connector-specific behavior, etc.) - * - * @return The (read-only) configuration properties, never {@code null}. - * @see ConfigurationProperties - */ - Map getConfigProperties(); - - /** - * Gets the mirror selector to use for repositories discovered in artifact descriptors. Note that this selector is - * not used for remote repositories which are passed as request parameters to the repository system, those - * repositories are supposed to denote the effective repositories. - * - * @return The mirror selector to use, never {@code null}. - * @see RepositorySystem#newResolutionRepositories(RepositorySystemSession, java.util.List) - */ - MirrorSelector getMirrorSelector(); - - /** - * Gets the proxy selector to use for repositories discovered in artifact descriptors. Note that this selector is - * not used for remote repositories which are passed as request parameters to the repository system, those - * repositories are supposed to have their proxy (if any) already set. - * - * @return The proxy selector to use, never {@code null}. - * @see org.eclipse.aether.repository.RemoteRepository#getProxy() - * @see RepositorySystem#newResolutionRepositories(RepositorySystemSession, java.util.List) - */ - ProxySelector getProxySelector(); - - /** - * Gets the authentication selector to use for repositories discovered in artifact descriptors. Note that this - * selector is not used for remote repositories which are passed as request parameters to the repository system, - * those repositories are supposed to have their authentication (if any) already set. - * - * @return The authentication selector to use, never {@code null}. - * @see org.eclipse.aether.repository.RemoteRepository#getAuthentication() - * @see RepositorySystem#newResolutionRepositories(RepositorySystemSession, java.util.List) - */ - AuthenticationSelector getAuthenticationSelector(); - - /** - * Gets the registry of artifact types recognized by this session, for instance when processing artifact - * descriptors. - * - * @return The artifact type registry, never {@code null}. - */ - ArtifactTypeRegistry getArtifactTypeRegistry(); - - /** - * Gets the dependency traverser to use for building dependency graphs. - * - * @return The dependency traverser to use for building dependency graphs or {@code null} if dependencies are - * unconditionally traversed. - */ - DependencyTraverser getDependencyTraverser(); - - /** - * Gets the dependency manager to use for building dependency graphs. - * - * @return The dependency manager to use for building dependency graphs or {@code null} if dependency management is - * not performed. - */ - DependencyManager getDependencyManager(); - - /** - * Gets the dependency selector to use for building dependency graphs. - * - * @return The dependency selector to use for building dependency graphs or {@code null} if dependencies are - * unconditionally included. - */ - DependencySelector getDependencySelector(); - - /** - * Gets the version filter to use for building dependency graphs. - * - * @return The version filter to use for building dependency graphs or {@code null} if versions aren't filtered. - */ - VersionFilter getVersionFilter(); - - /** - * Gets the dependency graph transformer to use for building dependency graphs. - * - * @return The dependency graph transformer to use for building dependency graphs or {@code null} if none. - */ - DependencyGraphTransformer getDependencyGraphTransformer(); - - /** - * Gets the custom data associated with this session. - * - * @return The session data, never {@code null}. - */ - SessionData getData(); - - /** - * Gets the cache the repository system may use to save data for future reuse during the session. - * - * @return The repository cache or {@code null} if none. - */ - RepositoryCache getCache(); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/RequestTrace.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/RequestTrace.java b/aether-api/src/main/java/org/eclipse/aether/RequestTrace.java deleted file mode 100644 index 86aaa78..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/RequestTrace.java +++ /dev/null @@ -1,117 +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. - */ - -/** - * A trace of nested requests that are performed by the repository system. This trace information can be used to - * correlate repository events with higher level operations in the application code that eventually caused the events. A - * single trace can carry an arbitrary object as data which is meant to describe a request/operation that is currently - * executed. For call hierarchies within the repository system itself, this data will usually be the {@code *Request} - * object that is currently processed. When invoking methods on the repository system, client code may provide a request - * trace that has been prepopulated with whatever data is useful for the application to indicate its state for later - * evaluation when processing the repository events. - * - * @see RepositoryEvent#getTrace() - */ -public class RequestTrace -{ - - private final RequestTrace parent; - - private final Object data; - - /** - * Creates a child of the specified request trace. This method is basically a convenience that will invoke - * {@link RequestTrace#newChild(Object) parent.newChild()} when the specified parent trace is not {@code null} or - * otherwise instantiante a new root trace. - * - * @param parent The parent request trace, may be {@code null}. - * @param data The data to associate with the child trace, may be {@code null}. - * @return The child trace, never {@code null}. - */ - public static RequestTrace newChild( RequestTrace parent, Object data ) - { - if ( parent == null ) - { - return new RequestTrace( data ); - } - return parent.newChild( data ); - } - - /** - * Creates a new root trace with the specified data. - * - * @param data The data to associate with the trace, may be {@code null}. - */ - public RequestTrace( Object data ) - { - this( null, data ); - } - - /** - * Creates a new trace with the specified data and parent - * - * @param parent The parent trace, may be {@code null} for a root trace. - * @param data The data to associate with the trace, may be {@code null}. - */ - protected RequestTrace( RequestTrace parent, Object data ) - { - this.parent = parent; - this.data = data; - } - - /** - * Gets the data associated with this trace. - * - * @return The data associated with this trace or {@code null} if none. - */ - public final Object getData() - { - return data; - } - - /** - * Gets the parent of this trace. - * - * @return The parent of this trace or {@code null} if this is the root of the trace stack. - */ - public final RequestTrace getParent() - { - return parent; - } - - /** - * Creates a new child of this trace. - * - * @param data The data to associate with the child, may be {@code null}. - * @return The child trace, never {@code null}. - */ - public RequestTrace newChild( Object data ) - { - return new RequestTrace( this, data ); - } - - @Override - public String toString() - { - return String.valueOf( getData() ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/SessionData.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/SessionData.java b/aether-api/src/main/java/org/eclipse/aether/SessionData.java deleted file mode 100644 index b6efeac..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/SessionData.java +++ /dev/null @@ -1,66 +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. - */ - -/** - * A container for data that is specific to a repository system session. Both components within the repository system - * and clients of the system may use this storage to associate arbitrary data with a session. - *

- * Unlike a cache, this session data is not subject to purging. For this same reason, session data should also not be - * abused as a cache (i.e. for storing values that can be re-calculated) to avoid memory exhaustion. - *

- * Note: Actual implementations must be thread-safe. - * - * @see RepositorySystemSession#getData() - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface SessionData -{ - - /** - * Associates the specified session data with the given key. - * - * @param key The key under which to store the session data, must not be {@code null}. - * @param value The data to associate with the key, may be {@code null} to remove the mapping. - */ - void set( Object key, Object value ); - - /** - * Associates the specified session data with the given key if the key is currently mapped to the given value. This - * method provides an atomic compare-and-update of some key's value. - * - * @param key The key under which to store the session data, must not be {@code null}. - * @param oldValue The expected data currently associated with the key, may be {@code null}. - * @param newValue The data to associate with the key, may be {@code null} to remove the mapping. - * @return {@code true} if the key mapping was successfully updated from the old value to the new value, - * {@code false} if the current key mapping didn't match the expected value and was not updated. - */ - boolean set( Object key, Object oldValue, Object newValue ); - - /** - * Gets the session data associated with the specified key. - * - * @param key The key for which to retrieve the session data, must not be {@code null}. - * @return The session data associated with the key or {@code null} if none. - */ - Object get( Object key ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/SyncContext.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/SyncContext.java b/aether-api/src/main/java/org/eclipse/aether/SyncContext.java deleted file mode 100644 index 2d751c0..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/SyncContext.java +++ /dev/null @@ -1,76 +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 java.io.Closeable; -import java.util.Collection; - -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.metadata.Metadata; - -/** - * A synchronization context used to coordinate concurrent access to artifacts or metadatas. The typical usage of a - * synchronization context looks like this: - * - *

- * SyncContext syncContext = repositorySystem.newSyncContext( ... );
- * try {
- *     syncContext.acquire( artifacts, metadatas );
- *     // work with the artifacts and metadatas
- * } finally {
- *     syncContext.close();
- * }
- * 
- * - * Within one thread, synchronization contexts may be nested which can naturally happen in a hierarchy of method calls. - * The nested synchronization contexts may also acquire overlapping sets of artifacts/metadatas as long as the following - * conditions are met. If the outer-most context holding a particular resource is exclusive, that resource can be - * reacquired in any nested context. If however the outer-most context is shared, the resource may only be reacquired by - * nested contexts if these are also shared. - *

- * A synchronization context is meant to be utilized by only one thread and as such is not thread-safe. - *

- * Note that the level of actual synchronization is subject to the implementation and might range from OS-wide to none. - * - * @see RepositorySystem#newSyncContext(RepositorySystemSession, boolean) - */ -public interface SyncContext - extends Closeable -{ - - /** - * Acquires synchronized access to the specified artifacts and metadatas. The invocation will potentially block - * until all requested resources can be acquired by the calling thread. Acquiring resources that are already - * acquired by this synchronization context has no effect. Please also see the class-level documentation for - * information regarding reentrancy. The method may be invoked multiple times on a synchronization context until all - * desired resources have been acquired. - * - * @param artifacts The artifacts to acquire, may be {@code null} or empty if none. - * @param metadatas The metadatas to acquire, may be {@code null} or empty if none. - */ - void acquire( Collection artifacts, Collection metadatas ); - - /** - * Releases all previously acquired artifacts/metadatas. If no resources have been acquired before or if this - * synchronization context has already been closed, this method does nothing. - */ - void close(); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/artifact/AbstractArtifact.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/artifact/AbstractArtifact.java b/aether-api/src/main/java/org/eclipse/aether/artifact/AbstractArtifact.java deleted file mode 100644 index d89260b..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/artifact/AbstractArtifact.java +++ /dev/null @@ -1,230 +0,0 @@ -package org.eclipse.aether.artifact; - -/* - * 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.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * A skeleton class for artifacts. - */ -public abstract class AbstractArtifact - implements Artifact -{ - - private static final String SNAPSHOT = "SNAPSHOT"; - - private static final Pattern SNAPSHOT_TIMESTAMP = Pattern.compile( "^(.*-)?([0-9]{8}\\.[0-9]{6}-[0-9]+)$" ); - - public boolean isSnapshot() - { - return isSnapshot( getVersion() ); - } - - private static boolean isSnapshot( String version ) - { - return version.endsWith( SNAPSHOT ) || SNAPSHOT_TIMESTAMP.matcher( version ).matches(); - } - - public String getBaseVersion() - { - return toBaseVersion( getVersion() ); - } - - private static String toBaseVersion( String version ) - { - String baseVersion; - - if ( version == null ) - { - baseVersion = version; - } - else if ( version.startsWith( "[" ) || version.startsWith( "(" ) ) - { - baseVersion = version; - } - else - { - Matcher m = SNAPSHOT_TIMESTAMP.matcher( version ); - if ( m.matches() ) - { - if ( m.group( 1 ) != null ) - { - baseVersion = m.group( 1 ) + SNAPSHOT; - } - else - { - baseVersion = SNAPSHOT; - } - } - else - { - baseVersion = version; - } - } - - return baseVersion; - } - - /** - * Creates a new artifact with the specified coordinates, properties and file. - * - * @param version The version of the artifact, may be {@code null}. - * @param properties The properties of the artifact, may be {@code null} if none. The method may assume immutability - * of the supplied map, i.e. need not copy it. - * @param file The resolved file of the artifact, may be {@code null}. - * @return The new artifact instance, never {@code null}. - */ - private Artifact newInstance( String version, Map properties, File file ) - { - return new DefaultArtifact( getGroupId(), getArtifactId(), getClassifier(), getExtension(), version, file, - properties ); - } - - public Artifact setVersion( String version ) - { - String current = getVersion(); - if ( current.equals( version ) || ( version == null && current.length() <= 0 ) ) - { - return this; - } - return newInstance( version, getProperties(), getFile() ); - } - - public Artifact setFile( File file ) - { - File current = getFile(); - if ( ( current == null ) ? file == null : current.equals( file ) ) - { - return this; - } - return newInstance( getVersion(), getProperties(), file ); - } - - public Artifact setProperties( Map properties ) - { - Map current = getProperties(); - if ( current.equals( properties ) || ( properties == null && current.isEmpty() ) ) - { - return this; - } - return newInstance( getVersion(), copyProperties( properties ), getFile() ); - } - - public String getProperty( String key, String defaultValue ) - { - String value = getProperties().get( key ); - return ( value != null ) ? value : defaultValue; - } - - /** - * Copies the specified artifact properties. This utility method should be used when creating new artifact instances - * with caller-supplied properties. - * - * @param properties The properties to copy, may be {@code null}. - * @return The copied and read-only properties, never {@code null}. - */ - protected static Map copyProperties( Map properties ) - { - if ( properties != null && !properties.isEmpty() ) - { - return Collections.unmodifiableMap( new HashMap( properties ) ); - } - else - { - return Collections.emptyMap(); - } - } - - @Override - public String toString() - { - StringBuilder buffer = new StringBuilder( 128 ); - buffer.append( getGroupId() ); - buffer.append( ':' ).append( getArtifactId() ); - buffer.append( ':' ).append( getExtension() ); - if ( getClassifier().length() > 0 ) - { - buffer.append( ':' ).append( getClassifier() ); - } - buffer.append( ':' ).append( getVersion() ); - return buffer.toString(); - } - - /** - * Compares this artifact with the specified object. - * - * @param obj The object to compare this artifact against, may be {@code null}. - * @return {@code true} if and only if the specified object is another {@link Artifact} with equal coordinates, - * properties and file, {@code false} otherwise. - */ - @Override - public boolean equals( Object obj ) - { - if ( obj == this ) - { - return true; - } - else if ( !( obj instanceof Artifact ) ) - { - return false; - } - - Artifact that = (Artifact) obj; - - return getArtifactId().equals( that.getArtifactId() ) && getGroupId().equals( that.getGroupId() ) - && getVersion().equals( that.getVersion() ) && getExtension().equals( that.getExtension() ) - && getClassifier().equals( that.getClassifier() ) && eq( getFile(), that.getFile() ) - && getProperties().equals( that.getProperties() ); - } - - private static boolean eq( T s1, T s2 ) - { - return s1 != null ? s1.equals( s2 ) : s2 == null; - } - - /** - * Returns a hash code for this artifact. - * - * @return A hash code for the artifact. - */ - @Override - public int hashCode() - { - int hash = 17; - hash = hash * 31 + getGroupId().hashCode(); - hash = hash * 31 + getArtifactId().hashCode(); - hash = hash * 31 + getExtension().hashCode(); - hash = hash * 31 + getClassifier().hashCode(); - hash = hash * 31 + getVersion().hashCode(); - hash = hash * 31 + hash( getFile() ); - return hash; - } - - private static int hash( Object obj ) - { - return ( obj != null ) ? obj.hashCode() : 0; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/artifact/Artifact.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/artifact/Artifact.java b/aether-api/src/main/java/org/eclipse/aether/artifact/Artifact.java deleted file mode 100644 index 6323243..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/artifact/Artifact.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.eclipse.aether.artifact; - -/* - * 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.util.Map; - -/** - * A specific artifact. In a nutshell, an artifact has identifying coordinates and optionally a file that denotes its - * data. Note: Artifact instances are supposed to be immutable, e.g. any exposed mutator method returns a new - * artifact instance and leaves the original instance unchanged. Note: Implementors are strongly advised to - * inherit from {@link AbstractArtifact} instead of directly implementing this interface. - * - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface Artifact -{ - - /** - * Gets the group identifier of this artifact, for example "org.apache.maven". - * - * @return The group identifier, never {@code null}. - */ - String getGroupId(); - - /** - * Gets the artifact identifier of this artifact, for example "maven-model". - * - * @return The artifact identifier, never {@code null}. - */ - String getArtifactId(); - - /** - * Gets the version of this artifact, for example "1.0-20100529-1213". Note that in case of meta versions like - * "1.0-SNAPSHOT", the artifact's version depends on the state of the artifact. Artifacts that have been resolved or - * deployed will usually have the meta version expanded. - * - * @return The version, never {@code null}. - */ - String getVersion(); - - /** - * Sets the version of the artifact. - * - * @param version The version of this artifact, may be {@code null} or empty. - * @return The new artifact, never {@code null}. - */ - Artifact setVersion( String version ); - - /** - * Gets the base version of this artifact, for example "1.0-SNAPSHOT". In contrast to the {@link #getVersion()}, the - * base version will always refer to the unresolved meta version. - * - * @return The base version, never {@code null}. - */ - String getBaseVersion(); - - /** - * Determines whether this artifact uses a snapshot version. - * - * @return {@code true} if the artifact is a snapshot, {@code false} otherwise. - */ - boolean isSnapshot(); - - /** - * Gets the classifier of this artifact, for example "sources". - * - * @return The classifier or an empty string if none, never {@code null}. - */ - String getClassifier(); - - /** - * Gets the (file) extension of this artifact, for example "jar" or "tar.gz". - * - * @return The file extension (without leading period), never {@code null}. - */ - String getExtension(); - - /** - * Gets the file of this artifact. Note that only resolved artifacts have a file associated with them. In general, - * callers must not assume any relationship between an artifact's filename and its coordinates. - * - * @return The file or {@code null} if the artifact isn't resolved. - */ - File getFile(); - - /** - * Sets the file of the artifact. - * - * @param file The file of the artifact, may be {@code null} - * @return The new artifact, never {@code null}. - */ - Artifact setFile( File file ); - - /** - * Gets the specified property. - * - * @param key The name of the property, must not be {@code null}. - * @param defaultValue The default value to return in case the property is not set, may be {@code null}. - * @return The requested property value or {@code null} if the property is not set and no default value was - * provided. - * @see ArtifactProperties - */ - String getProperty( String key, String defaultValue ); - - /** - * Gets the properties of this artifact. Clients may use these properties to associate non-persistent values with an - * artifact that help later processing when the artifact gets passed around within the application. - * - * @return The (read-only) properties, never {@code null}. - * @see ArtifactProperties - */ - Map getProperties(); - - /** - * Sets the properties for the artifact. Note that these properties exist merely in memory and are not persisted - * when the artifact gets installed/deployed to a repository. - * - * @param properties The properties for the artifact, may be {@code null}. - * @return The new artifact, never {@code null}. - * @see ArtifactProperties - */ - Artifact setProperties( Map properties ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactProperties.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactProperties.java b/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactProperties.java deleted file mode 100644 index 1108086..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactProperties.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.aether.artifact; - -/* - * 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 keys for common properties of artifacts. - * - * @see Artifact#getProperties() - */ -public final class ArtifactProperties -{ - - /** - * A high-level characterization of the artifact, e.g. "maven-plugin" or "test-jar". - * - * @see ArtifactType#getId() - */ - public static final String TYPE = "type"; - - /** - * The programming language this artifact is relevant for, e.g. "java" or "none". - */ - public static final String LANGUAGE = "language"; - - /** - * The (expected) path to the artifact on the local filesystem. An artifact which has this property set is assumed - * to be not present in any regular repository and likewise has no artifact descriptor. Artifact resolution will - * verify the path and resolve the artifact if the path actually denotes an existing file. If the path isn't valid, - * resolution will fail and no attempts to search local/remote repositories are made. - */ - public static final String LOCAL_PATH = "localPath"; - - /** - * A boolean flag indicating whether the artifact presents some kind of bundle that physically includes its - * dependencies, e.g. a fat WAR. - */ - public static final String INCLUDES_DEPENDENCIES = "includesDependencies"; - - /** - * A boolean flag indicating whether the artifact is meant to be used for the compile/runtime/test build path of a - * consumer project. - */ - public static final String CONSTITUTES_BUILD_PATH = "constitutesBuildPath"; - - /** - * The URL to a web page from which the artifact can be manually downloaded. This URL is not contacted by the - * repository system but serves as a pointer for the end user to assist in getting artifacts that are not published - * in a proper repository. - */ - public static final String DOWNLOAD_URL = "downloadUrl"; - - private ArtifactProperties() - { - // hide constructor - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactType.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactType.java b/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactType.java deleted file mode 100644 index 5f87217..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactType.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.eclipse.aether.artifact; - -/* - * 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.Map; - -/** - * An artifact type describing artifact characteristics/properties that are common for certain artifacts. Artifact types - * are a means to simplify the description of an artifact by referring to an artifact type instead of specifying the - * various properties individually. - * - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - * @see ArtifactTypeRegistry - * @see DefaultArtifact#DefaultArtifact(String, String, String, String, String, ArtifactType) - */ -public interface ArtifactType -{ - - /** - * Gets the identifier of this type, e.g. "maven-plugin" or "test-jar". - * - * @return The identifier of this type, never {@code null}. - * @see ArtifactProperties#TYPE - */ - String getId(); - - /** - * Gets the file extension to use for artifacts of this type (unless explicitly overridden by the artifact). - * - * @return The usual file extension, never {@code null}. - */ - String getExtension(); - - /** - * Gets the classifier to use for artifacts of this type (unless explicitly overridden by the artifact). - * - * @return The usual classifier or an empty string if none, never {@code null}. - */ - String getClassifier(); - - /** - * Gets the properties to use for artifacts of this type (unless explicitly overridden by the artifact). - * - * @return The (read-only) properties, never {@code null}. - * @see ArtifactProperties - */ - Map getProperties(); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactTypeRegistry.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactTypeRegistry.java b/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactTypeRegistry.java deleted file mode 100644 index f379173..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/artifact/ArtifactTypeRegistry.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.eclipse.aether.artifact; - -/* - * 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 registry of known artifact types. - * - * @see org.eclipse.aether.RepositorySystemSession#getArtifactTypeRegistry() - */ -public interface ArtifactTypeRegistry -{ - - /** - * Gets the artifact type with the specified identifier. - * - * @param typeId The identifier of the type, must not be {@code null}. - * @return The artifact type or {@code null} if no type with the requested identifier exists. - */ - ArtifactType get( String typeId ); - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/artifact/DefaultArtifact.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/artifact/DefaultArtifact.java b/aether-api/src/main/java/org/eclipse/aether/artifact/DefaultArtifact.java deleted file mode 100644 index 786af74..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/artifact/DefaultArtifact.java +++ /dev/null @@ -1,285 +0,0 @@ -package org.eclipse.aether.artifact; - -/* - * 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.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * A simple artifact. Note: Instances of this class are immutable and the exposed mutators return new objects - * rather than changing the current instance. - */ -public final class DefaultArtifact - extends AbstractArtifact -{ - - private final String groupId; - - private final String artifactId; - - private final String version; - - private final String classifier; - - private final String extension; - - private final File file; - - private final Map properties; - - /** - * Creates a new artifact with the specified coordinates. If not specified in the artifact coordinates, the - * artifact's extension defaults to {@code jar} and classifier to an empty string. - * - * @param coords The artifact coordinates in the format - * {@code :[:[:]]:}, must not be {@code null}. - */ - public DefaultArtifact( String coords ) - { - this( coords, Collections.emptyMap() ); - } - - /** - * Creates a new artifact with the specified coordinates and properties. If not specified in the artifact - * coordinates, the artifact's extension defaults to {@code jar} and classifier to an empty string. - * - * @param coords The artifact coordinates in the format - * {@code :[:[:]]:}, must not be {@code null}. - * @param properties The artifact properties, may be {@code null}. - */ - public DefaultArtifact( String coords, Map properties ) - { - Pattern p = Pattern.compile( "([^: ]+):([^: ]+)(:([^: ]*)(:([^: ]+))?)?:([^: ]+)" ); - Matcher m = p.matcher( coords ); - if ( !m.matches() ) - { - throw new IllegalArgumentException( "Bad artifact coordinates " + coords - + ", expected format is :[:[:]]:" ); - } - groupId = m.group( 1 ); - artifactId = m.group( 2 ); - extension = get( m.group( 4 ), "jar" ); - classifier = get( m.group( 6 ), "" ); - version = m.group( 7 ); - file = null; - this.properties = copyProperties( properties ); - } - - private static String get( String value, String defaultValue ) - { - return ( value == null || value.length() <= 0 ) ? defaultValue : value; - } - - /** - * Creates a new artifact with the specified coordinates and no classifier. Passing {@code null} for any of the - * coordinates is equivalent to specifying an empty string. - * - * @param groupId The group identifier of the artifact, may be {@code null}. - * @param artifactId The artifact identifier of the artifact, may be {@code null}. - * @param extension The file extension of the artifact, may be {@code null}. - * @param version The version of the artifact, may be {@code null}. - */ - public DefaultArtifact( String groupId, String artifactId, String extension, String version ) - { - this( groupId, artifactId, "", extension, version ); - } - - /** - * Creates a new artifact with the specified coordinates. Passing {@code null} for any of the coordinates is - * equivalent to specifying an empty string. - * - * @param groupId The group identifier of the artifact, may be {@code null}. - * @param artifactId The artifact identifier of the artifact, may be {@code null}. - * @param classifier The classifier of the artifact, may be {@code null}. - * @param extension The file extension of the artifact, may be {@code null}. - * @param version The version of the artifact, may be {@code null}. - */ - public DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version ) - { - this( groupId, artifactId, classifier, extension, version, null, (File) null ); - } - - /** - * Creates a new artifact with the specified coordinates. Passing {@code null} for any of the coordinates is - * equivalent to specifying an empty string. The optional artifact type provided to this constructor will be used to - * determine the artifact's classifier and file extension if the corresponding arguments for this constructor are - * {@code null}. - * - * @param groupId The group identifier of the artifact, may be {@code null}. - * @param artifactId The artifact identifier of the artifact, may be {@code null}. - * @param classifier The classifier of the artifact, may be {@code null}. - * @param extension The file extension of the artifact, may be {@code null}. - * @param version The version of the artifact, may be {@code null}. - * @param type The artifact type from which to query classifier, file extension and properties, may be {@code null}. - */ - public DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version, - ArtifactType type ) - { - this( groupId, artifactId, classifier, extension, version, null, type ); - } - - /** - * Creates a new artifact with the specified coordinates and properties. Passing {@code null} for any of the - * coordinates is equivalent to specifying an empty string. The optional artifact type provided to this constructor - * will be used to determine the artifact's classifier and file extension if the corresponding arguments for this - * constructor are {@code null}. If the artifact type specifies properties, those will get merged with the - * properties passed directly into the constructor, with the latter properties taking precedence. - * - * @param groupId The group identifier of the artifact, may be {@code null}. - * @param artifactId The artifact identifier of the artifact, may be {@code null}. - * @param classifier The classifier of the artifact, may be {@code null}. - * @param extension The file extension of the artifact, may be {@code null}. - * @param version The version of the artifact, may be {@code null}. - * @param properties The properties of the artifact, may be {@code null} if none. - * @param type The artifact type from which to query classifier, file extension and properties, may be {@code null}. - */ - public DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version, - Map properties, ArtifactType type ) - { - this.groupId = emptify( groupId ); - this.artifactId = emptify( artifactId ); - if ( classifier != null || type == null ) - { - this.classifier = emptify( classifier ); - } - else - { - this.classifier = emptify( type.getClassifier() ); - } - if ( extension != null || type == null ) - { - this.extension = emptify( extension ); - } - else - { - this.extension = emptify( type.getExtension() ); - } - this.version = emptify( version ); - this.file = null; - this.properties = merge( properties, ( type != null ) ? type.getProperties() : null ); - } - - private static Map merge( Map dominant, Map recessive ) - { - Map properties; - - if ( ( dominant == null || dominant.isEmpty() ) && ( recessive == null || recessive.isEmpty() ) ) - { - properties = Collections.emptyMap(); - } - else - { - properties = new HashMap(); - if ( recessive != null ) - { - properties.putAll( recessive ); - } - if ( dominant != null ) - { - properties.putAll( dominant ); - } - properties = Collections.unmodifiableMap( properties ); - } - - return properties; - } - - /** - * Creates a new artifact with the specified coordinates, properties and file. Passing {@code null} for any of the - * coordinates is equivalent to specifying an empty string. - * - * @param groupId The group identifier of the artifact, may be {@code null}. - * @param artifactId The artifact identifier of the artifact, may be {@code null}. - * @param classifier The classifier of the artifact, may be {@code null}. - * @param extension The file extension of the artifact, may be {@code null}. - * @param version The version of the artifact, may be {@code null}. - * @param properties The properties of the artifact, may be {@code null} if none. - * @param file The resolved file of the artifact, may be {@code null}. - */ - public DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version, - Map properties, File file ) - { - this.groupId = emptify( groupId ); - this.artifactId = emptify( artifactId ); - this.classifier = emptify( classifier ); - this.extension = emptify( extension ); - this.version = emptify( version ); - this.file = file; - this.properties = copyProperties( properties ); - } - - DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version, File file, - Map properties ) - { - // NOTE: This constructor assumes immutability of the provided properties, for internal use only - this.groupId = emptify( groupId ); - this.artifactId = emptify( artifactId ); - this.classifier = emptify( classifier ); - this.extension = emptify( extension ); - this.version = emptify( version ); - this.file = file; - this.properties = properties; - } - - private static String emptify( String str ) - { - return ( str == null ) ? "" : str; - } - - public String getGroupId() - { - return groupId; - } - - public String getArtifactId() - { - return artifactId; - } - - public String getVersion() - { - return version; - } - - public String getClassifier() - { - return classifier; - } - - public String getExtension() - { - return extension; - } - - public File getFile() - { - return file; - } - - public Map getProperties() - { - return properties; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/artifact/DefaultArtifactType.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/artifact/DefaultArtifactType.java b/aether-api/src/main/java/org/eclipse/aether/artifact/DefaultArtifactType.java deleted file mode 100644 index c0d2ad8..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/artifact/DefaultArtifactType.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.eclipse.aether.artifact; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -/** - * A simple artifact type. - */ -public final class DefaultArtifactType - implements ArtifactType -{ - - private final String id; - - private final String extension; - - private final String classifier; - - private final Map properties; - - /** - * Creates a new artifact type with the specified identifier. This constructor assumes the usual file extension - * equals the given type id and that the usual classifier is empty. Additionally, the properties - * {@link ArtifactProperties#LANGUAGE}, {@link ArtifactProperties#CONSTITUTES_BUILD_PATH} and - * {@link ArtifactProperties#INCLUDES_DEPENDENCIES} will be set to {@code "none"}, {@code true} and {@code false}, - * respectively. - * - * @param id The identifier of the type which will also be used as the value for the {@link ArtifactProperties#TYPE} - * property, must not be {@code null} or empty. - */ - public DefaultArtifactType( String id ) - { - this( id, id, "", "none", false, false ); - } - - /** - * Creates a new artifact type with the specified properties. Additionally, the properties - * {@link ArtifactProperties#CONSTITUTES_BUILD_PATH} and {@link ArtifactProperties#INCLUDES_DEPENDENCIES} will be - * set to {@code true} and {@code false}, respectively. - * - * @param id The identifier of the type which will also be used as the value for the {@link ArtifactProperties#TYPE} - * property, must not be {@code null} or empty. - * @param extension The usual file extension for artifacts of this type, may be {@code null}. - * @param classifier The usual classifier for artifacts of this type, may be {@code null}. - * @param language The value for the {@link ArtifactProperties#LANGUAGE} property, may be {@code null}. - */ - public DefaultArtifactType( String id, String extension, String classifier, String language ) - { - this( id, extension, classifier, language, true, false ); - } - - /** - * Creates a new artifact type with the specified properties. - * - * @param id The identifier of the type which will also be used as the value for the {@link ArtifactProperties#TYPE} - * property, must not be {@code null} or empty. - * @param extension The usual file extension for artifacts of this type, may be {@code null}. - * @param classifier The usual classifier for artifacts of this type, may be {@code null}. - * @param language The value for the {@link ArtifactProperties#LANGUAGE} property, may be {@code null}. - * @param constitutesBuildPath The value for the {@link ArtifactProperties#CONSTITUTES_BUILD_PATH} property. - * @param includesDependencies The value for the {@link ArtifactProperties#INCLUDES_DEPENDENCIES} property. - */ - public DefaultArtifactType( String id, String extension, String classifier, String language, - boolean constitutesBuildPath, boolean includesDependencies ) - { - if ( id == null || id.length() < 0 ) - { - throw new IllegalArgumentException( "no type id specified" ); - } - this.id = id; - this.extension = emptify( extension ); - this.classifier = emptify( classifier ); - Map props = new HashMap(); - props.put( ArtifactProperties.TYPE, id ); - props.put( ArtifactProperties.LANGUAGE, ( language != null && language.length() > 0 ) ? language : "none" ); - props.put( ArtifactProperties.INCLUDES_DEPENDENCIES, Boolean.toString( includesDependencies ) ); - props.put( ArtifactProperties.CONSTITUTES_BUILD_PATH, Boolean.toString( constitutesBuildPath ) ); - properties = Collections.unmodifiableMap( props ); - } - - /** - * Creates a new artifact type with the specified properties. - * - * @param id The identifier of the type, must not be {@code null} or empty. - * @param extension The usual file extension for artifacts of this type, may be {@code null}. - * @param classifier The usual classifier for artifacts of this type, may be {@code null}. - * @param properties The properties for artifacts of this type, may be {@code null}. - */ - public DefaultArtifactType( String id, String extension, String classifier, Map properties ) - { - if ( id == null || id.length() < 0 ) - { - throw new IllegalArgumentException( "no type id specified" ); - } - this.id = id; - this.extension = emptify( extension ); - this.classifier = emptify( classifier ); - this.properties = AbstractArtifact.copyProperties( properties ); - } - - private static String emptify( String str ) - { - return ( str == null ) ? "" : str; - } - - public String getId() - { - return id; - } - - public String getExtension() - { - return extension; - } - - public String getClassifier() - { - return classifier; - } - - public Map getProperties() - { - return properties; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-api/src/main/java/org/eclipse/aether/artifact/package-info.java ---------------------------------------------------------------------- diff --git a/aether-api/src/main/java/org/eclipse/aether/artifact/package-info.java b/aether-api/src/main/java/org/eclipse/aether/artifact/package-info.java deleted file mode 100644 index 9a4cc79..0000000 --- a/aether-api/src/main/java/org/eclipse/aether/artifact/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 an artifact, that is the primary entity managed by the repository system. - */ -package org.eclipse.aether.artifact; -