use of org.commonjava.maven.galley.io.HashedLocationPathGenerator 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();
}
}
use of org.commonjava.maven.galley.io.HashedLocationPathGenerator in project galley by Commonjava.
the class PartyLineCacheProviderTest method setup.
@Before
public void setup() throws Exception {
final PathGenerator pathgen = new HashedLocationPathGenerator();
final FileEventManager events = new TestFileEventManager();
final TransferDecorator decorator = new TestTransferDecorator();
provider = new PartyLineCacheProvider(temp.newFolder(), pathgen, events, decorator);
}
use of org.commonjava.maven.galley.io.HashedLocationPathGenerator 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));
}
use of org.commonjava.maven.galley.io.HashedLocationPathGenerator 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);
}
use of org.commonjava.maven.galley.io.HashedLocationPathGenerator in project galley by Commonjava.
the class GridFileSystemCacheProviderTest method setup.
@Before
public void setup() throws Exception {
final PathGenerator pathgen = new HashedLocationPathGenerator();
final FileEventManager events = new TestFileEventManager();
final TransferDecorator decorator = new TestTransferDecorator();
Cache<String, byte[]> data = CACHE_MANAGER.getCache(name.getMethodName() + "-data");
Cache<String, GridFile.Metadata> metadata = CACHE_MANAGER.getCache(name.getMethodName() + "-metadata");
final GridFilesystem fs = new GridFilesystem(data, metadata);
provider = new GridFileSystemCacheProvider(pathgen, events, decorator, fs);
}
Aggregations