Package org.jboss.gravia.runtime

Examples of org.jboss.gravia.runtime.Runtime


        resource = builder.getResource();

        // Add the module to the {@link SharedModuleClassLoader}
        SharedModuleClassLoader.addSharedModule(resource);

        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        ClassLoader classLoader = SharedModuleClassLoader.class.getClassLoader();
        return runtime.installModule(classLoader, resource, null);
    }
View Full Code Here


public abstract class ServiceComponentTest  {

    @Test
    public void testBasicModule() throws Exception {

        Runtime runtime = RuntimeLocator.getRuntime();
        Module modA = runtime.getModule(getClass().getClassLoader());

        ModuleContext ctxA = modA.getModuleContext();
        ServiceReference<ServiceA> srefA = ctxA.getServiceReference(ServiceA.class);
        Assert.assertNotNull("ServiceReference not null", srefA);
View Full Code Here

public abstract class ConfigurationAdminTest  {

    @Test
    public void testBasicModule() throws Exception {

        Runtime runtime = RuntimeLocator.getRuntime();
        Module module = runtime.getModule(getClass().getClassLoader());

        ModuleContext ctxA = module.getModuleContext();
        ServiceReference<ServiceD> srefD = ctxA.getServiceReference(ServiceD.class);
        Assert.assertNotNull("ServiceReference not null", srefD);
View Full Code Here

    public void contextInitialized(ServletContextEvent event) {

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

        // HttpService integration
        ModuleContext moduleContext = runtime.getModuleContext();
        BundleContext bundleContext = new BundleContextAdaptor(moduleContext);
        servletContext.setAttribute(BundleContext.class.getName(), bundleContext);

        // Register the {@link Repository}, {@link Resolver}, {@link Provisioner} services
        Repository repository = registerRepositoryService(runtime);
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

    @Override
    public void start(BundleContext context) throws Exception {
        BundleContext syscontext = context.getBundle(0).getBundleContext();
        PropertiesProvider propsProvider = new BundleContextPropertiesProvider(syscontext);
        Runtime runtime = RuntimeLocator.createRuntime(new OSGiRuntimeFactory(syscontext), propsProvider);
        runtime.init();
    }
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

            // ignore
        }

        // 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

        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();
            BundleContextResourceInstaller installer = new BundleContextResourceInstaller(context, environment);
            Provisioner provisioner = new DefaultProvisioner(environment, resolver, repository, installer);
            registration = context.registerService(Provisioner.class, provisioner, null);
        }
View Full Code Here

        }

        private Module mappedModule(Bundle bundle) {
            Module result = null;
            if (bundle != null) {
                Runtime runtime = RuntimeLocator.getRequiredRuntime();
                result = runtime.getModule(bundle.getBundleId());
            }
            return result;
        }
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.