Package org.jboss.modules

Examples of org.jboss.modules.ModuleLoader$RealMBeanReg


    private static ModuleIdentifier SHRINKWRAP_ID = ModuleIdentifier.create("org.jboss.shrinkwrap.api");
    private static ModuleIdentifier JUNIT_ID = ModuleIdentifier.create("org.junit");
    @Override
    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        final ModuleLoader moduleLoader = Module.getBootModuleLoader();
        final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
        if (deploymentUnit.getAttachment(ArquillianConfig.KEY) != null) {
            addDepdenency(moduleSpecification, moduleLoader, ARQUILLIAN_JUNIT_ID);
            addDepdenency(moduleSpecification, moduleLoader, SHRINKWRAP_ID);
            addDepdenency(moduleSpecification, moduleLoader, JUNIT_ID);
View Full Code Here


       * loaded from that loader.
       */

      if (!identifier.equals("belongs to me"))
      {
         ModuleLoader loader = Module.getBootModuleLoader();
         return preloadModule(identifier, loader); // get the 'identifier' module from the boot loader instead of ours
      }

      /*
       * need some kind of criteria that determines whether or not a module is a plugin, or whether
View Full Code Here

                osw.close();
            }
        }

        // Install the resource as module
        ModuleLoader moduleLoader = org.jboss.modules.Module.getBootModuleLoader();
        ModuleClassLoader classLoader = moduleLoader.loadModule(modid).getClassLoader();
        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        final Module module = runtime.installModule(classLoader, resource, null);

        // Start the module
        module.start();
View Full Code Here

        // Install the resource as module if it has not happend already
        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        Module module = runtime.getModule(resource.getIdentity());
        if (module == null) {
            ModuleLoader moduleLoader = injectedServiceModuleLoader.getValue();
            ModuleIdentifier modid = ModuleIdentifier.create(ServiceModuleLoader.MODULE_PREFIX + runtimeName);
            ClassLoader classLoader = moduleLoader.loadModule(modid).getClassLoader();
            module = runtime.installModule(classLoader, resource, null);
        }

        Resource modres = module != null ? module.adapt(Resource.class) : resource;
        return new AbstractResourceHandle(modres, module) {
View Full Code Here

            String symbolicName = identity.getSymbolicName();
            Version version = identity.getVersion();
            String modname = symbolicName + (version != Version.emptyVersion ? ":" + version : "");
            ModuleIdentifier modid = ModuleIdentifier.fromString(modname);
            try {
                ModuleLoader moduleLoader = Module.getBootModuleLoader();
                moduleLoader.loadModule(modid);
            } catch (ModuleLoadException ex) {
                return null;
            }
            DefaultResourceBuilder builder = new DefaultResourceBuilder();
            Capability icap = builder.addIdentityCapability(symbolicName, version);
View Full Code Here

                        continue;
                    }
                    String modname = symbolicName + ":" + version;
                    ModuleIdentifier modid = ModuleIdentifier.fromString(modname);
                    try {
                        ModuleLoader moduleLoader = Module.getBootModuleLoader();
                        moduleLoader.loadModule(modid);
                    } catch (ModuleLoadException ex) {
                        continue;
                    }
                    DefaultResourceBuilder builder = new DefaultResourceBuilder();
                    Capability icap = builder.addIdentityCapability(symbolicName, version);
                    icap.getAttributes().put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, IdentityNamespace.TYPE_ABSTRACT);
                    result.add(builder.getResource().getIdentityCapability());
                }
            }

            // Add the main module
            if (result.isEmpty()) {
                ModuleIdentifier modid = ModuleIdentifier.fromString(symbolicName);
                try {
                    ModuleLoader moduleLoader = Module.getBootModuleLoader();
                    moduleLoader.loadModule(modid);

                    DefaultResourceBuilder builder = new DefaultResourceBuilder();
                    Capability icap = builder.addIdentityCapability(symbolicName, Version.emptyVersion);
                    icap.getAttributes().put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, IdentityNamespace.TYPE_ABSTRACT);
                    result.add(builder.getResource().getIdentityCapability());
View Full Code Here

       * that loader specifies that the module should be loaded from that loader.
       */

      if (!identifier.equals("belongs to me"))
      {
         ModuleLoader loader = Module.getBootModuleLoader();
         return preloadModule(identifier, loader); // get the 'identifier' module from the boot loader instead of ours
      }

      /*
       * need some kind of criteria that determines whether or not a module is a plugin, or whether it should actually
View Full Code Here

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
        final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);

        final ModuleLoader moduleLoader = Module.getBootModuleLoader();
        addDepdenency(moduleSpecification, moduleLoader, JAXB_API);

        if (!JaxrsDeploymentMarker.isJaxrsDeployment(deploymentUnit)) {
            return;
        }
View Full Code Here

        private Module createFrameworkModule(final Bundle systemBundle) {
            // Setup the extended framework module spec
            Module systemModule = injectedSystemModule.getValue();
            ModuleIdentifier systemIdentifier = systemModule.getIdentifier();
            ModuleLoader systemLoader = systemModule.getModuleLoader();
            ModuleSpec.Builder specBuilder = ModuleSpec.build(ModuleIdentifier.create(JBOSGI_PREFIX + ".framework"));
            PathFilter acceptAll = PathFilters.acceptAll();
            specBuilder.addDependency(DependencySpec.createModuleDependencySpec(acceptAll, acceptAll, systemLoader, systemIdentifier, false));

            // Add a dependency on the default framework module
            ModuleLoader bootLoader = Module.getBootModuleLoader();
            ModuleIdentifier frameworkIdentifier = ModuleIdentifier.create("org.jboss.osgi.framework");
            specBuilder.addDependency(DependencySpec.createModuleDependencySpec(acceptAll, acceptAll, bootLoader, frameworkIdentifier, false));

            // Add the user defined module dependencies
            String modulesProps = (String) subsystemState.getProperties().get(PROP_JBOSS_OSGI_SYSTEM_MODULES);
            if (modulesProps != null) {
                for (String moduleProp : modulesProps.split(",")) {
                    moduleProp = moduleProp.trim();
                    if (moduleProp.length() > 0) {
                        ModuleIdentifier moduleId = ModuleIdentifier.create(moduleProp);
                        DependencySpec moduleDep = DependencySpec.createModuleDependencySpec(acceptAll, acceptAll, bootLoader, moduleId, false);
                        specBuilder.addDependency(moduleDep);
                    }
                }
            }

            specBuilder.setModuleClassLoaderFactory(new BundleReferenceClassLoader.Factory(systemBundle));

            try {
                final ModuleSpec moduleSpec = specBuilder.create();
                ModuleLoader moduleLoader = new ModuleLoader() {

                    @Override
                    protected ModuleSpec findModule(ModuleIdentifier identifier) throws ModuleLoadException {
                        return (moduleSpec.getModuleIdentifier().equals(identifier) ? moduleSpec : null);
                    }

                    @Override
                    public String toString() {
                        return getClass().getSimpleName();
                    }
                };
                return moduleLoader.loadModule(specBuilder.getIdentifier());
            } catch (ModuleLoadException ex) {
                throw new IllegalStateException(ex);
            }
        }
View Full Code Here

                    Deployment dep = DeploymentFactory.createDeployment(info);
                    dep.setAutoStart(moduleMetaData.isStart());
                    serviceName = bundleManager.installBundle(serviceTarget, dep);
                }
                else {
                    ModuleLoader moduleLoader = Module.getBootModuleLoader();
                    Module module = moduleLoader.loadModule(identifier);
                    OSGiMetaData metadata = getModuleMetadata(module);
                    serviceName = bundleManager.installBundle(serviceTarget, module, metadata);
                }
                pendingServices.put(serviceName, moduleMetaData);
            }
View Full Code Here

TOP

Related Classes of org.jboss.modules.ModuleLoader$RealMBeanReg

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.