Package org.jboss.gravia.runtime

Examples of org.jboss.gravia.runtime.Runtime


    @Override
    public void start(final StartContext startContext) throws StartException {
        LOGGER.info("Activating Gravia Subsystem");

        Runtime runtime = injectedRuntime.getValue();
        ModuleContext syscontext = runtime.getModuleContext();

        // Install and start this as a {@link Module}
        ModuleClassLoader classLoader = (ModuleClassLoader) getClass().getClassLoader();
        try {
            URL extensionURL = null;
            Enumeration<URL> resources = classLoader.getResources(JarFile.MANIFEST_NAME);
            while (resources.hasMoreElements()) {
                URL nextURL = resources.nextElement();
                if (nextURL.getPath().contains("wildfly-extension")) {
                    extensionURL = nextURL;
                    break;
                }
            }
            Manifest manifest = new Manifest(extensionURL.openStream());
            Dictionary<String, String> headers = new ManifestHeadersProvider(manifest).getHeaders();
            module = runtime.installModule(classLoader, headers);

            // Attach the {@link ModuleEntriesProvider} so
            ModuleEntriesProvider entriesProvider = new ClassLoaderEntriesProvider(module);
            Attachable attachable = AbstractModule.assertAbstractModule(module);
            attachable.putAttachment(AbstractModule.MODULE_ENTRIES_PROVIDER_KEY, entriesProvider);
View Full Code Here


        return builder.install();
    }

    @Override
    public void start(StartContext startContext) throws StartException {
        Runtime runtime = injectedRuntime.getValue();
        syscontext = runtime.getModuleContext();
    }
View Full Code Here

        context.putAttachment(WildFlyRuntime.DEPLOYMENT_ROOT_KEY, deploymentRoot);

        // Install the module
        ModuleClassLoader classLoader = depUnit.getAttachment(Attachments.MODULE).getClassLoader();
        try {
            Runtime runtime = RuntimeLocator.getRequiredRuntime();
            Module module = runtime.installModule(classLoader, resource, headers, context);
            depUnit.putAttachment(GraviaConstants.MODULE_KEY, module);
            depUnit.putAttachment(GraviaConstants.RESOURCE_KEY, module.adapt(Resource.class));
        } catch (ModuleException ex) {
            throw new DeploymentUnitProcessingException(ex);
        }
View Full Code Here

    }

    @Override
    public void start(StartContext startContext) throws StartException {
        PropertiesProvider propsProvider = new DefaultPropertiesProvider(getRuntimeProperties(), true);
        Runtime runtime = RuntimeLocator.createRuntime(new WildFlyRuntimeFactory(), propsProvider);
        runtime.init();

        // Initialize ConfigurationAdmin content
        Object configsDir = propsProvider.getProperty(Constants.PROPERTY_CONFIGURATIONS_DIR);
        ActivationSupport.initConfigurationAdmin(new File((String) configsDir));
    }
View Full Code Here

        // META-INF/service discovery happens on every call to the factory
        // we need to delegate to the single instance
        synchronized (WildFlyURLStreamHandlerFactory.class) {
            if (tracker == null) {
                Runtime runtime = RuntimeLocator.getRequiredRuntime();
                tracker = new URLStreamHandlerTracker(runtime.getModuleContext());
                tracker.open();
            }
        }
    }
View Full Code Here

    }

    @Override
    @SuppressWarnings("deprecation")
    public void start(StartContext startContext) throws StartException {
        Runtime runtime = injectedRuntime.getValue();
        MatchPolicy matchPolicy = new DefaultMatchPolicy();
        File modulesDir = injectedServerEnvironment.getValue().getModulesDir();
        environment = new RuntimeEnvironment(runtime, new SystemResourceStore(modulesDir), matchPolicy);

        ModuleContext syscontext = runtime.getModuleContext();
        registration = syscontext.registerService(RuntimeEnvironment.class, environment, null);
    }
View Full Code Here

    public void contextInitialized(ServletContextEvent event) {

        // Create the runtime
        ServletContext servletContext = event.getServletContext();
        ServletContextPropertiesProvider propsProvider = new ServletContextPropertiesProvider(servletContext);
        Runtime runtime = RuntimeLocator.createRuntime(new TomcatRuntimeFactory(servletContext), propsProvider);
        runtime.init();

        // Register the {@link RuntimeEnvironment}, {@link ResourceInstaller} services
        registerServices(servletContext, runtime);

        // Install and start this webapp as a module
        WebAppContextListener webappInstaller = new WebAppContextListener();
        Module module = webappInstaller.installWebappModule(servletContext);
        servletContext.setAttribute(Module.class.getName(), module);
        try {
            module.start();
        } catch (ModuleException ex) {
            throw new IllegalStateException(ex);
        }

        // HttpService integration
        Module sysmodule = runtime.getModuleContext().getModule();
        BundleContext bundleContext = sysmodule.adapt(Bundle.class).getBundleContext();
        servletContext.setAttribute(BundleContext.class.getName(), bundleContext);
    }
View Full Code Here

        ServiceReference<Repository> repref = repositoryRef.get();
        if (registration == null && resref != null  & repref != null) {
            context.removeServiceListener(listener);
            Resolver resolver = context.getService(resref);
            Repository repository = context.getService(repref);
            Runtime runtime = RuntimeLocator.getRequiredRuntime();
            RuntimeEnvironment environment = new RuntimeEnvironment(runtime).initDefaultContent();
            BundleResourceInstaller installer = new BundleResourceInstaller(context, environment);
            Provisioner provisioner = new DefaultProvisioner(environment, resolver, repository, installer);
            registration = context.registerService(Provisioner.class, provisioner, null);
        }
View Full Code Here

            ThreadResourceAssociation.removeResource();
        }

        // Install the bundle as module if it has not already happened
        // A bundle that could not get resolved will have no associated module
        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        Module module = runtime.getModule(identity);
        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        if (module == null && wiring != null) {
            try {
                ClassLoader classLoader = wiring.getClassLoader();
                module = runtime.installModule(classLoader, resource, null);
            } catch (ModuleException ex) {
                throw new ProvisionException(ex);
            }
        }
View Full Code Here

    public ResourceStore getSystemStore() {
        return systemStore;
    }

    public RuntimeEnvironment initDefaultContent() {
        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        File repositoryDir = new File((String) runtime.getProperty(Constants.PROPERTY_REPOSITORY_STORAGE_DIR));
        File environmentXML = new File(repositoryDir, "environment.xml");
        try {
            InputStream content = new FileInputStream(environmentXML);
            initDefaultContent(content);
        } catch (FileNotFoundException ex) {
View Full Code Here

TOP

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

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.