001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.eclipse.aether; 020 021import java.util.Map; 022 023import org.eclipse.aether.artifact.ArtifactTypeRegistry; 024import org.eclipse.aether.collection.DependencyGraphTransformer; 025import org.eclipse.aether.collection.DependencyManager; 026import org.eclipse.aether.collection.DependencySelector; 027import org.eclipse.aether.collection.DependencyTraverser; 028import org.eclipse.aether.collection.VersionFilter; 029import org.eclipse.aether.repository.AuthenticationSelector; 030import org.eclipse.aether.repository.LocalRepository; 031import org.eclipse.aether.repository.LocalRepositoryManager; 032import org.eclipse.aether.repository.MirrorSelector; 033import org.eclipse.aether.repository.ProxySelector; 034import org.eclipse.aether.repository.WorkspaceReader; 035import org.eclipse.aether.resolution.ArtifactDescriptorPolicy; 036import org.eclipse.aether.resolution.ResolutionErrorPolicy; 037import org.eclipse.aether.scope.ScopeManager; 038import org.eclipse.aether.scope.SystemDependencyScope; 039import org.eclipse.aether.transfer.TransferListener; 040 041/** 042 * A special repository system session to enable decorating or proxying another session. To do so, clients have to 043 * create a subclass and implement {@link #getSession()}, and optionally override other methods. 044 */ 045public abstract class AbstractForwardingRepositorySystemSession implements RepositorySystemSession { 046 047 /** 048 * Creates a new forwarding session. 049 */ 050 protected AbstractForwardingRepositorySystemSession() {} 051 052 /** 053 * Gets the repository system session to which this instance forwards calls. It's worth noting that this class does 054 * not save/cache the returned reference but queries this method before each forwarding. Hence, the session 055 * forwarded to may change over time or depending on the context (e.g. calling thread). 056 * 057 * @return The repository system session to forward calls to, never {@code null}. 058 */ 059 protected abstract RepositorySystemSession getSession(); 060 061 @Override 062 public boolean isOffline() { 063 return getSession().isOffline(); 064 } 065 066 @Override 067 public boolean isIgnoreArtifactDescriptorRepositories() { 068 return getSession().isIgnoreArtifactDescriptorRepositories(); 069 } 070 071 @Override 072 public ResolutionErrorPolicy getResolutionErrorPolicy() { 073 return getSession().getResolutionErrorPolicy(); 074 } 075 076 @Override 077 public ArtifactDescriptorPolicy getArtifactDescriptorPolicy() { 078 return getSession().getArtifactDescriptorPolicy(); 079 } 080 081 @Override 082 public String getChecksumPolicy() { 083 return getSession().getChecksumPolicy(); 084 } 085 086 @Override 087 public String getUpdatePolicy() { 088 return getSession().getUpdatePolicy(); 089 } 090 091 @Override 092 public String getArtifactUpdatePolicy() { 093 return getSession().getArtifactUpdatePolicy(); 094 } 095 096 @Override 097 public String getMetadataUpdatePolicy() { 098 return getSession().getMetadataUpdatePolicy(); 099 } 100 101 @Override 102 public LocalRepository getLocalRepository() { 103 return getSession().getLocalRepository(); 104 } 105 106 @Override 107 public LocalRepositoryManager getLocalRepositoryManager() { 108 return getSession().getLocalRepositoryManager(); 109 } 110 111 @Override 112 public WorkspaceReader getWorkspaceReader() { 113 return getSession().getWorkspaceReader(); 114 } 115 116 @Override 117 public RepositoryListener getRepositoryListener() { 118 return getSession().getRepositoryListener(); 119 } 120 121 @Override 122 public TransferListener getTransferListener() { 123 return getSession().getTransferListener(); 124 } 125 126 @Override 127 public Map<String, String> getSystemProperties() { 128 return getSession().getSystemProperties(); 129 } 130 131 @Override 132 public Map<String, String> getUserProperties() { 133 return getSession().getUserProperties(); 134 } 135 136 @Override 137 public Map<String, Object> getConfigProperties() { 138 return getSession().getConfigProperties(); 139 } 140 141 @Override 142 public MirrorSelector getMirrorSelector() { 143 return getSession().getMirrorSelector(); 144 } 145 146 @Override 147 public ProxySelector getProxySelector() { 148 return getSession().getProxySelector(); 149 } 150 151 @Override 152 public AuthenticationSelector getAuthenticationSelector() { 153 return getSession().getAuthenticationSelector(); 154 } 155 156 @Override 157 public ArtifactTypeRegistry getArtifactTypeRegistry() { 158 return getSession().getArtifactTypeRegistry(); 159 } 160 161 @Override 162 public DependencyTraverser getDependencyTraverser() { 163 return getSession().getDependencyTraverser(); 164 } 165 166 @Override 167 public DependencyManager getDependencyManager() { 168 return getSession().getDependencyManager(); 169 } 170 171 @Override 172 public DependencySelector getDependencySelector() { 173 return getSession().getDependencySelector(); 174 } 175 176 @Override 177 public VersionFilter getVersionFilter() { 178 return getSession().getVersionFilter(); 179 } 180 181 @Override 182 public DependencyGraphTransformer getDependencyGraphTransformer() { 183 return getSession().getDependencyGraphTransformer(); 184 } 185 186 @Override 187 public SessionData getData() { 188 return getSession().getData(); 189 } 190 191 @Override 192 public RepositoryCache getCache() { 193 return getSession().getCache(); 194 } 195 196 @Override 197 public ScopeManager getScopeManager() { 198 return getSession().getScopeManager(); 199 } 200 201 @Override 202 public SystemDependencyScope getSystemDependencyScope() { 203 return getSession().getSystemDependencyScope(); 204 } 205 206 @Override 207 public boolean addOnSessionEndedHandler(Runnable handler) { 208 return getSession().addOnSessionEndedHandler(handler); 209 } 210}