X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2FRepositorySystem.java;fp=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2FRepositorySystem.java;h=debdb7d190ed148b61b6151b77d810d00222984a;hb=825d60c5348dbe3f5be25b0bccf7bdebfe694219;hp=0000000000000000000000000000000000000000;hpb=5e991fff5cba01858dcc5747a27e637325bc5c8e;p=gpl%2Fargeo-jcr.git diff --git a/org.argeo.slc.repo/src/org/eclipse/aether/RepositorySystem.java b/org.argeo.slc.repo/src/org/eclipse/aether/RepositorySystem.java new file mode 100644 index 0000000..debdb7d --- /dev/null +++ b/org.argeo.slc.repo/src/org/eclipse/aether/RepositorySystem.java @@ -0,0 +1,268 @@ +/******************************************************************************* + * Copyright (c) 2010, 2014 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether; + +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