Search in sources :

Example 1 with PropertiesPropertyResolver

use of org.ops4j.util.property.PropertiesPropertyResolver in project fabric8 by jboss-fuse.

the class AetherResolutionWithHintsTest method mavenConfiguration.

private MavenConfigurationImpl mavenConfiguration() {
    Properties properties = new Properties();
    properties.setProperty("pid.localRepository", "target/" + UUID.randomUUID().toString());
    properties.setProperty("pid.globalChecksumPolicy", "ignore");
    properties.setProperty("pid.timeout", "1000");
    properties.setProperty("pid.connection.retryCount", "0");
    return new MavenConfigurationImpl(new PropertiesPropertyResolver(properties), "pid");
}
Also used : MavenConfigurationImpl(io.fabric8.maven.util.MavenConfigurationImpl) PropertiesPropertyResolver(org.ops4j.util.property.PropertiesPropertyResolver) Properties(java.util.Properties)

Example 2 with PropertiesPropertyResolver

use of org.ops4j.util.property.PropertiesPropertyResolver in project fabric8 by jboss-fuse.

the class MavenResolvers method createMavenResolver.

public static MavenResolver createMavenResolver(Mirror mirror, Dictionary<String, String> properties, String pid, RepositorySystem repositorySystem) {
    PropertiesPropertyResolver syspropsResolver = new PropertiesPropertyResolver(System.getProperties());
    DictionaryPropertyResolver propertyResolver = new DictionaryPropertyResolver(properties, syspropsResolver);
    MavenConfigurationImpl config = new MavenConfigurationImpl(propertyResolver, pid);
    return new AetherBasedResolver(config, mirror, repositorySystem);
}
Also used : MavenConfigurationImpl(io.fabric8.maven.util.MavenConfigurationImpl) PropertiesPropertyResolver(org.ops4j.util.property.PropertiesPropertyResolver) DictionaryPropertyResolver(org.ops4j.util.property.DictionaryPropertyResolver) AetherBasedResolver(io.fabric8.maven.url.internal.AetherBasedResolver)

Example 3 with PropertiesPropertyResolver

use of org.ops4j.util.property.PropertiesPropertyResolver in project fabric8 by jboss-fuse.

the class Log4jLogQuery method loadCoords.

protected String loadCoords(String coords, String filePath, String classifier) throws IOException {
    String[] split = coords.split("/");
    if (split != null && split.length > 2) {
        String groupId = split[0];
        String artifactId = split[1];
        String version = split[2];
        if (resolver == null) {
            Properties defaultProperties = getDefaultProperties();
            Properties systemProperties = System.getProperties();
            if (config == null) {
                Properties combined = new Properties();
                combined.putAll(defaultProperties);
                combined.putAll(systemProperties);
                if (properties != null) {
                    combined.putAll(properties);
                }
                config = new MavenConfigurationImpl(new PropertiesPropertyResolver(combined), ServiceConstants.PID);
            }
            resolver = new AetherBasedResolver(config);
        }
        File file = resolver.resolveFile(groupId, artifactId, classifier, "jar", version);
        if (file.exists() && file.isFile()) {
            if (isRoot(filePath)) {
                return jarIndex(file);
            }
            String fileUri = file.toURI().toString();
            URL url = new URL("jar:" + fileUri + "!" + filePath);
            return loadString(url);
        }
    }
    return null;
}
Also used : MavenConfigurationImpl(io.fabric8.maven.util.MavenConfigurationImpl) PropertiesPropertyResolver(org.ops4j.util.property.PropertiesPropertyResolver) Properties(java.util.Properties) File(java.io.File) URL(java.net.URL) AetherBasedResolver(io.fabric8.maven.url.internal.AetherBasedResolver)

Example 4 with PropertiesPropertyResolver

use of org.ops4j.util.property.PropertiesPropertyResolver in project fabric8 by jboss-fuse.

the class AetherTimeoutTest method basicMavenConfiguration.

private MavenConfigurationImpl basicMavenConfiguration(int timeoutInMs) {
    Properties properties = new Properties();
    properties.setProperty("pid.localRepository", "target/" + UUID.randomUUID().toString());
    properties.setProperty("pid.timeout", Integer.toString(timeoutInMs));
    properties.setProperty("pid.globalChecksumPolicy", "ignore");
    properties.setProperty("pid.connection.retryCount", "0");
    return new MavenConfigurationImpl(new PropertiesPropertyResolver(properties), "pid");
}
Also used : MavenConfigurationImpl(io.fabric8.maven.util.MavenConfigurationImpl) PropertiesPropertyResolver(org.ops4j.util.property.PropertiesPropertyResolver) Properties(java.util.Properties)

Example 5 with PropertiesPropertyResolver

use of org.ops4j.util.property.PropertiesPropertyResolver in project fabric8 by jboss-fuse.

the class AetherTimeoutTest method basicMavenConfigurationWithTwoTimeouts.

private MavenConfigurationImpl basicMavenConfigurationWithTwoTimeouts(int readTimeoutInMs, int connectTimeoutInMs) {
    Properties properties = new Properties();
    properties.setProperty("pid.localRepository", "target/" + UUID.randomUUID().toString());
    properties.setProperty("pid.timeout", Integer.toString(readTimeoutInMs));
    properties.setProperty("pid.socket.connectionTimeout", Integer.toString(connectTimeoutInMs));
    properties.setProperty("pid.globalChecksumPolicy", "ignore");
    properties.setProperty("pid.connection.retryCount", "0");
    return new MavenConfigurationImpl(new PropertiesPropertyResolver(properties), "pid");
}
Also used : MavenConfigurationImpl(io.fabric8.maven.util.MavenConfigurationImpl) PropertiesPropertyResolver(org.ops4j.util.property.PropertiesPropertyResolver) Properties(java.util.Properties)

Aggregations

MavenConfigurationImpl (io.fabric8.maven.util.MavenConfigurationImpl)5 PropertiesPropertyResolver (org.ops4j.util.property.PropertiesPropertyResolver)5 Properties (java.util.Properties)4 AetherBasedResolver (io.fabric8.maven.url.internal.AetherBasedResolver)2 File (java.io.File)1 URL (java.net.URL)1 DictionaryPropertyResolver (org.ops4j.util.property.DictionaryPropertyResolver)1