You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2013/03/18 22:47:28 UTC

[24/50] git commit: MNG-5381: Restore MavenSession.getRepositoryCache() for Tycho users so they are not forced to upgrade to 3.1

MNG-5381: Restore MavenSession.getRepositoryCache() for Tycho users so they are not forced to upgrade to 3.1


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/08d2b341
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/08d2b341
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/08d2b341

Branch: refs/heads/master
Commit: 08d2b3418e5b9b33afe72fc5a177834d54549a54
Parents: 4c61954
Author: Jason van Zyl <jv...@apache.org>
Authored: Mon Nov 19 22:56:53 2012 -0500
Committer: Jason van Zyl <jv...@apache.org>
Committed: Mon Nov 19 22:56:53 2012 -0500

----------------------------------------------------------------------
 .../maven/artifact/repository/RepositoryCache.java |   58 +++++++++++++++
 .../resolver/ArtifactResolutionRequest.java        |    9 ++
 .../org/apache/maven/execution/MavenSession.java   |   11 +++
 3 files changed, 78 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/08d2b341/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryCache.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryCache.java
new file mode 100644
index 0000000..3afe33d
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryCache.java
@@ -0,0 +1,58 @@
+package org.apache.maven.artifact.repository;
+
+/*
+ * 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.
+ */
+
+/**
+ * Caches auxiliary data used during repository access like already processed metadata. The data in the cache is meant
+ * for exclusive consumption by the repository system and is opaque to the cache implementation.
+ * 
+ * @author Benjamin Bentmann
+ */
+@Deprecated
+//
+// Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
+// this here, possibly indefinitely.
+//
+public interface RepositoryCache
+{
+
+    /**
+     * Puts the specified data into the cache. <strong>Warning:</strong> The cache will directly save the provided
+     * reference. If the cached data is mutable, i.e. could be modified after being put into the cache, the caller is
+     * responsible for creating a copy of the original data and store the copy in the cache.
+     * 
+     * @param request The repository request from which this cache was retrieved, must not be {@code null}.
+     * @param key The key to use associate the data with, must not be {@code null}.
+     * @param data The data to store in the cache, may be {@code null}.
+     */
+    void put( RepositoryRequest request, Object key, Object data );
+
+    /**
+     * Gets the specified data from the cache. <strong>Warning:</strong> The cache will directly return the saved
+     * reference. If the cached data is to be modified after its retrieval, the caller is responsible to create a copy
+     * of the returned data and use this instead of the cache record.
+     * 
+     * @param request The repository request from which this cache was retrieved, must not be {@code null}.
+     * @param key The key to use for lookup of the data, must not be {@code null}.
+     * @return The requested data or {@code null} if none was present in the cache.
+     */
+    Object get( RepositoryRequest request, Object key );
+
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/08d2b341/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
index fe8d1f2..890b466 100644
--- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
@@ -26,6 +26,7 @@ import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.RepositoryCache;
 import org.apache.maven.artifact.repository.RepositoryRequest;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.settings.Mirror;
@@ -317,4 +318,12 @@ public class ArtifactResolutionRequest
         return proxies;
     }
 
+    //
+    // Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
+    // this here, possibly indefinitely.
+    //
+    public ArtifactResolutionRequest setCache( RepositoryCache cache )                                                                                             
+    {                                                                                                                                                              
+        return this;                                                                                                                                               
+    }                    
 }

http://git-wip-us.apache.org/repos/asf/maven/blob/08d2b341/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
index 21ac388..30ff333 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
@@ -28,6 +28,7 @@ import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.RepositoryCache;
 import org.apache.maven.monitor.event.EventDispatcher;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
@@ -381,4 +382,14 @@ public class MavenSession
         return repositorySession;
     }
 
+    @Deprecated
+    //
+    // Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
+    // this here, possibly indefinitely.
+    //
+    public RepositoryCache getRepositoryCache()
+    {
+        return null;
+    }
+
 }