View Javadoc
1   package org.eclipse.aether;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   * 
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   * 
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.Map;
23  
24  import org.eclipse.aether.artifact.ArtifactTypeRegistry;
25  import org.eclipse.aether.collection.DependencyGraphTransformer;
26  import org.eclipse.aether.collection.DependencyManager;
27  import org.eclipse.aether.collection.DependencySelector;
28  import org.eclipse.aether.collection.DependencyTraverser;
29  import org.eclipse.aether.collection.VersionFilter;
30  import org.eclipse.aether.repository.AuthenticationSelector;
31  import org.eclipse.aether.repository.LocalRepository;
32  import org.eclipse.aether.repository.LocalRepositoryManager;
33  import org.eclipse.aether.repository.MirrorSelector;
34  import org.eclipse.aether.repository.ProxySelector;
35  import org.eclipse.aether.repository.WorkspaceReader;
36  import org.eclipse.aether.resolution.ArtifactDescriptorPolicy;
37  import org.eclipse.aether.resolution.ResolutionErrorPolicy;
38  import org.eclipse.aether.transfer.TransferListener;
39  
40  /**
41   * A special repository system session to enable decorating or proxying another session. To do so, clients have to
42   * create a subclass and implement {@link #getSession()}.
43   */
44  public abstract class AbstractForwardingRepositorySystemSession
45      implements RepositorySystemSession
46  {
47  
48      /**
49       * Creates a new forwarding session.
50       */
51      protected AbstractForwardingRepositorySystemSession()
52      {
53      }
54  
55      /**
56       * Gets the repository system session to which this instance forwards calls. It's worth noting that this class does
57       * not save/cache the returned reference but queries this method before each forwarding. Hence, the session
58       * forwarded to may change over time or depending on the context (e.g. calling thread).
59       * 
60       * @return The repository system session to forward calls to, never {@code null}.
61       */
62      protected abstract RepositorySystemSession getSession();
63  
64      public boolean isOffline()
65      {
66          return getSession().isOffline();
67      }
68  
69      public boolean isIgnoreArtifactDescriptorRepositories()
70      {
71          return getSession().isIgnoreArtifactDescriptorRepositories();
72      }
73  
74      public ResolutionErrorPolicy getResolutionErrorPolicy()
75      {
76          return getSession().getResolutionErrorPolicy();
77      }
78  
79      public ArtifactDescriptorPolicy getArtifactDescriptorPolicy()
80      {
81          return getSession().getArtifactDescriptorPolicy();
82      }
83  
84      public String getChecksumPolicy()
85      {
86          return getSession().getChecksumPolicy();
87      }
88  
89      public String getUpdatePolicy()
90      {
91          return getSession().getUpdatePolicy();
92      }
93  
94      public LocalRepository getLocalRepository()
95      {
96          return getSession().getLocalRepository();
97      }
98  
99      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 }