001package org.eclipse.aether.impl.guice; 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.Collections; 023import java.util.HashMap; 024import java.util.HashSet; 025import java.util.Map; 026import java.util.Set; 027 028import javax.inject.Named; 029import javax.inject.Singleton; 030 031import org.eclipse.aether.RepositoryListener; 032import org.eclipse.aether.RepositorySystem; 033import org.eclipse.aether.impl.ArtifactResolver; 034import org.eclipse.aether.impl.DependencyCollector; 035import org.eclipse.aether.impl.Deployer; 036import org.eclipse.aether.impl.Installer; 037import org.eclipse.aether.impl.LocalRepositoryProvider; 038import org.eclipse.aether.impl.MetadataResolver; 039import org.eclipse.aether.impl.OfflineController; 040import org.eclipse.aether.impl.RemoteRepositoryFilterManager; 041import org.eclipse.aether.impl.RemoteRepositoryManager; 042import org.eclipse.aether.impl.RepositoryConnectorProvider; 043import org.eclipse.aether.impl.RepositoryEventDispatcher; 044import org.eclipse.aether.impl.RepositorySystemLifecycle; 045import org.eclipse.aether.internal.impl.DefaultLocalPathPrefixComposerFactory; 046import org.eclipse.aether.internal.impl.DefaultRepositorySystemLifecycle; 047import org.eclipse.aether.internal.impl.LocalPathComposer; 048import org.eclipse.aether.internal.impl.DefaultLocalPathComposer; 049import org.eclipse.aether.internal.impl.DefaultTrackingFileManager; 050import org.eclipse.aether.internal.impl.LocalPathPrefixComposerFactory; 051import org.eclipse.aether.internal.impl.TrackingFileManager; 052import org.eclipse.aether.internal.impl.checksum.SummaryFileTrustedChecksumsSource; 053import org.eclipse.aether.internal.impl.checksum.Md5ChecksumAlgorithmFactory; 054import org.eclipse.aether.internal.impl.checksum.Sha1ChecksumAlgorithmFactory; 055import org.eclipse.aether.internal.impl.checksum.Sha256ChecksumAlgorithmFactory; 056import org.eclipse.aether.internal.impl.checksum.Sha512ChecksumAlgorithmFactory; 057import org.eclipse.aether.internal.impl.checksum.DefaultChecksumAlgorithmFactorySelector; 058import org.eclipse.aether.internal.impl.checksum.SparseDirectoryTrustedChecksumsSource; 059import org.eclipse.aether.internal.impl.checksum.TrustedToProvidedChecksumsSourceAdapter; 060import org.eclipse.aether.internal.impl.collect.DependencyCollectorDelegate; 061import org.eclipse.aether.internal.impl.collect.bf.BfDependencyCollector; 062import org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector; 063import org.eclipse.aether.internal.impl.filter.DefaultRemoteRepositoryFilterManager; 064import org.eclipse.aether.internal.impl.filter.GroupIdRemoteRepositoryFilterSource; 065import org.eclipse.aether.internal.impl.filter.PrefixesRemoteRepositoryFilterSource; 066import org.eclipse.aether.internal.impl.resolution.TrustedChecksumsArtifactResolverPostProcessor; 067import org.eclipse.aether.internal.impl.synccontext.DefaultSyncContextFactory; 068import org.eclipse.aether.internal.impl.synccontext.named.NameMappers; 069import org.eclipse.aether.internal.impl.synccontext.named.NamedLockFactoryAdapterFactoryImpl; 070import org.eclipse.aether.internal.impl.synccontext.named.NameMapper; 071import org.eclipse.aether.internal.impl.synccontext.named.NamedLockFactoryAdapterFactory; 072import org.eclipse.aether.internal.impl.synccontext.named.providers.DiscriminatingNameMapperProvider; 073import org.eclipse.aether.internal.impl.synccontext.named.providers.FileGAVNameMapperProvider; 074import org.eclipse.aether.internal.impl.synccontext.named.providers.FileHashingGAVNameMapperProvider; 075import org.eclipse.aether.internal.impl.synccontext.named.providers.GAVNameMapperProvider; 076import org.eclipse.aether.internal.impl.synccontext.named.providers.StaticNameMapperProvider; 077import org.eclipse.aether.named.NamedLockFactory; 078import org.eclipse.aether.named.providers.FileLockNamedLockFactory; 079import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory; 080import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory; 081import org.eclipse.aether.impl.UpdateCheckManager; 082import org.eclipse.aether.impl.UpdatePolicyAnalyzer; 083import org.eclipse.aether.internal.impl.DefaultArtifactResolver; 084import org.eclipse.aether.internal.impl.DefaultChecksumPolicyProvider; 085import org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector; 086import org.eclipse.aether.internal.impl.DefaultDeployer; 087import org.eclipse.aether.internal.impl.DefaultFileProcessor; 088import org.eclipse.aether.internal.impl.DefaultInstaller; 089import org.eclipse.aether.internal.impl.DefaultLocalRepositoryProvider; 090import org.eclipse.aether.internal.impl.DefaultMetadataResolver; 091import org.eclipse.aether.internal.impl.DefaultOfflineController; 092import org.eclipse.aether.internal.impl.DefaultRemoteRepositoryManager; 093import org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider; 094import org.eclipse.aether.internal.impl.DefaultRepositoryEventDispatcher; 095import org.eclipse.aether.internal.impl.DefaultRepositoryLayoutProvider; 096import org.eclipse.aether.internal.impl.DefaultRepositorySystem; 097import org.eclipse.aether.internal.impl.DefaultTransporterProvider; 098import org.eclipse.aether.internal.impl.DefaultUpdateCheckManager; 099import org.eclipse.aether.internal.impl.DefaultUpdatePolicyAnalyzer; 100import org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManagerFactory; 101import org.eclipse.aether.internal.impl.Maven2RepositoryLayoutFactory; 102import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; 103import org.eclipse.aether.internal.impl.slf4j.Slf4jLoggerFactory; 104import org.eclipse.aether.named.providers.NoopNamedLockFactory; 105import org.eclipse.aether.spi.checksums.TrustedChecksumsSource; 106import org.eclipse.aether.spi.connector.checksum.ProvidedChecksumsSource; 107import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector; 108import org.eclipse.aether.spi.connector.checksum.ChecksumPolicyProvider; 109import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory; 110import org.eclipse.aether.spi.connector.filter.RemoteRepositoryFilterSource; 111import org.eclipse.aether.spi.connector.layout.RepositoryLayoutFactory; 112import org.eclipse.aether.spi.connector.layout.RepositoryLayoutProvider; 113import org.eclipse.aether.spi.connector.transport.TransporterProvider; 114import org.eclipse.aether.spi.io.FileProcessor; 115import org.eclipse.aether.spi.localrepo.LocalRepositoryManagerFactory; 116import org.eclipse.aether.spi.log.LoggerFactory; 117import org.eclipse.aether.spi.resolution.ArtifactResolverPostProcessor; 118import org.eclipse.aether.spi.synccontext.SyncContextFactory; 119import org.slf4j.ILoggerFactory; 120 121import com.google.inject.AbstractModule; 122import com.google.inject.Provides; 123import com.google.inject.name.Names; 124 125/** 126 * A ready-made <a href="https://github.com/google/guice" target="_blank">Guice</a> module that sets up bindings 127 * for all components from this library. To acquire a complete repository system, clients need to bind an artifact 128 * descriptor reader, a version resolver, a version range resolver, zero or more metadata generator factories, some 129 * repository connector and transporter factories to access remote repositories. 130 * 131 * @noextend This class must not be extended by clients and will eventually be marked {@code final} without prior 132 * notice. 133 */ 134public class AetherModule 135 extends AbstractModule 136{ 137 138 /** 139 * Creates a new instance of this Guice module, typically for invoking 140 * {@link com.google.inject.Binder#install(com.google.inject.Module)}. 141 */ 142 public AetherModule() 143 { 144 } 145 146 /** 147 * Configures Guice with bindings for Aether components provided by this library. 148 */ 149 @Override 150 protected void configure() 151 { 152 bind( RepositorySystem.class ) // 153 .to( DefaultRepositorySystem.class ).in( Singleton.class ); 154 bind( ArtifactResolver.class ) // 155 .to( DefaultArtifactResolver.class ).in( Singleton.class ); 156 157 bind( DependencyCollector.class ) // 158 .to( DefaultDependencyCollector.class ).in( Singleton.class ); 159 bind( DependencyCollectorDelegate.class ).annotatedWith( Names.named( BfDependencyCollector.NAME ) ) 160 .to( BfDependencyCollector.class ).in( Singleton.class ); 161 bind( DependencyCollectorDelegate.class ).annotatedWith( Names.named( DfDependencyCollector.NAME ) ) 162 .to( DfDependencyCollector.class ).in( Singleton.class ); 163 164 bind( Deployer.class ) // 165 .to( DefaultDeployer.class ).in( Singleton.class ); 166 bind( Installer.class ) // 167 .to( DefaultInstaller.class ).in( Singleton.class ); 168 bind( MetadataResolver.class ) // 169 .to( DefaultMetadataResolver.class ).in( Singleton.class ); 170 bind( RepositoryLayoutProvider.class ) // 171 .to( DefaultRepositoryLayoutProvider.class ).in( Singleton.class ); 172 bind( RepositoryLayoutFactory.class ).annotatedWith( Names.named( "maven2" ) ) // 173 .to( Maven2RepositoryLayoutFactory.class ).in( Singleton.class ); 174 bind( TransporterProvider.class ) // 175 .to( DefaultTransporterProvider.class ).in( Singleton.class ); 176 bind( ChecksumPolicyProvider.class ) // 177 .to( DefaultChecksumPolicyProvider.class ).in( Singleton.class ); 178 bind( RepositoryConnectorProvider.class ) // 179 .to( DefaultRepositoryConnectorProvider.class ).in( Singleton.class ); 180 bind( RemoteRepositoryManager.class ) // 181 .to( DefaultRemoteRepositoryManager.class ).in( Singleton.class ); 182 bind( UpdateCheckManager.class ) // 183 .to( DefaultUpdateCheckManager.class ).in( Singleton.class ); 184 bind( UpdatePolicyAnalyzer.class ) // 185 .to( DefaultUpdatePolicyAnalyzer.class ).in( Singleton.class ); 186 bind( FileProcessor.class ) // 187 .to( DefaultFileProcessor.class ).in( Singleton.class ); 188 bind( RepositoryEventDispatcher.class ) // 189 .to( DefaultRepositoryEventDispatcher.class ).in( Singleton.class ); 190 bind( OfflineController.class ) // 191 .to( DefaultOfflineController.class ).in( Singleton.class ); 192 193 bind( LocalPathComposer.class ) 194 .to( DefaultLocalPathComposer.class ).in( Singleton.class ); 195 bind( LocalPathPrefixComposerFactory.class ) 196 .to( DefaultLocalPathPrefixComposerFactory.class ).in( Singleton.class ); 197 198 bind( LocalRepositoryProvider.class ) // 199 .to( DefaultLocalRepositoryProvider.class ).in( Singleton.class ); 200 bind( LocalRepositoryManagerFactory.class ).annotatedWith( Names.named( "simple" ) ) // 201 .to( SimpleLocalRepositoryManagerFactory.class ).in( Singleton.class ); 202 bind( LocalRepositoryManagerFactory.class ).annotatedWith( Names.named( "enhanced" ) ) // 203 .to( EnhancedLocalRepositoryManagerFactory.class ).in( Singleton.class ); 204 bind( TrackingFileManager.class ).to( DefaultTrackingFileManager.class ).in( Singleton.class ); 205 206 bind( ProvidedChecksumsSource.class ) 207 .annotatedWith( Names.named( TrustedToProvidedChecksumsSourceAdapter.NAME ) ) 208 .to( TrustedToProvidedChecksumsSourceAdapter.class ).in( Singleton.class ); 209 210 bind( TrustedChecksumsSource.class ).annotatedWith( Names.named( SparseDirectoryTrustedChecksumsSource.NAME ) ) 211 .to( SparseDirectoryTrustedChecksumsSource.class ).in( Singleton.class ); 212 bind( TrustedChecksumsSource.class ).annotatedWith( Names.named( SummaryFileTrustedChecksumsSource.NAME ) ) 213 .to( SummaryFileTrustedChecksumsSource.class ).in( Singleton.class ); 214 215 bind( ArtifactResolverPostProcessor.class ) 216 .annotatedWith( Names.named( TrustedChecksumsArtifactResolverPostProcessor.NAME ) ) 217 .to( TrustedChecksumsArtifactResolverPostProcessor.class ).in( Singleton.class ); 218 219 bind( ChecksumAlgorithmFactory.class ).annotatedWith( Names.named( Md5ChecksumAlgorithmFactory.NAME ) ) 220 .to( Md5ChecksumAlgorithmFactory.class ); 221 bind( ChecksumAlgorithmFactory.class ).annotatedWith( Names.named( Sha1ChecksumAlgorithmFactory.NAME ) ) 222 .to( Sha1ChecksumAlgorithmFactory.class ); 223 bind( ChecksumAlgorithmFactory.class ).annotatedWith( Names.named( Sha256ChecksumAlgorithmFactory.NAME ) ) 224 .to( Sha256ChecksumAlgorithmFactory.class ); 225 bind( ChecksumAlgorithmFactory.class ).annotatedWith( Names.named( Sha512ChecksumAlgorithmFactory.NAME ) ) 226 .to( Sha512ChecksumAlgorithmFactory.class ); 227 bind( ChecksumAlgorithmFactorySelector.class ) 228 .to( DefaultChecksumAlgorithmFactorySelector.class ).in ( Singleton.class ); 229 230 bind( RepositorySystemLifecycle.class ) 231 .to( DefaultRepositorySystemLifecycle.class ).in( Singleton.class ); 232 233 bind( NamedLockFactoryAdapterFactory.class ) 234 .to( NamedLockFactoryAdapterFactoryImpl.class ).in( Singleton.class ); 235 bind( SyncContextFactory.class ).to( DefaultSyncContextFactory.class ).in( Singleton.class ); 236 bind( org.eclipse.aether.impl.SyncContextFactory.class ) 237 .to( org.eclipse.aether.internal.impl.synccontext.legacy.DefaultSyncContextFactory.class ) 238 .in( Singleton.class ); 239 240 bind( NameMapper.class ).annotatedWith( Names.named( NameMappers.STATIC_NAME ) ) 241 .toProvider( StaticNameMapperProvider.class ).in( Singleton.class ); 242 bind( NameMapper.class ).annotatedWith( Names.named( NameMappers.GAV_NAME ) ) 243 .toProvider( GAVNameMapperProvider.class ).in( Singleton.class ); 244 bind( NameMapper.class ).annotatedWith( Names.named( NameMappers.DISCRIMINATING_NAME ) ) 245 .toProvider( DiscriminatingNameMapperProvider.class ).in( Singleton.class ); 246 bind( NameMapper.class ).annotatedWith( Names.named( NameMappers.FILE_GAV_NAME ) ) 247 .toProvider( FileGAVNameMapperProvider.class ).in( Singleton.class ); 248 bind( NameMapper.class ).annotatedWith( Names.named( NameMappers.FILE_HGAV_NAME ) ) 249 .toProvider( FileHashingGAVNameMapperProvider.class ).in( Singleton.class ); 250 251 bind( NamedLockFactory.class ).annotatedWith( Names.named( NoopNamedLockFactory.NAME ) ) 252 .to( NoopNamedLockFactory.class ).in( Singleton.class ); 253 bind( NamedLockFactory.class ).annotatedWith( Names.named( LocalReadWriteLockNamedLockFactory.NAME ) ) 254 .to( LocalReadWriteLockNamedLockFactory.class ).in( Singleton.class ); 255 bind( NamedLockFactory.class ).annotatedWith( Names.named( LocalSemaphoreNamedLockFactory.NAME ) ) 256 .to( LocalSemaphoreNamedLockFactory.class ).in( Singleton.class ); 257 bind( NamedLockFactory.class ).annotatedWith( Names.named( FileLockNamedLockFactory.NAME ) ) 258 .to( FileLockNamedLockFactory.class ).in( Singleton.class ); 259 260 bind( RemoteRepositoryFilterManager.class ) 261 .to( DefaultRemoteRepositoryFilterManager.class ).in( Singleton.class ); 262 bind( RemoteRepositoryFilterSource.class ).annotatedWith( 263 Names.named( GroupIdRemoteRepositoryFilterSource.NAME ) ) 264 .to( GroupIdRemoteRepositoryFilterSource.class ).in( Singleton.class ); 265 bind( RemoteRepositoryFilterSource.class ).annotatedWith( 266 Names.named( PrefixesRemoteRepositoryFilterSource.NAME ) ) 267 .to( PrefixesRemoteRepositoryFilterSource.class ).in( Singleton.class ); 268 269 install( new Slf4jModule() ); 270 271 } 272 273 @Provides 274 @Singleton 275 Map<String, RemoteRepositoryFilterSource> remoteRepositoryFilterSources( 276 @Named( GroupIdRemoteRepositoryFilterSource.NAME ) RemoteRepositoryFilterSource groupId, 277 @Named( PrefixesRemoteRepositoryFilterSource.NAME ) RemoteRepositoryFilterSource prefixes 278 ) 279 { 280 Map<String, RemoteRepositoryFilterSource> result = new HashMap<>(); 281 result.put( GroupIdRemoteRepositoryFilterSource.NAME, groupId ); 282 result.put( PrefixesRemoteRepositoryFilterSource.NAME, prefixes ); 283 return Collections.unmodifiableMap( result ); 284 } 285 286 @Provides 287 @Singleton 288 Map<String, ArtifactResolverPostProcessor> artifactResolverProcessors( 289 @Named( TrustedChecksumsArtifactResolverPostProcessor.NAME ) ArtifactResolverPostProcessor trustedChecksums 290 ) 291 { 292 Map<String, ArtifactResolverPostProcessor> result = new HashMap<>(); 293 result.put( TrustedChecksumsArtifactResolverPostProcessor.NAME, trustedChecksums ); 294 return Collections.unmodifiableMap( result ); 295 } 296 297 @Provides 298 @Singleton 299 Map<String, DependencyCollectorDelegate> dependencyCollectorDelegates( 300 @Named( BfDependencyCollector.NAME ) DependencyCollectorDelegate bf, 301 @Named( DfDependencyCollector.NAME ) DependencyCollectorDelegate df 302 ) 303 { 304 Map<String, DependencyCollectorDelegate> result = new HashMap<>(); 305 result.put( BfDependencyCollector.NAME, bf ); 306 result.put( DfDependencyCollector.NAME, df ); 307 return Collections.unmodifiableMap( result ); 308 } 309 310 @Provides 311 @Singleton 312 Map<String, ProvidedChecksumsSource> providedChecksumSources( 313 @Named( TrustedToProvidedChecksumsSourceAdapter.NAME ) ProvidedChecksumsSource adapter 314 ) 315 { 316 Map<String, ProvidedChecksumsSource> result = new HashMap<>(); 317 result.put( TrustedToProvidedChecksumsSourceAdapter.NAME, adapter ); 318 return Collections.unmodifiableMap( result ); 319 } 320 321 @Provides 322 @Singleton 323 Map<String, TrustedChecksumsSource> trustedChecksumSources( 324 @Named( SparseDirectoryTrustedChecksumsSource.NAME ) TrustedChecksumsSource sparse, 325 @Named( SummaryFileTrustedChecksumsSource.NAME ) TrustedChecksumsSource compact 326 ) 327 { 328 Map<String, TrustedChecksumsSource> result = new HashMap<>(); 329 result.put( SparseDirectoryTrustedChecksumsSource.NAME, sparse ); 330 result.put( SummaryFileTrustedChecksumsSource.NAME, compact ); 331 return Collections.unmodifiableMap( result ); 332 } 333 334 @Provides 335 @Singleton 336 Map<String, ChecksumAlgorithmFactory> provideChecksumTypes( 337 @Named( Sha512ChecksumAlgorithmFactory.NAME ) ChecksumAlgorithmFactory sha512, 338 @Named( Sha256ChecksumAlgorithmFactory.NAME ) ChecksumAlgorithmFactory sha256, 339 @Named( Sha1ChecksumAlgorithmFactory.NAME ) ChecksumAlgorithmFactory sha1, 340 @Named( Md5ChecksumAlgorithmFactory.NAME ) ChecksumAlgorithmFactory md5 ) 341 { 342 Map<String, ChecksumAlgorithmFactory> result = new HashMap<>(); 343 result.put( Sha512ChecksumAlgorithmFactory.NAME, sha512 ); 344 result.put( Sha256ChecksumAlgorithmFactory.NAME, sha256 ); 345 result.put( Sha1ChecksumAlgorithmFactory.NAME, sha1 ); 346 result.put( Md5ChecksumAlgorithmFactory.NAME, md5 ); 347 return Collections.unmodifiableMap( result ); 348 } 349 350 @Provides 351 @Singleton 352 Map<String, NameMapper> provideNameMappers( 353 @Named( NameMappers.STATIC_NAME ) NameMapper staticNameMapper, 354 @Named( NameMappers.GAV_NAME ) NameMapper gavNameMapper, 355 @Named( NameMappers.DISCRIMINATING_NAME ) NameMapper discriminatingNameMapper, 356 @Named( NameMappers.FILE_GAV_NAME ) NameMapper fileGavNameMapper, 357 @Named( NameMappers.FILE_HGAV_NAME ) NameMapper fileHashingGavNameMapper ) 358 { 359 Map<String, NameMapper> result = new HashMap<>(); 360 result.put( NameMappers.STATIC_NAME, staticNameMapper ); 361 result.put( NameMappers.GAV_NAME, gavNameMapper ); 362 result.put( NameMappers.DISCRIMINATING_NAME, discriminatingNameMapper ); 363 result.put( NameMappers.FILE_GAV_NAME, fileGavNameMapper ); 364 result.put( NameMappers.FILE_HGAV_NAME, fileHashingGavNameMapper ); 365 return Collections.unmodifiableMap( result ); 366 } 367 368 @Provides 369 @Singleton 370 Map<String, NamedLockFactory> provideNamedLockFactories( 371 @Named( LocalReadWriteLockNamedLockFactory.NAME ) NamedLockFactory localRwLock, 372 @Named( LocalSemaphoreNamedLockFactory.NAME ) NamedLockFactory localSemaphore, 373 @Named( FileLockNamedLockFactory.NAME ) NamedLockFactory fileLockFactory ) 374 { 375 Map<String, NamedLockFactory> result = new HashMap<>(); 376 result.put( LocalReadWriteLockNamedLockFactory.NAME, localRwLock ); 377 result.put( LocalSemaphoreNamedLockFactory.NAME, localSemaphore ); 378 result.put( FileLockNamedLockFactory.NAME, fileLockFactory ); 379 return Collections.unmodifiableMap( result ); 380 } 381 382 @Provides 383 @Singleton 384 Set<LocalRepositoryManagerFactory> provideLocalRepositoryManagerFactories( 385 @Named( "simple" ) LocalRepositoryManagerFactory simple, 386 @Named( "enhanced" ) LocalRepositoryManagerFactory enhanced ) 387 { 388 Set<LocalRepositoryManagerFactory> result = new HashSet<>(); 389 result.add( simple ); 390 result.add( enhanced ); 391 return Collections.unmodifiableSet( result ); 392 } 393 394 @Provides 395 @Singleton 396 Set<RepositoryLayoutFactory> provideRepositoryLayoutFactories( @Named( "maven2" ) RepositoryLayoutFactory maven2 ) 397 { 398 Set<RepositoryLayoutFactory> result = new HashSet<>(); 399 result.add( maven2 ); 400 return Collections.unmodifiableSet( result ); 401 } 402 403 @Provides 404 @Singleton 405 Set<RepositoryListener> providesRepositoryListeners() 406 { 407 return Collections.emptySet(); 408 } 409 410 private static class Slf4jModule 411 extends AbstractModule 412 { 413 414 @Override 415 protected void configure() 416 { 417 bind( LoggerFactory.class ) // 418 .to( Slf4jLoggerFactory.class ); 419 } 420 421 @Provides 422 @Singleton 423 ILoggerFactory getLoggerFactory() 424 { 425 return org.slf4j.LoggerFactory.getILoggerFactory(); 426 } 427 428 } 429 430}