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