Package org.jboss.osgi.framework

Examples of org.jboss.osgi.framework.BundleManager


        return new OSGiRuntimeResource(delegate.clone(), injectedBundleManager);
    }

    private boolean hasBundle(PathElement element) {
        boolean result = false;
        BundleManager bundleManager = injectedBundleManager.getOptionalValue();
        if (bundleManager != null) {
            Bundle bundle;
            try {
                Long bundleId = Long.parseLong(element.getValue());
                bundle = bundleManager.getBundleById(bundleId);
            } catch (NumberFormatException ex) {
                bundle = bundleManager.getBundleByLocation(element.getValue());
            }
            result = (bundle != null);
        }
        return result;
    }
View Full Code Here


        }
        return result;
    }

    private BundleContext getBundleContext() {
        BundleManager bundleManager = injectedBundleManager.getOptionalValue();
        BundleContext context = bundleManager != null ? bundleManager.getSystemBundle().getBundleContext() : null;
        if (context == null) {
            LOGGER.debugf("BundleContext not available for management operation");
        }
        return context;
    }
View Full Code Here

        final DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        final Deployment deployment = depUnit.getAttachment(OSGiConstants.DEPLOYMENT_KEY);
        if (deployment != null) {
            ServiceName serviceName;
            try {
                final BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
                if (!deploymentTracker.isClosed() && deploymentTracker.hasDeploymentName(depUnit.getName())) {
                    restoreStorageState(phaseContext, deployment);
                    serviceName = bundleManager.installBundle(deployment, deploymentTracker.getBundleInstallListener());
                    deploymentTracker.registerBundleInstallService(serviceName);
                } else {
                    serviceName = bundleManager.installBundle(deployment, null);
                }
            } catch (BundleException ex) {
                throw new DeploymentUnitProcessingException(ex);
            }
            phaseContext.addDeploymentDependency(serviceName, OSGiConstants.INSTALLED_BUNDLE_KEY);
View Full Code Here

            return false;
        }
    }

    private ServiceName installBundleFromURL(URL bundleURL, String location, Integer level, ServiceListener<Bundle> listener) throws Exception {
        BundleManager bundleManager = injectedBundleManager.getValue();
        BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.toVirtualFile(bundleURL), location);
        Deployment dep = DeploymentFactory.createDeployment(info);
        if (level != null) {
            dep.setStartLevel(level.intValue());
            dep.setAutoStart(true);
        }
        StorageStateProvider storageProvider = injectedStorageProvider.getValue();
        StorageState storageState = storageProvider.getByLocation(dep.getLocation());
        if (storageState != null) {
            dep.addAttachment(StorageState.class, storageState);
        }
        return bundleManager.installBundle(dep, listener);
    }
View Full Code Here

            LOGGER.tracef("Starting: %s in mode %s", controller.getName(), controller.getMode());
            serviceContainer = context.getController().getServiceContainer();
            final BundleContext syscontext = injectedBundleContext.getValue();

            // Inject the system bundle context into the runtime resource
            BundleManager bundleManager = injectedBundleManager.getValue();
            resource.getInjectedBundleManager().inject(bundleManager);

            // Register the JNDI service listener
            jndiServiceListener = new JNDIServiceListener(syscontext);
            try {
View Full Code Here

    public synchronized void start(StartContext context) throws StartException {
        ServiceController<?> controller = context.getController();
        LOGGER.tracef("Starting: %s in mode %s", controller.getName(), controller.getMode());
        try {
            BundleManager bundleManager = injectedBundleManager.getValue();
            StorageStateProvider storageStateProvider = injectedStorageProvider.getValue();
            StorageState storageState = storageStateProvider.getByLocation(deployment.getLocation());
            if (storageState != null) {
                deployment.addAttachment(StorageState.class, storageState);
            }
            ServiceListener<Bundle> listener = deploymentTracker.getBundleInstallListener();
            bundleManager.installBundle(deployment, listener);
        } catch (Throwable th) {
            throw MESSAGES.startFailedToInstallDeployment(th, deployment);
        }
    }
View Full Code Here

    public synchronized void start(StartContext context) throws StartException {
        ServiceController<?> controller = context.getController();
        LOGGER.tracef("Starting: %s in mode %s", controller.getName(), controller.getMode());
        try {
            BundleManager bundleManager = injectedBundleManager.getValue();
            bundleManager.installBundle(deployment, null);
        } catch (Throwable th) {
            throw MESSAGES.startFailedToInstallDeployment(th, deployment);
        }
    }
View Full Code Here

    public synchronized void stop(StopContext context) {
        ServiceController<?> controller = context.getController();
        LOGGER.tracef("Stopping: %s in mode %s", controller.getName(), controller.getMode());
        try {
            BundleManager bundleManager = injectedBundleManager.getValue();
            bundleManager.uninstallBundle(deployment);
        } catch (Throwable t) {
            LOGGER.errorFailedToUninstallDeployment(t, deployment);
        }
    }
View Full Code Here

            LOGGER.tracef("Starting: %s in mode %s", controller.getName(), controller.getMode());
            serviceContainer = context.getController().getServiceContainer();
            final BundleContext syscontext = injectedBundleContext.getValue();

            // Inject the system bundle context into the runtime resource
            BundleManager bundleManager = injectedBundleManager.getValue();
            resource.getInjectedBundleManager().inject(bundleManager);

            // Register the JNDI service listener
            jndiServiceListener = new JNDIServiceListener(syscontext);
            try {
View Full Code Here

TOP

Related Classes of org.jboss.osgi.framework.BundleManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.