private BundleContext getBundleContext()

in src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java [445:457]


    private BundleContext getBundleContext() {
        // use the vault bundle to hook into the OSGi world
        Bundle currentBundle = FrameworkUtil.getBundle(InstallHook.class);
        if (currentBundle == null) {
            throw new IllegalStateException(
                    "The class " + InstallHook.class + " was not loaded through a bundle classloader");
        }
        BundleContext bundleContext = currentBundle.getBundleContext();
        if (bundleContext == null) {
            throw new IllegalStateException("Could not get bundle context for bundle " + currentBundle);
        }
        return bundleContext;
    }