All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.osgi.OSGiUtil Maven / Gradle / Ivy

There is a newer version: 3.6.2.5.inovus
Show newest version
package liquibase.osgi;

import org.osgi.framework.BundleReference;

public final class OSGiUtil {

    private static volatile Boolean loadedAsBundle;

    public static boolean isLiquibaseLoadedAsOSGiBundle() {
        if (loadedAsBundle == null) {
            ClassLoader classLoader = OSGiUtil.class.getClassLoader();
            try {
                classLoader.loadClass("org.osgi.framework.BundleReference");
            } catch (ClassNotFoundException e) {
                return false;
            }

            if (classLoader instanceof BundleReference) {
                loadedAsBundle = true;
            } else {
                loadedAsBundle =false;
            }
        }
        return loadedAsBundle;
    }

    private OSGiUtil() {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy