Package org.jboss.osgi.framework.spi

Examples of org.jboss.osgi.framework.spi.BundleManager


        ServiceName puServiceName = depUnit.getAttachment(JpaAttachments.PERSISTENCE_UNIT_SERVICE_KEY);
        XBundle bundle = depUnit.getAttachment(OSGiConstants.BUNDLE_KEY);
        if (bundle == null || puServiceName == null)
            return;

        BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
        EntityManagerFactoryRegistration.addService(phaseContext.getServiceTarget(), bundleManager, puServiceName, bundle);
    }
View Full Code Here


    private ServiceController<StandardContext> controller;

    @Override
    public void start(BundleContext context) throws Exception {
        XBundle sysbundle = (XBundle) context.getBundle();
        BundleManager bundleManager = sysbundle.adapt(BundleManager.class);
        ServiceTarget serviceTarget = bundleManager.getServiceTarget();
        controller = HttpServiceFactoryService.addService(serviceTarget);
    }
View Full Code Here

        public void install(Deployment dep) throws BundleException {
            // Do the install directly if we have a running management op
            // https://issues.jboss.org/browse/AS7-5642
            if (OperationAssociation.INSTANCE.getAssociation() != null) {
                LOGGER.warnCannotDeployBundleFromManagementOperation(dep);
                BundleManager bundleManager = injectedBundleManager.getValue();
                bundleManager.installBundle(dep, null, null);
            } else {
                LOGGER.debugf("Install deployment: %s", dep);
                String runtimeName = getRuntimeName(dep);
                putDeployment(runtimeName, dep);
                try {
View Full Code Here

        }

        @SuppressWarnings("unchecked")
        private ServiceController<Phase> getDeferredPhaseService(DeploymentUnit depUnit) {
            ServiceName serviceName = DeploymentUtils.getDeploymentUnitPhaseServiceName(depUnit, Phase.FIRST_MODULE_USE);
            BundleManager bundleManager = injectedBundleManager.getValue();
            ServiceContainer serviceContainer = bundleManager.getServiceContainer();
            return (ServiceController<Phase>) serviceContainer.getRequiredService(serviceName);
        }
View Full Code Here

        private final InjectedValue<XBundle> injectedBundle = new InjectedValue<XBundle>();
        private final InjectedValue<Component> injectedComponent = new InjectedValue<Component>();
        private final DeploymentUnit depUnit;

        static ServiceController<XBundle> addService(ServiceTarget serviceTarget, DeploymentUnit depUnit, XBundle bundle) {
            BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
            ServiceName resolvedBundle = bundleManager.getServiceName(bundle, Bundle.RESOLVED);
            ServiceName serviceName = depUnit.getServiceName().append("Activate");
            BundleActivateService service = new BundleActivateService(depUnit);
            ServiceBuilder<XBundle> builder = serviceTarget.addService(serviceName, service);
            builder.addDependency(resolvedBundle, XBundle.class, service.injectedBundle);
            // Add a dependency on the BundleActivator component
View Full Code Here

        @Override
        public void start(StartContext context) throws StartException {
            XBundle bundle = injectedBundle.getValue();
            Deployment deployment = depUnit.getAttachment(OSGiConstants.DEPLOYMENT_KEY);
            BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
            Component activatorComponent = injectedComponent.getOptionalValue();
            if (activatorComponent != null && deployment.getAttachment(BundleActivator.class) == null) {
                ComponentInstance componentInstance = activatorComponent.createInstance();
                BundleActivator instance = (BundleActivator) componentInstance.getInstance();
                deployment.addAttachment(BundleActivator.class, instance);
            }
            OperationAssociation.INSTANCE.setAssociation(new ModelNode("deploy"));
            try {
                bundleManager.startBundle(bundle, Bundle.START_ACTIVATION_POLICY);
                depUnit.putAttachment(Attachments.BUNDLE_STATE_KEY, BundleState.ACTIVE);
            } catch (BundleException ex) {
                throw MESSAGES.cannotStartBundle(ex, bundle);
            } finally {
                OperationAssociation.INSTANCE.removeAssociation();
View Full Code Here

        @Override
        public void stop(StopContext context) {
            XBundle bundle = injectedBundle.getValue();
            try {
                // Server shutdown should not modify the persistent start setting
                BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
                bundleManager.stopBundle(bundle, Bundle.STOP_TRANSIENT);
                depUnit.putAttachment(Attachments.BUNDLE_STATE_KEY, BundleState.RESOLVED);
            } catch (BundleException ex) {
                LOGGER.debugf(ex, "Cannot stop bundle: %s", bundle);
            }
        }
View Full Code Here

    private void resolveBundle(DeploymentPhaseContext phaseContext, DeploymentUnit depUnit, XBundle bundle) {
        XBundleRevision brev = bundle.getBundleRevision();
        XEnvironment env = depUnit.getAttachment(OSGiConstants.ENVIRONMENT_KEY);
        XResolver resolver = depUnit.getAttachment(OSGiConstants.RESOLVER_KEY);
        BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
        Set<XBundleRevision> mandatoryResources = Collections.singleton(brev);
        Set<XBundleRevision> optionalResources = getOptionalResources(bundleManager, brev);
        XResolveContext context = resolver.createResolveContext(env, mandatoryResources, optionalResources);
        try {
            LOGGER.debugf("Resolve: %s", depUnit.getName());
View Full Code Here

        if (deployment == null)
            return;

        ServiceName serviceName;
        try {
            final BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
            if (deploymentTracker.hasDeploymentName(depUnit.getName())) {
                restoreStorageState(phaseContext, deployment);
            }
            serviceName = bundleManager.installBundle(deployment, phaseContext.getServiceTarget(), null);
        } catch (BundleException ex) {
            throw new DeploymentUnitProcessingException(ex);
        }

        // Add a dependency on the next phase for this bundle to be installed
View Full Code Here

        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());
View Full Code Here

TOP

Related Classes of org.jboss.osgi.framework.spi.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.