View Javadoc
1   /*******************************************************************************
2    * Copyright (c) 2013 Sonatype, Inc.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *    Sonatype, Inc. - initial API and implementation
10   *******************************************************************************/
11  package org.eclipse.aether;
12  
13  import java.util.Map;
14  
15  import org.eclipse.aether.artifact.ArtifactTypeRegistry;
16  import org.eclipse.aether.collection.DependencyGraphTransformer;
17  import org.eclipse.aether.collection.DependencyManager;
18  import org.eclipse.aether.collection.DependencySelector;
19  import org.eclipse.aether.collection.DependencyTraverser;
20  import org.eclipse.aether.collection.VersionFilter;
21  import org.eclipse.aether.repository.AuthenticationSelector;
22  import org.eclipse.aether.repository.LocalRepository;
23  import org.eclipse.aether.repository.LocalRepositoryManager;
24  import org.eclipse.aether.repository.MirrorSelector;
25  import org.eclipse.aether.repository.ProxySelector;
26  import org.eclipse.aether.repository.WorkspaceReader;
27  import org.eclipse.aether.resolution.ArtifactDescriptorPolicy;
28  import org.eclipse.aether.resolution.ResolutionErrorPolicy;
29  import org.eclipse.aether.transfer.TransferListener;
30  
31  /**
32   * A special repository system session to enable decorating or proxying another session. To do so, clients have to
33   * create a subclass and implement {@link #getSession()}.
34   */
35  public abstract class AbstractForwardingRepositorySystemSession
36      implements RepositorySystemSession
37  {
38  
39      /**
40       * Creates a new forwarding session.
41       */
42      protected AbstractForwardingRepositorySystemSession()
43      {
44      }
45  
46      /**
47       * Gets the repository system session to which this instance forwards calls. It's worth noting that this class does
48       * not save/cache the returned reference but queries this method before each forwarding. Hence, the session
49       * forwarded to may change over time or depending on the context (e.g. calling thread).
50       * 
51       * @return The repository system session to forward calls to, never {@code null}.
52       */
53      protected abstract RepositorySystemSession getSession();
54  
55      public boolean isOffline()
56      {
57          return getSession().isOffline();
58      }
59  
60      public boolean isIgnoreArtifactDescriptorRepositories()
61      {
62          return getSession().isIgnoreArtifactDescriptorRepositories();
63      }
64  
65      public ResolutionErrorPolicy getResolutionErrorPolicy()
66      {
67          return getSession().getResolutionErrorPolicy();
68      }
69  
70      public ArtifactDescriptorPolicy getArtifactDescriptorPolicy()
71      {
72          return getSession().getArtifactDescriptorPolicy();
73      }
74  
75      public String getChecksumPolicy()
76      {
77          return getSession().getChecksumPolicy();
78      }
79  
80      public String getUpdatePolicy()
81      {
82          return getSession().getUpdatePolicy();
83      }
84  
85      public LocalRepository getLocalRepository()
86      {
87          return getSession().getLocalRepository();
88      }
89  
90      public LocalRepositoryManager getLocalRepositoryManager()
91      {
92          return getSession().getLocalRepositoryManager();
93      }
94  
95      public WorkspaceReader getWorkspaceReader()
96      {
97          return getSession().getWorkspaceReader();
98      }
99  
100     public RepositoryListener getRepositoryListener()
101     {
102         return getSession().getRepositoryListener();
103     }
104 
105     public TransferListener getTransferListener()
106     {
107         return getSession().getTransferListener();
108     }
109 
110     public Map<String, String> getSystemProperties()
111     {
112         return getSession().getSystemProperties();
113     }
114 
115     public Map<String, String> getUserProperties()
116     {
117         return getSession().getUserProperties();
118     }
119 
120     public Map<String, Object> getConfigProperties()
121     {
122         return getSession().getConfigProperties();
123     }
124 
125     public MirrorSelector getMirrorSelector()
126     {
127         return getSession().getMirrorSelector();
128     }
129 
130     public ProxySelector getProxySelector()
131     {
132         return getSession().getProxySelector();
133     }
134 
135     public AuthenticationSelector getAuthenticationSelector()
136     {
137         return getSession().getAuthenticationSelector();
138     }
139 
140     public ArtifactTypeRegistry getArtifactTypeRegistry()
141     {
142         return getSession().getArtifactTypeRegistry();
143     }
144 
145     public DependencyTraverser getDependencyTraverser()
146     {
147         return getSession().getDependencyTraverser();
148     }
149 
150     public DependencyManager getDependencyManager()
151     {
152         return getSession().getDependencyManager();
153     }
154 
155     public DependencySelector getDependencySelector()
156     {
157         return getSession().getDependencySelector();
158     }
159 
160     public VersionFilter getVersionFilter()
161     {
162         return getSession().getVersionFilter();
163     }
164 
165     public DependencyGraphTransformer getDependencyGraphTransformer()
166     {
167         return getSession().getDependencyGraphTransformer();
168     }
169 
170     public SessionData getData()
171     {
172         return getSession().getData();
173     }
174 
175     public RepositoryCache getCache()
176     {
177         return getSession().getCache();
178     }
179 
180 }