Package org.jboss.osgi.deployment.deployer

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


            }
        }

        @Override
        public void start(XBundle bundle, int options) throws BundleException {
            Deployment deployment = bundle.adapt(Deployment.class);
            DeploymentUnit depUnit = deployment.getAttachment(DeploymentUnit.class);

            // The DeploymentUnit would be null for initial capabilities
            // or for bundles that have been installed in nested mgmnt ops
            // https://issues.jboss.org/browse/AS7-5642
            if (depUnit == null) {
View Full Code Here


        @Override
        public void uninstall(XBundle bundle, int options) throws BundleException {
            LOGGER.tracef("Uninstall deployment: %s", bundle);
            try {
                ServerDeploymentHelper server = new ServerDeploymentHelper(deploymentManager);
                Deployment dep = bundle.adapt(Deployment.class);
                server.undeploy(getRuntimeName(dep));
            } catch (Exception ex) {
                LOGGER.warnCannotUndeployBundle(ex, bundle);
            }
        }
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);
View Full Code Here

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

        DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        Deployment deployment = depUnit.getAttachment(OSGiConstants.DEPLOYMENT_KEY);
        XBundle bundle = depUnit.getAttachment(OSGiConstants.BUNDLE_KEY);
        if (bundle == null || !deployment.isAutoStart() || bundle.isResolved())
            return;

        resolveBundle(phaseContext, depUnit, bundle);
    }
View Full Code Here

public class BundleDependenciesProcessor implements DeploymentUnitProcessor {

    @Override
    public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        final Deployment deployment = depUnit.getAttachment(OSGiConstants.DEPLOYMENT_KEY);
        if (deployment == null)
            return;

        // Add a dependency on the next phase for all persisten bundles to be installed
        phaseContext.addDeploymentDependency(IntegrationServices.PERSISTENT_BUNDLES_COMPLETE, AttachmentKey.create(Object.class));
View Full Code Here

         * 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) {
View Full Code Here

        @Override
        public void addIntegrationDependencies(ModuleSpecBuilderContext context) {
            Builder builder = context.getModuleSpecBuilder();
            XBundleRevision brev = context.getBundleRevision();
            Map<ModuleIdentifier, DependencySpec> moduleDependencies = context.getModuleDependencies();
            Deployment deployment = brev.getBundle().adapt(Deployment.class);
            ModuleSpecification moduleSpecification = deployment.getAttachment(ModuleSpecification.class);
            if (moduleSpecification != null) {
                List<ModuleDependency> dependencies = moduleSpecification.getAllDependencies();
                LOGGER.debugf("Adding integration dependencies: %d", dependencies.size());
                for (ModuleDependency moduleDep : dependencies) {
                    ModuleIdentifier moduleId = moduleDep.getIdentifier();
View Full Code Here

            }
        }

        @Override
        public ServiceName createModuleService(XBundleRevision brev, List<BundleWire> wires) {
            Deployment deployment = brev.getBundle().adapt(Deployment.class);
            DeploymentUnit depUnit = deployment.getAttachment(DeploymentUnit.class);

            // Add a dependency on the parent module if we have one
            List<ModuleDependency> dependencies = new ArrayList<ModuleDependency>();
            if (depUnit != null && depUnit.getParent() != null) {
                String parentName = depUnit.getParent().getName();
View Full Code Here

        final DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        final String runtimeName = depUnit.getName();

        // Check if {@link BundleInstallIntegration} provided the {@link Deployment}
        Deployment deployment = BundleLifecycleIntegration.removeDeployment(runtimeName);
        if (deployment != null) {
            deployment.setAutoStart(false);
        }

        // Check for attached BundleInfo
        BundleInfo info = depUnit.getAttachment(OSGiConstants.BUNDLE_INFO_KEY);
        if (deployment == null && info != null) {
            deployment = DeploymentFactory.createDeployment(info);
            deployment.addAttachment(BundleInfo.class, info);
            OSGiMetaData metadata = info.getOSGiMetadata();
            deployment.setAutoStart(!metadata.isFragment());

            // Set the start level and prevent autostart if greater than the Framwork startlevel
            AnnotationInstance slAware = getAnnotation(depUnit, "org.jboss.arquillian.osgi.StartLevelAware");
            if (slAware != null) {
                MethodInfo slTarget = (MethodInfo) slAware.target();
                for (AnnotationInstance anDeployment : getAnnotations(depUnit, "org.jboss.arquillian.container.test.api.Deployment")) {
                    AnnotationValue namevalue = anDeployment.value("name");
                    Object deploymentName = namevalue != null ? namevalue.value() : null;
                    if (slTarget == anDeployment.target() && depUnit.getName().equals(deploymentName)) {
                        int startLevel = slAware.value("startLevel").asInt();
                        deployment.setStartLevel(startLevel);
                        deployment.setAutoStart(false);
                    }
                }
            }

            // Prevent autostart for marked deployments
            AnnotationInstance marker = getAnnotation(depUnit, "org.jboss.as.arquillian.api.DeploymentMarker");
            if (marker != null) {
                AnnotationValue value = marker.value("autoStart");
                if (value != null && deployment.isAutoStart()) {
                    deployment.setAutoStart(value.asBoolean());
                }
                value = marker.value("startLevel");
                if (value != null && deployment.getStartLevel() == null) {
                    deployment.setStartLevel(value.asInt());
                }
            }
        }

        // Attach the deployment
        if (deployment != null) {

            // Make sure the framework uses the same module id as the server
            ModuleIdentifier identifier = depUnit.getAttachment(Attachments.MODULE_IDENTIFIER);
            deployment.addAttachment(ModuleIdentifier.class, identifier);

            // Allow additional dependencies for the set of supported deployemnt types
            if (allowAdditionalModuleDependencies(depUnit)) {
                ModuleSpecification moduleSpec = depUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
                deployment.addAttachment(ModuleSpecification.class, moduleSpec);
            } else {
                // Make this module private so that other modules in the deployment don't create a direct dependency
                ModuleSpecification moduleSpec = depUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
                moduleSpec.setPrivateModule(true);
            }

            // Attach the bundle deployment
            depUnit.putAttachment(OSGiConstants.DEPLOYMENT_KEY, deployment);
            deployment.addAttachment(DeploymentUnit.class, depUnit);
        }
    }
View Full Code Here

    }

    @Override
    public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        final Deployment deployment = depUnit.getAttachment(OSGiConstants.DEPLOYMENT_KEY);
        if (deployment == null)
            return;

        ServiceName serviceName;
        try {
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.