Examples of XBundle


Examples of org.jboss.osgi.resolver.XBundle

    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        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

Examples of org.jboss.osgi.resolver.XBundle

        }

        private ContextManager initializeContextManager(final ArquillianConfig config, final Map<String, Object> properties) {
            final ContextManagerBuilder builder = new ContextManagerBuilder();
            final DeploymentUnit depUnit = config.getDeploymentUnit();
            final XBundle bundle = depUnit.getAttachment(OSGiConstants.BUNDLE_KEY);
            final Module module = depUnit.getAttachment(Attachments.MODULE);
            if (bundle == null && module != null) {
                builder.add(new TCCLSetupAction(module.getClassLoader()));
            }
            builder.addAll(depUnit);
View Full Code Here

Examples of org.jboss.osgi.resolver.XBundle

    Class<?> loadClass(String className) throws ClassNotFoundException {

        if (testClasses.contains(className) == false)
            throw new ClassNotFoundException("Class '" + className + "' not found in: " + testClasses);

        XBundle bundle = depUnit.getAttachment(OSGiConstants.BUNDLE_KEY);
        Module module = depUnit.getAttachment(Attachments.MODULE);
        if (bundle == null && module == null)
            throw new IllegalStateException("Cannot determine deployment type: " + depUnit);

        Class<?> testClass;
        if (bundle != null) {
            testClass = bundle.loadClass(className);
            BundleAssociation.setBundle(bundle);
        } else {
            testClass = module.getClassLoader().loadClass(className);
        }
View Full Code Here

Examples of org.jboss.osgi.resolver.XBundle

    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

Examples of org.jboss.osgi.resolver.XBundle

    @Override
    public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
        ContextActivator activator = depUnit.getAttachment(ContextActivator.ATTACHMENT_KEY);
        XBundle bundle = depUnit.getAttachment(OSGiConstants.BUNDLE_KEY);
        if (activator != null && bundle != null) {
            // 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

Examples of org.jboss.osgi.resolver.XBundle

    }

    @Override
    public void undeploy(final DeploymentUnit depUnit) {
        ContextActivator activator = depUnit.getAttachment(ContextActivator.ATTACHMENT_KEY);
        XBundle bundle = depUnit.getAttachment(OSGiConstants.BUNDLE_KEY);
        if (activator != null && bundle != null) {
            bundle.adapt(Deployment.class).removeAttachment(ContextActivator.class);
        }
    }
View Full Code Here

Examples of org.jboss.osgi.resolver.XBundle

            registration.unregister();
    }

    @Override
    public void invoke(int state, InvocationContext context) {
        XBundle bundle = (XBundle) context.getBundle();
        XBundleRevision brev = bundle.getBundleRevision();
        ContextActivator activator = brev.getAttachment(ContextActivator.class);
        if (activator != null) {
            switch (state) {
                case Bundle.ACTIVE:
                    try {
                        injectBundleContext(activator.getContext(), bundle.getBundleContext());
                        if (!activator.start(4, TimeUnit.SECONDS)) {
                            throw new LifecycleInterceptorException(MESSAGES.startContextFailed());
                        }
                    } catch (TimeoutException ex) {
                        throw new LifecycleInterceptorException(ex.getMessage(), ex);
View Full Code Here

Examples of org.jboss.osgi.resolver.XBundle

            this.depUnit = depUnit;
        }

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

Examples of org.jboss.osgi.resolver.XBundle

            }
        }

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

Examples of org.jboss.osgi.resolver.XBundle

    @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
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.