aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/container/core/config/DiskBundleInstaller.java
blob: 2c02de30e15407fd1de45db78d8998b2ef34637d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.core.config;

import com.yahoo.osgi.Osgi;
import org.osgi.framework.Bundle;

import java.io.File;
import java.util.List;

/**
 * @author gjoranv
 */
public class DiskBundleInstaller {

    public List<Bundle> installBundles(String bundlePath, Osgi osgi) {
        File file = new File(bundlePath);
        if ( ! file.exists()) {
            throw new IllegalArgumentException("Bundle file '" + bundlePath + "' not found on disk.");
        }

        return osgi.install(file.getAbsolutePath());
    }

}