Search in sources :

Example 1 with Library

use of org.apache.karaf.features.internal.model.Library in project karaf by apache.

the class AssemblyDeployCallback method installLibraries.

@Override
public void installLibraries(org.apache.karaf.features.Feature feature) throws IOException {
    assertNotBlacklisted(feature);
    Downloader downloader = manager.createDownloader();
    List<String> libraries = new ArrayList<>();
    for (Library library : ((Feature) feature).getLibraries()) {
        String lib = library.getLocation() + ";type:=" + library.getType() + ";export:=" + library.isExport() + ";delegate:=" + library.isDelegate();
        libraries.add(lib);
    }
    if (!libraries.isEmpty()) {
        Path configPropertiesPath = etcDirectory.resolve("config.properties");
        Properties configProperties = new Properties(configPropertiesPath.toFile());
        builder.downloadLibraries(downloader, configProperties, libraries, "   ");
    }
    try {
        downloader.await();
    } catch (Exception e) {
        throw new IOException("Error downloading configuration files", e);
    }
}
Also used : Path(java.nio.file.Path) ArrayList(java.util.ArrayList) Downloader(org.apache.karaf.features.internal.download.Downloader) Library(org.apache.karaf.features.internal.model.Library) IOException(java.io.IOException) Properties(org.apache.felix.utils.properties.Properties) Feature(org.apache.karaf.features.internal.model.Feature) BundleException(org.osgi.framework.BundleException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Properties (org.apache.felix.utils.properties.Properties)1 Downloader (org.apache.karaf.features.internal.download.Downloader)1 Feature (org.apache.karaf.features.internal.model.Feature)1 Library (org.apache.karaf.features.internal.model.Library)1 BundleException (org.osgi.framework.BundleException)1