View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.buildcache;
20  
21  import javax.annotation.Nonnull;
22  import javax.inject.Named;
23  
24  import java.io.IOException;
25  import java.nio.file.Path;
26  import java.util.Optional;
27  
28  import org.apache.maven.SessionScoped;
29  import org.apache.maven.artifact.Artifact;
30  import org.apache.maven.buildcache.xml.Build;
31  import org.apache.maven.buildcache.xml.report.CacheReport;
32  import org.apache.maven.execution.MavenSession;
33  import org.apache.maven.project.MavenProject;
34  
35  @SessionScoped
36  @Named("noop")
37  public class RemoteCacheRepositoryNoOp implements RemoteCacheRepository {
38  
39      @Nonnull
40      @Override
41      public Optional<Build> findBuild(CacheContext context) throws IOException {
42          return Optional.empty();
43      }
44  
45      @Override
46      public void saveBuildInfo(CacheResult cacheResult, Build build) throws IOException {}
47  
48      @Override
49      public void saveArtifactFile(CacheResult cacheResult, Artifact artifact) throws IOException {}
50  
51      @Override
52      public void saveCacheReport(String buildId, MavenSession session, CacheReport cacheReport) throws IOException {}
53  
54      @Override
55      public boolean getArtifactContent(
56              CacheContext context, org.apache.maven.buildcache.xml.build.Artifact artifact, Path target)
57              throws IOException {
58          return false;
59      }
60  
61      @Nonnull
62      @Override
63      public String getResourceUrl(CacheContext context, String filename) {
64          return null;
65      }
66  
67      @Nonnull
68      @Override
69      public Optional<Build> findBaselineBuild(MavenProject project) {
70          return Optional.empty();
71      }
72  }