Package org.jboss.osgi.deployment.deployer

Examples of org.jboss.osgi.deployment.deployer.Deployment


                        // there won't be an {@link InstallBundleInitiatorService}
                        String contextName = DeploymentHolderService.getContextName(dep);
                        ServiceName serviceName = DeploymentHolderService.getServiceName(contextName);
                        ServiceController<?> holderService = serviceContainer.getService(serviceName);
                        if (holderService != null) {
                            Deployment initiatingDeployment = (Deployment) holderService.getValue();
                            autoStart = initiatingDeployment.isAutoStart();
                            Integer startlevel = initiatingDeployment.getStartLevel();
                            if (startlevel != null)
                                startLevel.setBundleStartLevel(bundle, startlevel);
                        }

                        if (autoStart) {
View Full Code Here


    @Override
    public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {

        // Check if we already have an OSGi deployment
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        Deployment deployment = OSGiDeploymentAttachment.getDeployment(deploymentUnit);

        String contextName = deploymentUnit.getName();
        ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();
        Deployment holderDep = DeploymentHolderService.getDeployment(serviceRegistry, contextName);
        VirtualFile virtualFile = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();

        String location = holderDep != null ? holderDep.getLocation() : contextName;
        boolean autoStart = holderDep != null ? holderDep.isAutoStart() : true;

        // Check for attached BundleInfo
        BundleInfo info = BundleInfoAttachment.getBundleInfo(deploymentUnit);
        if (deployment == null && info != null) {
            deployment = DeploymentFactory.createDeployment(info);
View Full Code Here

                    } catch (RuntimeException ex) {
                        // ignore
                        return;
                    }

                    Deployment dep = userBundle.getDeployment();
                    String contextName = DeploymentHolderService.getContextName(dep);

                    // Check if we have an {@link OSGiDeploymentService}
                    ServiceContainer container = context.getController().getServiceContainer();
                    ServiceName osgiDeploymentService = OSGiDeploymentService.getServiceName(contextName);
View Full Code Here

            BundleDeploymentPlugin depPlugin = bundleManager.getPlugin(BundleDeploymentPlugin.class);
            for (OSGiModule moduleMetaData : subsystemState.getModules()) {
                ModuleIdentifier identifier = moduleMetaData.getIdentifier();
                ModuleLoader moduleLoader = Module.getSystemModuleLoader();
                Module module = moduleLoader.loadModule(identifier);
                Deployment dep = depPlugin.createDeployment(module);
                dep.setAutoStart(moduleMetaData.isStart());
                deployments.add(dep);
            }

            // Deploy the bundles through the {@link SystemDeployerService}
            // [TODO] Revisit whether these deployments should go through the {@link DeploymentUnitProcessor} chain
View Full Code Here

                }
                if (bundlesToStart != null) {
                    PackageAdmin packageAdmin = injectedPackageAdmin.getValue();
                    for (Tuple tuple : bundlesToStart.values()) {
                        Bundle bundle = tuple.controller.getValue();
                        Deployment dep = tuple.deployment;
                        if (dep.isAutoStart()) {
                            try {
                                int bundleType = packageAdmin.getBundleType(bundle);
                                if (bundleType != BUNDLE_TYPE_FRAGMENT) {
                                    bundle.start(Bundle.START_TRANSIENT | Bundle.START_ACTIVATION_POLICY);
                                }
View Full Code Here

                ModuleIdentifier identifier = moduleMetaData.getIdentifier();
                File bundleFile = getRepositoryEntry(bundlesDir, identifier);
                if (bundleFile != null) {
                    URL url = bundleFile.toURI().toURL();
                    BundleInfo info = BundleInfo.createBundleInfo(url);
                    Deployment dep = DeploymentFactory.createDeployment(info);
                    Integer startLevel = moduleMetaData.getStartLevel();
                    if (startLevel != null)
                        dep.setStartLevel(startLevel.intValue());
                    serviceName = bundleManager.installBundle(serviceTarget, dep);
                } else {
                    ModuleLoader moduleLoader = Module.getBootModuleLoader();
                    Module module = moduleLoader.loadModule(identifier);
                    OSGiMetaData metadata = getModuleMetadata(module);
View Full Code Here

                }
                if (bundlesToStart != null) {
                    PackageAdmin packageAdmin = injectedPackageAdmin.getValue();
                    for (Tuple tuple : bundlesToStart.values()) {
                        Bundle bundle = tuple.controller.getValue();
                        Deployment dep = tuple.deployment;
                        if (dep.isAutoStart()) {
                            try {
                                int bundleType = packageAdmin.getBundleType(bundle);
                                if (bundleType != BUNDLE_TYPE_FRAGMENT) {
                                    bundle.start(Bundle.START_TRANSIENT);
                                }
View Full Code Here

    }

    @Override
    public void deploy(final DeploymentPhaseContext context) throws DeploymentUnitProcessingException {
        final DeploymentUnit depUnit = context.getDeploymentUnit();
        final Deployment deployment = OSGiDeploymentAttachment.getDeployment(depUnit);
        if (deployment != null) {
            if (frameworkActivated.compareAndSet(false, true)) {
                activateFramework(context);
            }
            ServiceName serviceName;
View Full Code Here

            // Add the {@link ContextActivator} to the {@link XBundleRevision}
            XBundleRevision brev = bundle.getBundleRevision();
            brev.addAttachment(ContextActivator.class, activator);

            // Start the context when the bundle will get started automatically
            Deployment deployment = bundle.adapt(Deployment.class);
            if (deployment.isAutoStart()) {
                activator.startAsync();
            }
        }
    }
View Full Code Here

            // In case there is no DeploymentUnit there is a possiblity
            // of a race between the first class load and the availability of the Module
            // Here we wait for the ModuleSpec service to come up before we are done resolving
            // https://issues.jboss.org/browse/AS7-6016
            Deployment deployment = bundle.adapt(Deployment.class);
            DeploymentUnit depUnit = deployment.getAttachment(DeploymentUnit.class);
            if (depUnit == null) {
                ModuleIdentifier identifier = bundle.getBundleRevision().getModuleIdentifier();
                ServiceName moduleServiceName = ServiceModuleLoader.moduleServiceName(identifier);
                ServiceRegistry serviceRegistry = injectedBundleManager.getValue().getServiceContainer();
                ServiceController<?> controller = serviceRegistry.getRequiredService(moduleServiceName);
View Full Code Here

TOP

Related Classes of org.jboss.osgi.deployment.deployer.Deployment

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.