use of org.commonjava.maven.galley.maven.model.view.XPathManager in project pom-manipulation-ext by release-engineering.
the class GalleyInfrastructure method init.
private void init(final File targetDirectory, final List<ArtifactRepository> remoteRepositories, final ArtifactRepository localRepository, final Settings settings, final List<String> activeProfiles, final Location customLocation, final Transport customTransport, File cacheDir_) throws ManipulationException {
LocationExpander locationExpander;
try {
final List<Location> custom = customLocation == null ? Collections.<Location>emptyList() : Collections.singletonList(customLocation);
locationExpander = new MavenLocationExpander(custom, remoteRepositories, localRepository, mirrorSelector, settings, activeProfiles);
} catch (final MalformedURLException e) {
throw new ManipulationException("Failed to setup Maven-specific LocationExpander: %s", e, e.getMessage());
}
xml = new XMLInfrastructure();
xpaths = new XPathManager();
final TransportManager transports;
if (customTransport != null) {
transports = new TransportManagerImpl(customTransport);
} else {
transports = new TransportManagerImpl(new HttpClientTransport(new HttpImpl(new MemoryPasswordManager())), new FileTransport(), new ZipJarTransport());
}
cacheDir = cacheDir_;
if (cacheDir == null) {
cacheDir = new File(targetDirectory, "manipulator-cache");
}
final FileEventManager fileEvents = new NoOpFileEventManager();
final CacheProvider cache = new FileCacheProvider(cacheDir, new HashedLocationPathGenerator(), fileEvents, new NoOpTransferDecorator());
final NotFoundCache nfc = new MemoryNotFoundCache();
executor = Executors.newCachedThreadPool();
final TransportManagerConfig config = new TransportManagerConfig();
final TransferManager transfers = new TransferManagerImpl(transports, cache, nfc, fileEvents, new DownloadHandler(nfc, config, executor), new UploadHandler(nfc, config, executor), new ListingHandler(nfc), new ExistenceHandler(nfc), new SpecialPathManagerImpl(), executor);
final TypeMapper types = new StandardTypeMapper();
final ArtifactMetadataManager metadataManager = new ArtifactMetadataManagerImpl(transfers, locationExpander);
final VersionResolver versionResolver = new VersionResolverImpl(new MavenMetadataReader(xml, locationExpander, metadataManager, xpaths));
artifactManager = new ArtifactManagerImpl(transfers, locationExpander, types, versionResolver);
// TODO: auto-adjust this to the current Maven runtime!
final MavenPluginDefaults pluginDefaults = new StandardMaven304PluginDefaults();
final MavenPluginImplications pluginImplications = new StandardMavenPluginImplications(xml);
pomReader = new MavenPomReader(xml, locationExpander, artifactManager, xpaths, pluginDefaults, pluginImplications);
metadataReader = new MavenMetadataReader(xml, locationExpander, metadataManager, xpaths);
}
use of org.commonjava.maven.galley.maven.model.view.XPathManager in project galley by Commonjava.
the class TestFixture method initMissingComponents.
@Override
public void initMissingComponents() throws Exception {
super.initGalley();
super.initMissingComponents();
// setup version resolver.
if (xml == null) {
xml = new XMLInfrastructure();
}
if (xpath == null) {
xpath = new XPathManager();
}
if (metadataManager == null) {
metadataManager = new ArtifactMetadataManagerImpl(getTransferManager(), getLocationExpander());
}
if (metadataReader == null) {
metadataReader = new MavenMetadataReader(xml, getLocationExpander(), metadataManager, xpath);
}
if (versionResolver == null) {
versionResolver = new VersionResolverImpl(metadataReader);
}
if (typeMapper == null) {
typeMapper = new StandardTypeMapper();
}
if (artifactManager == null) {
Logger logger = LoggerFactory.getLogger(getClass());
logger.debug("Initializing ArtifactManagerImpl using:\n TransferManager: {}\n LocationExpander: {}\n TypeMapper: {}\n VersionResolver: {}", getTransferManager(), getLocationExpander(), typeMapper, versionResolver);
artifactManager = new ArtifactManagerImpl(getTransferManager(), getLocationExpander(), typeMapper, versionResolver);
} else {
Logger logger = LoggerFactory.getLogger(getClass());
logger.debug("Using passed-in ArtifactManager instance: {}", artifactManager);
}
if (pluginDefaults == null) {
pluginDefaults = new StandardMaven350PluginDefaults();
}
if (pluginImplications == null) {
pluginImplications = new StandardMavenPluginImplications(xml);
}
if (modelProcessor == null) {
modelProcessor = new MavenModelProcessor();
}
if (pomReader == null) {
pomReader = new MavenPomReader(xml, getLocationExpander(), getArtifactManager(), getXpath(), getPluginDefaults(), getPluginImplications());
}
}
Aggregations