Package org.jboss.gravia.runtime

Examples of org.jboss.gravia.runtime.Module


        }

        // 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);
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) {
                        uninstalled.put(bundle, module);
                        uninstallModule(module);
                    }
                }
View Full Code Here

            }
        };
    }

     Module getModule(Bundle bundle) {
        Module module = super.getModule(bundle.getBundleId());
        if (module == null && bundle.getState() == Bundle.UNINSTALLED) {
            module = uninstalled.get(bundle);
        }
        return module;
    }
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

        // Track installed/uninstalled modules
        ModuleListener listener = new SynchronousModuleListener() {
            @Override
            public void moduleChanged(ModuleEvent event) {
                Module module = event.getModule();
                if (event.getType() == ModuleEvent.INSTALLED) {
                    addRuntimeResource(module.adapt(Resource.class));
                } else if (event.getType() == ModuleEvent.UNINSTALLED) {
                    removeRuntimeResource(module.getIdentity());
                }
            }
        };
        ModuleContext syscontext = runtime.getModuleContext();
        syscontext.addModuleListener(listener);
View Full Code Here

        }

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

    // BundleContext API

    @Override
    public Bundle getBundle() {
        Module module = moduleContext.getModule();
        return new BundleAdaptor(module);
    }
View Full Code Here

        return (value instanceof String ? (String) value : null);
    }

    @Override
    public Bundle getBundle(long id) {
        Module module = getRuntime().getModule(id);
        return module != null ? new BundleAdaptor(module) : null;
    }
View Full Code Here

        }

        @Override
        public void moduleChanged(ModuleEvent event) {
            int type = event.getType();
            Module module = event.getModule();
            BundleEvent bundleEvent = new BundleEvent(type, new BundleAdaptor(module));
            delegate.bundleChanged(bundleEvent);
        }
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.