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.transfer.TransferListener; 038 039/** 040 * A special repository system session to enable decorating or proxying another session. To do so, clients have to 041 * create a subclass and implement {@link #getSession()}, and optionally override other methods. 042 */ 043public abstract class AbstractForwardingRepositorySystemSession implements RepositorySystemSession { 044 045 /** 046 * Creates a new forwarding session. 047 */ 048 protected AbstractForwardingRepositorySystemSession() {} 049 050 /** 051 * Gets the repository system session to which this instance forwards calls. It's worth noting that this class does 052 * not save/cache the returned reference but queries this method before each forwarding. Hence, the session 053 * forwarded to may change over time or depending on the context (e.g. calling thread). 054 * 055 * @return The repository system session to forward calls to, never {@code null}. 056 */ 057 protected abstract RepositorySystemSession getSession(); 058 059 @Override 060 public boolean isOffline() { 061 return getSession().isOffline(); 062 } 063 064 @Override 065 public boolean isIgnoreArtifactDescriptorRepositories() { 066 return getSession().isIgnoreArtifactDescriptorRepositories(); 067 } 068 069 @Override 070 public ResolutionErrorPolicy getResolutionErrorPolicy() { 071 return getSession().getResolutionErrorPolicy(); 072 } 073 074 @Override 075 public ArtifactDescriptorPolicy getArtifactDescriptorPolicy() { 076 return getSession().getArtifactDescriptorPolicy(); 077 } 078 079 @Override 080 public String getChecksumPolicy() { 081 return getSession().getChecksumPolicy(); 082 } 083 084 @Override 085 public String getUpdatePolicy() { 086 return getSession().getUpdatePolicy(); 087 } 088 089 @Override 090 public String getArtifactUpdatePolicy() { 091 return getSession().getArtifactUpdatePolicy(); 092 } 093 094 @Override 095 public String getMetadataUpdatePolicy() { 096 return getSession().getMetadataUpdatePolicy(); 097 } 098 099 @Override 100 public LocalRepository getLocalRepository() { 101 return getSession().getLocalRepository(); 102 } 103 104 @Override 105 public LocalRepositoryManager getLocalRepositoryManager() { 106 return getSession().getLocalRepositoryManager(); 107 } 108 109 @Override 110 public WorkspaceReader getWorkspaceReader() { 111 return getSession().getWorkspaceReader(); 112 } 113 114 @Override 115 public RepositoryListener getRepositoryListener() { 116 return getSession().getRepositoryListener(); 117 } 118 119 @Override 120 public TransferListener getTransferListener() { 121 return getSession().getTransferListener(); 122 } 123 124 @Override 125 public Map<String, String> getSystemProperties() { 126 return getSession().getSystemProperties(); 127 } 128 129 @Override 130 public Map<String, String> getUserProperties() { 131 return getSession().getUserProperties(); 132 } 133 134 @Override 135 public Map<String, Object> getConfigProperties() { 136 return getSession().getConfigProperties(); 137 } 138 139 @Override 140 public MirrorSelector getMirrorSelector() { 141 return getSession().getMirrorSelector(); 142 } 143 144 @Override 145 public ProxySelector getProxySelector() { 146 return getSession().getProxySelector(); 147 } 148 149 @Override 150 public AuthenticationSelector getAuthenticationSelector() { 151 return getSession().getAuthenticationSelector(); 152 } 153 154 @Override 155 public ArtifactTypeRegistry getArtifactTypeRegistry() { 156 return getSession().getArtifactTypeRegistry(); 157 } 158 159 @Override 160 public DependencyTraverser getDependencyTraverser() { 161 return getSession().getDependencyTraverser(); 162 } 163 164 @Override 165 public DependencyManager getDependencyManager() { 166 return getSession().getDependencyManager(); 167 } 168 169 @Override 170 public DependencySelector getDependencySelector() { 171 return getSession().getDependencySelector(); 172 } 173 174 @Override 175 public VersionFilter getVersionFilter() { 176 return getSession().getVersionFilter(); 177 } 178 179 @Override 180 public DependencyGraphTransformer getDependencyGraphTransformer() { 181 return getSession().getDependencyGraphTransformer(); 182 } 183 184 @Override 185 public SessionData getData() { 186 return getSession().getData(); 187 } 188 189 @Override 190 public RepositoryCache getCache() { 191 return getSession().getCache(); 192 } 193 194 @Override 195 public boolean addOnSessionEndedHandler(Runnable handler) { 196 return getSession().addOnSessionEndedHandler(handler); 197 } 198}