Examples of XBundle


Examples of org.jboss.osgi.resolver.XBundle

         * Get the module identifier for the given {@link XBundleRevision}. The returned identifier must be such that it can be used
         * by the {@link ServiceModuleLoader}
         */
        @Override
        public ModuleIdentifier getModuleIdentifier(XBundleRevision brev) {
            XBundle bundle = brev.getBundle();
            Deployment deployment = bundle.adapt(Deployment.class);
            ModuleIdentifier identifier = deployment.getAttachment(ModuleIdentifier.class);
            if (identifier == null) {
                XIdentityCapability icap = brev.getIdentityCapability();
                List<XBundleRevision> allrevs = bundle.getAllBundleRevisions();
                String name = icap.getSymbolicName();
                if (allrevs.size() > 1) {
                    name += "-rev" + (allrevs.size() - 1);
                }
                identifier = ModuleIdentifier.create(MODULE_PREFIX + name, "" + icap.getVersion());
View Full Code Here

Examples of org.jboss.osgi.resolver.XBundle

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

        DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        XBundle bundle = depUnit.getAttachment(OSGiConstants.BUNDLE_KEY);
        if (bundle == null || bundle.isFragment())
            return;

        // Add a dependency on the Bundle RESOLVED service
        BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
        ServiceName bundleResolve = bundleManager.getServiceName(bundle, Bundle.RESOLVED);
        phaseContext.addDeploymentDependency(bundleResolve, AttachmentKey.create(Object.class));

        // Add a dependency on the Module service
        XBundleRevision brev = bundle.getBundleRevision();
        ServiceName moduleService = ServiceModuleLoader.moduleServiceName(brev.getModuleIdentifier());
        phaseContext.addDeploymentDependency(moduleService, Attachments.MODULE);

        // Defer the module phase if the bundle is not resolved
        if (bundle.isResolved() == false) {
            depUnit.putAttachment(Attachments.DEFERRED_ACTIVATION_COUNT, new AtomicInteger());
            DeploymentUtils.addDeferredModule(depUnit);
        }
    }
View Full Code Here

Examples of org.jboss.osgi.resolver.XBundle

public class BundleActivateProcessor implements DeploymentUnitProcessor {

    @Override
    public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        XBundle bundle = depUnit.getAttachment(OSGiConstants.BUNDLE_KEY);
        if (bundle == null || bundle.isFragment())
            return;

        ServiceController<XBundle> controller = BundleActivateService.addService(phaseContext.getServiceTarget(), depUnit, bundle);
        phaseContext.addDependency(controller.getName(), AttachmentKey.create(XBundle.class));
    }
View Full Code Here

Examples of org.jboss.osgi.resolver.XBundle

                // Set the start level of the adapted bundle
                Integer bundleStartLevel = configcap.getStartLevel();
                if (bundleStartLevel != null && bundleStartLevel > 0) {
                    StartLevel plugin = injectedStartLevel.getValue();
                    Long bundleId = resource.getAttachment(Long.class);
                    XBundle bundle = getBundleManager().getBundleById(bundleId);
                    plugin.setBundleStartLevel(bundle, bundleStartLevel);
                }
                return true;
            }
        }
View Full Code Here

Examples of org.jboss.osgi.resolver.XBundle

            // Start the module capabilities that have a start level assigned
            BundleManager bundleManager = injectedBundleManager.getValue();
            for (OSGiCapability modcap : modulecaps) {
                if (modcap.getStartLevel() != null) {
                    String identifier = modcap.getIdentifier();
                    XBundle bundle = bundleManager.getBundleByLocation(identifier);
                    try {
                        bundle.start(Bundle.START_ACTIVATION_POLICY);
                    } catch (BundleException ex) {
                        LOGGER.errorCannotStartBundle(ex, bundle);
                    }
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.