public void execute()

in src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java [44:68]


    public void execute(InstallationContext ctx) {
        final String symbolicName = (String)getResource().getAttribute(Constants.BUNDLE_SYMBOLICNAME);
        final String version = (String)getResource().getAttribute(Constants.BUNDLE_VERSION);
        final Bundle b = BundleInfo.getMatchingBundle(this.getBundleContext(), symbolicName, version);
        if (b == null) {
            // nothing to do, so just stop
            this.setFinishedState(ResourceState.UNINSTALLED);
            return;
        }
        final int state = b.getState();
        try {
            if (state == Bundle.ACTIVE || state == Bundle.STARTING) {
            	b.stop();
            }
            b.uninstall();
            ctx.log("Uninstalled bundle {} from resource {}", b, getResource());
            // if the bundle exported packages, we need to refresh
            if ( BundleUtil.getFragmentHostHeader(b) == null ) {
                RefreshBundlesTask.markBundleForRefresh(ctx, this.getTaskSupport(), b);
            }
            this.setFinishedState(ResourceState.UNINSTALLED);
        } catch (final BundleException be) {
            this.getLogger().info("Exception during removal of bundle " + this.getResource() + " : " + be.getMessage() + ". Retrying later.", be);
        }
    }