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