Package org.jboss.gravia.runtime

Examples of org.jboss.gravia.runtime.Module


        }

        @Override
        public void bundleChanged(BundleEvent event) {
            Integer bndtype = event.getType();
            Module module = mappedModule(event.getBundle());
            Integer modtype = eventMapping.get(bndtype);
            if (module != null && modtype != null) {
                ModuleEvent moduleEvent = new ModuleEvent(modtype, module);
                delegate.moduleChanged(moduleEvent);
            }
View Full Code Here


            RuntimeFactory runtimeFactory = new TomcatRuntimeFactory();
            DefaultPropertiesProvider propsProvider = new DefaultPropertiesProvider();
            runtime = RuntimeLocator.createRuntime(runtimeFactory, propsProvider);
            runtime.init();
        }
        Module module = installWebappModule(runtime, servletContext);
        if (module != null) {
            try {
                module.start();
            } catch (ModuleException ex) {
                throw new IllegalStateException(ex);
            }
            servletContext.setAttribute(Module.class.getName(), module);
        }
View Full Code Here

     * Uninstalls the webapp's  module.
     */
    @Override
    public void contextDestroyed(ServletContextEvent event) {
        ServletContext servletContext = event.getServletContext();
        Module module = (Module) servletContext.getAttribute(Module.class.getName());
        if (module != null && module.getState() != Module.State.UNINSTALLED) {
            module.uninstall();
        }
    }
View Full Code Here

            return null;

        AttachableSupport context = new AttachableSupport();
        context.putAttachment(TomcatRuntime.SERVLET_CONTEXT_KEY, servletContext);

        Module module;
        try {
            Resource resource = resbuilder.getResource();
            ManifestHeadersProvider headersProvider = new ManifestHeadersProvider(manifest);
            module = runtime.installModule(classLoader, resource, headersProvider.getHeaders(), context);
            servletContext.setAttribute(Module.class.getName(), module);
View Full Code Here

        ServiceLoader<RuntimePlugin> services = ServiceLoader.load(RuntimePlugin.class, EmbeddedRuntime.class.getClassLoader());
        Iterator<RuntimePlugin> iterator = services.iterator();
        while (iterator.hasNext()) {
            RuntimePlugin plugin = iterator.next();
            try {
                Module module = plugin.installPluginModule(this, classLoader);
                if (module != null) {
                    pluginModules.add(module);
                }
            } catch (ModuleException ex) {
                LOGGER.error("Cannot load plugin: " + plugin.getClass().getName(), ex);
View Full Code Here

                int eventType = event.getType();
                Bundle bundle = event.getBundle();
                if (eventType == BundleEvent.RESOLVED) {
                    installModule(bundle);
                } else if (eventType == BundleEvent.UNINSTALLED) {
                    Module module = getModule(bundle);
                    if (module != null) {
                        synchronized (uninstalled) {
                            uninstalled.put(bundle.getBundleId(), module);
                            uninstallModule(module);
                        }
View Full Code Here

            }
        };
    }

    Module getModule(Bundle bundle) {
        Module module = super.getModule(bundle.getBundleId());
        if (module == null && bundle.getState() == Bundle.UNINSTALLED) {
            synchronized (uninstalled) {
                module = uninstalled.get(bundle.getBundleId());
               
                // Cleanup uninstalled modules for which there is no bundle any more
View Full Code Here

        super.uninstallModule(module);
    }

    private Module installModule(Bundle bundle) {

        Module module = getModule(bundle.getBundleId());
        if (module != null)
            return module;

        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        ClassLoader classLoader = wiring != null ? wiring.getClassLoader() : null;
View Full Code Here

        }

        @Override
        public void bundleChanged(BundleEvent event) {
            Integer bndtype = event.getType();
            Module module = mappedModule(event.getBundle());
            Integer modtype = eventMapping.get(bndtype);
            if (module != null && modtype != null) {
                ModuleEvent moduleEvent = new ModuleEvent(modtype, module);
                delegate.moduleChanged(moduleEvent);
            }
View Full Code Here

        ServiceLoader<RuntimePlugin> services = ServiceLoader.load(RuntimePlugin.class, EmbeddedRuntime.class.getClassLoader());
        Iterator<RuntimePlugin> iterator = services.iterator();
        while (iterator.hasNext()) {
            RuntimePlugin plugin = iterator.next();
            try {
                Module module = plugin.installPluginModule(this, classLoader);
                if (module != null) {
                    pluginModules.add(module);
                }
            } catch (ModuleException ex) {
                LOGGER.error("Cannot load plugin: " + plugin.getClass().getName(), ex);
            }
        }

        // Start the plugin modules
        for (Module module : pluginModules) {
            try {
                module.start();
            } catch (ModuleException ex) {
                LOGGER.error("Cannot start plugin: " + module, ex);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.gravia.runtime.Module

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.