Search in sources :

Example 1 with NoOpTransferDecorator

use of org.commonjava.maven.galley.io.NoOpTransferDecorator in project indy by Commonjava.

the class TestProvider method setup.

//    private Http http;
//
//    private IndyLocationExpander locationExpander;
//
//    private IndyLocationResolver locationResolver;
@PostConstruct
public void setup() {
    storeDataManager = new MemoryStoreDataManager(true);
    nfc = new MemoryNotFoundCache();
    objectMapper = new IndyObjectMapper(false);
    fileEventManager = new NoOpFileEventManager();
    transferDecorator = new NoOpTransferDecorator();
    transportManagerConfig = new TransportManagerConfig();
    temp = new TemporaryFolder();
    try {
        temp.create();
        cacheProvider = new FileCacheProvider(temp.newFolder("storage"), indyPathGenerator, fileEventManager, transferDecorator);
    } catch (IOException e) {
        fail("Cannot initialize temporary directory structure");
        temp.delete();
    }
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) TemporaryFolder(org.junit.rules.TemporaryFolder) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) IOException(java.io.IOException) PostConstruct(javax.annotation.PostConstruct)

Example 2 with NoOpTransferDecorator

use of org.commonjava.maven.galley.io.NoOpTransferDecorator 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 3 with NoOpTransferDecorator

use of org.commonjava.maven.galley.io.NoOpTransferDecorator in project galley by Commonjava.

the class TransferManagerImplTest method setup.

@Before
public void setup() {
    transport = new TestTransport();
    transportMgr = new TransportManagerImpl(transport);
    cacheProvider = new FileCacheProvider(temp.newFolder("cache"), new HashedLocationPathGenerator(), new NoOpFileEventManager(), new NoOpTransferDecorator(), true);
    nfc = new MemoryNotFoundCache();
    fileEvents = new NoOpFileEventManager();
    executor = Executors.newSingleThreadExecutor();
    TransportManagerConfig transportManagerConfig = new TransportManagerConfig();
    final DownloadHandler dh = new DownloadHandler(nfc, transportManagerConfig, executor);
    final UploadHandler uh = new UploadHandler(nfc, transportManagerConfig, executor);
    final ListingHandler lh = new ListingHandler(nfc);
    final ExistenceHandler eh = new ExistenceHandler(nfc);
    mgr = new TransferManagerImpl(transportMgr, cacheProvider, nfc, fileEvents, dh, uh, lh, eh, new SpecialPathManagerImpl(), Executors.newFixedThreadPool(2));
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) 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) DownloadHandler(org.commonjava.maven.galley.internal.xfer.DownloadHandler) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) TestTransport(org.commonjava.maven.galley.testing.core.transport.TestTransport) UploadHandler(org.commonjava.maven.galley.internal.xfer.UploadHandler) ExistenceHandler(org.commonjava.maven.galley.internal.xfer.ExistenceHandler) Before(org.junit.Before)

Example 4 with NoOpTransferDecorator

use of org.commonjava.maven.galley.io.NoOpTransferDecorator in project galley by Commonjava.

the class EmbeddableCDIProducer method postConstruct.

@PostConstruct
public void postConstruct() {
    fileEventManager = new NoOpFileEventManager();
    transferDecorator = new NoOpTransferDecorator();
    pathGenerator = new HashedLocationPathGenerator();
    nfc = new MemoryNotFoundCache();
    //        locationExpander = new NoOpLocationExpander();
    //        locationResolver = new SimpleUrlLocationResolver( locationExpander, transportManager );
    transportManagerConfig = new TransportManagerConfig();
    passwordManager = new MemoryPasswordManager();
    http = new HttpImpl(passwordManager);
    objectMapper = new ObjectMapper();
    objectMapper.registerModules(new ProjectVersionRefSerializerModule());
    pluginDefaults = new StandardMaven304PluginDefaults();
    pluginImplications = new StandardMavenPluginImplications(xml);
}
Also used : NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) StandardMaven304PluginDefaults(org.commonjava.maven.galley.maven.internal.defaults.StandardMaven304PluginDefaults) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) MemoryPasswordManager(org.commonjava.maven.galley.auth.MemoryPasswordManager) StandardMavenPluginImplications(org.commonjava.maven.galley.maven.internal.defaults.StandardMavenPluginImplications) HttpImpl(org.commonjava.maven.galley.transport.htcli.HttpImpl) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ProjectVersionRefSerializerModule(org.commonjava.maven.atlas.ident.jackson.ProjectVersionRefSerializerModule) PostConstruct(javax.annotation.PostConstruct)

Example 5 with NoOpTransferDecorator

use of org.commonjava.maven.galley.io.NoOpTransferDecorator in project indy by Commonjava.

the class AutoProxDataManagerDecoratorTest method setup.

@Before
public final void setup() throws Exception {
    rootDir = temp.newFolder("indy.root");
    autoproxDataDir = new File(rootDir, "data/autoprox");
    autoproxDataDir.mkdirs();
    File cacheDir = temp.newFolder();
    FileCacheProvider cache = new FileCacheProvider(cacheDir, new HashedLocationPathGenerator(), new NoOpFileEventManager(), new NoOpTransferDecorator());
    galley = new GalleyMavenBuilder(cache).withEnabledTransports(new HttpClientTransport(new HttpImpl(new MemoryPasswordManager()))).build();
    final DataFileManager dataFiles = new DataFileManager(rootDir, new DataFileEventManager());
    ruleParser = new ScriptRuleParser(new ScriptEngine(dataFiles));
    final AutoProxConfig indyConfig = new AutoProxConfig(autoproxDataDir.getName(), true);
    catalog = new AutoProxCatalogManager(dataFiles, indyConfig, ruleParser);
    storeDataManager = new TestAutoProxyDataManager(catalog, galley.getTransferManager());
    storeDataManager.install();
    storeDataManager.clear(summary);
    storeQuery = storeDataManager.query().packageType(MAVEN_PKG_KEY);
    System.setProperty("baseUrl", http.getBaseUri());
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) AutoProxConfig(org.commonjava.indy.autoprox.conf.AutoProxConfig) DataFileEventManager(org.commonjava.indy.subsys.datafile.change.DataFileEventManager) MemoryPasswordManager(org.commonjava.maven.galley.auth.MemoryPasswordManager) HttpImpl(org.commonjava.maven.galley.transport.htcli.HttpImpl) ScriptEngine(org.commonjava.indy.subsys.template.ScriptEngine) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) GalleyMavenBuilder(org.commonjava.maven.galley.maven.GalleyMavenBuilder) HttpClientTransport(org.commonjava.maven.galley.transport.htcli.HttpClientTransport) ScriptRuleParser(org.commonjava.indy.autoprox.util.ScriptRuleParser) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) TestAutoProxyDataManager(org.commonjava.indy.autoprox.fixture.TestAutoProxyDataManager) File(java.io.File) Before(org.junit.Before)

Aggregations

NoOpFileEventManager (org.commonjava.maven.galley.event.NoOpFileEventManager)5 NoOpTransferDecorator (org.commonjava.maven.galley.io.NoOpTransferDecorator)5 TransportManagerConfig (org.commonjava.maven.galley.config.TransportManagerConfig)4 HashedLocationPathGenerator (org.commonjava.maven.galley.io.HashedLocationPathGenerator)4 MemoryNotFoundCache (org.commonjava.maven.galley.nfc.MemoryNotFoundCache)4 MemoryPasswordManager (org.commonjava.maven.galley.auth.MemoryPasswordManager)3 FileCacheProvider (org.commonjava.maven.galley.cache.FileCacheProvider)3 PostConstruct (javax.annotation.PostConstruct)2 TransferManagerImpl (org.commonjava.maven.galley.internal.TransferManagerImpl)2 DownloadHandler (org.commonjava.maven.galley.internal.xfer.DownloadHandler)2 ExistenceHandler (org.commonjava.maven.galley.internal.xfer.ExistenceHandler)2 ListingHandler (org.commonjava.maven.galley.internal.xfer.ListingHandler)2 UploadHandler (org.commonjava.maven.galley.internal.xfer.UploadHandler)2 SpecialPathManagerImpl (org.commonjava.maven.galley.io.SpecialPathManagerImpl)2 TransportManagerImpl (org.commonjava.maven.galley.transport.TransportManagerImpl)2 HttpImpl (org.commonjava.maven.galley.transport.htcli.HttpImpl)2 Before (org.junit.Before)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 IOException (java.io.IOException)1