Search in sources :

Example 1 with NoOpLocationExpander

use of org.commonjava.maven.galley.transport.NoOpLocationExpander in project galley by Commonjava.

the class GalleyCoreBuilder method initMissingComponents.

public void initMissingComponents() throws GalleyInitException {
    if (transportManager == null) {
        transportManager = new TransportManagerImpl(transports);
    }
    handlerExecutor = Executors.newFixedThreadPool(2, new NamedThreadFactory("transfer-handlers", true, 4));
    batchExecutor = Executors.newFixedThreadPool(2, new NamedThreadFactory("transfer-batches", true, 4));
    if (decorator == null) {
        decorator = new NoOpTransferDecorator();
    }
    if (events == null) {
        events = new NoOpFileEventManager();
    }
    if (nfc == null) {
        nfc = new MemoryNotFoundCache();
    }
    if (transportManagerConfig == null) {
        transportManagerConfig = new TransportManagerConfig();
    }
    final DownloadHandler dh = new DownloadHandler(getNfc(), transportManagerConfig, handlerExecutor);
    final UploadHandler uh = new UploadHandler(getNfc(), transportManagerConfig, handlerExecutor);
    final ListingHandler lh = new ListingHandler(getNfc());
    final ExistenceHandler eh = new ExistenceHandler(getNfc());
    if (specialPathManager == null) {
        specialPathManager = new SpecialPathManagerImpl();
    }
    if (pathGenerator == null) {
        pathGenerator = new HashedLocationPathGenerator();
    }
    if (cache == null) {
        if (cacheProviderFactory != null) {
            cache = cacheProviderFactory.create(pathGenerator, decorator, events);
        } else {
            throw new GalleyInitException("No CacheProvider / CacheProviderFactory specified!");
        }
    }
    if (transferManager == null) {
        transferManager = new TransferManagerImpl(transportManager, getCache(), getNfc(), getFileEvents(), dh, uh, lh, eh, specialPathManager, batchExecutor);
    }
    if (locationExpander == null) {
        logger.debug("Initializing default location expander");
        locationExpander = new NoOpLocationExpander();
    }
    if (locationResolver == null) {
        locationResolver = new SimpleUrlLocationResolver(locationExpander, transportManager);
    }
    if (passwordManager == null) {
        passwordManager = new MemoryPasswordManager();
    }
}
Also used : ListingHandler(org.commonjava.maven.galley.internal.xfer.ListingHandler) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) TransferManagerImpl(org.commonjava.maven.galley.internal.TransferManagerImpl) TransportManagerImpl(org.commonjava.maven.galley.transport.TransportManagerImpl) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) NamedThreadFactory(org.commonjava.cdi.util.weft.NamedThreadFactory) DownloadHandler(org.commonjava.maven.galley.internal.xfer.DownloadHandler) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) MemoryPasswordManager(org.commonjava.maven.galley.auth.MemoryPasswordManager) NoOpLocationExpander(org.commonjava.maven.galley.transport.NoOpLocationExpander) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) SimpleUrlLocationResolver(org.commonjava.maven.galley.transport.SimpleUrlLocationResolver) UploadHandler(org.commonjava.maven.galley.internal.xfer.UploadHandler) ExistenceHandler(org.commonjava.maven.galley.internal.xfer.ExistenceHandler)

Example 2 with NoOpLocationExpander

use of org.commonjava.maven.galley.transport.NoOpLocationExpander in project galley by Commonjava.

the class TestCDIProvider method start.

@PostConstruct
public void start() {
    try {
        temp.create();
        cacheProvider = new PartyLineCacheProvider(temp.newFolder(), pathGenerator, eventManager, transferDecorator);
        fileTransportConfig = new FileTransportConfig(temp.newFolder(), pathGenerator);
    } catch (IOException e) {
        Assert.fail("Failed to init temp folder fro file cache.");
    }
    locationExpander = new NoOpLocationExpander();
    locationResolver = new SimpleUrlLocationResolver(locationExpander, transportManager);
    globalHttpConfiguration = new GlobalHttpConfiguration();
    weftConfig = new DefaultWeftConfig();
}
Also used : SimpleUrlLocationResolver(org.commonjava.maven.galley.transport.SimpleUrlLocationResolver) DefaultWeftConfig(org.commonjava.cdi.util.weft.config.DefaultWeftConfig) FileTransportConfig(org.commonjava.maven.galley.filearc.FileTransportConfig) GlobalHttpConfiguration(org.commonjava.maven.galley.transport.htcli.conf.GlobalHttpConfiguration) PartyLineCacheProvider(org.commonjava.maven.galley.cache.partyline.PartyLineCacheProvider) IOException(java.io.IOException) NoOpLocationExpander(org.commonjava.maven.galley.transport.NoOpLocationExpander) PostConstruct(javax.annotation.PostConstruct)

Aggregations

NoOpLocationExpander (org.commonjava.maven.galley.transport.NoOpLocationExpander)2 SimpleUrlLocationResolver (org.commonjava.maven.galley.transport.SimpleUrlLocationResolver)2 IOException (java.io.IOException)1 PostConstruct (javax.annotation.PostConstruct)1 NamedThreadFactory (org.commonjava.cdi.util.weft.NamedThreadFactory)1 DefaultWeftConfig (org.commonjava.cdi.util.weft.config.DefaultWeftConfig)1 MemoryPasswordManager (org.commonjava.maven.galley.auth.MemoryPasswordManager)1 PartyLineCacheProvider (org.commonjava.maven.galley.cache.partyline.PartyLineCacheProvider)1 TransportManagerConfig (org.commonjava.maven.galley.config.TransportManagerConfig)1 NoOpFileEventManager (org.commonjava.maven.galley.event.NoOpFileEventManager)1 FileTransportConfig (org.commonjava.maven.galley.filearc.FileTransportConfig)1 TransferManagerImpl (org.commonjava.maven.galley.internal.TransferManagerImpl)1 DownloadHandler (org.commonjava.maven.galley.internal.xfer.DownloadHandler)1 ExistenceHandler (org.commonjava.maven.galley.internal.xfer.ExistenceHandler)1 ListingHandler (org.commonjava.maven.galley.internal.xfer.ListingHandler)1 UploadHandler (org.commonjava.maven.galley.internal.xfer.UploadHandler)1 HashedLocationPathGenerator (org.commonjava.maven.galley.io.HashedLocationPathGenerator)1 NoOpTransferDecorator (org.commonjava.maven.galley.io.NoOpTransferDecorator)1 SpecialPathManagerImpl (org.commonjava.maven.galley.io.SpecialPathManagerImpl)1 MemoryNotFoundCache (org.commonjava.maven.galley.nfc.MemoryNotFoundCache)1