Package org.jboss.modules

Examples of org.jboss.modules.ModuleIdentifier


    @Override
    public synchronized void start(final StartContext context) throws StartException {
        final Handler handler;
        final ModuleLoader moduleLoader = Module.forClass(CustomHandlerService.class).getModuleLoader();
        final ModuleIdentifier id = ModuleIdentifier.create(moduleName);
        try {
            final Class<?> handlerClass = Class.forName(className, false, moduleLoader.loadModule(id).getClassLoader());
            if (Handler.class.isAssignableFrom(handlerClass)) {
                handler = (Handler) handlerClass.newInstance();
            } else {
View Full Code Here


        // copy resource content
        moduleDir.mkdirs();
        File resFile = new File(moduleDir, symbolicName + "-" + version + ".jar");
        IOUtils.copyStream(content.getContent(), new FileOutputStream(resFile));

        ModuleIdentifier modid = ModuleIdentifier.create(symbolicName, version.toString());

        // generate module.xml
        File xmlFile = new File(moduleDir, "module.xml");
        Map<Requirement, Resource> mapping = context.getResourceMapping();
        String moduleXML = generateModuleXML(resFile, resource, modid, mapping);
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;
View Full Code Here

    private final InjectedValue<Module> injectedModule = new InjectedValue<Module>();

    @Override
    public void visit(ConfigVisitor visitor) {
        if (moduleName != null) {
            ModuleIdentifier identifier = ModuleIdentifier.fromString(moduleName);
            if (moduleName.startsWith(ServiceModuleLoader.MODULE_PREFIX)) {
                ServiceName serviceName = ServiceModuleLoader.moduleServiceName(identifier);
                visitor.addDependency(serviceName, getInjectedModule());
            } else {
                Module dm = visitor.loadModule(identifier);
View Full Code Here

   public final Module loadAddonModule(Addon addon) throws ModuleLoadException
   {
      try
      {
         this.currentAddon.set(addon);
         ModuleIdentifier moduleId = moduleCache.getModuleId(addon);
         Module result = loadModule(moduleId);
         return result;
      }
      catch (ModuleLoadException e)
      {
View Full Code Here

   }

   private void addAddonDependency(Set<AddonView> views, AddonId found, Builder builder, AddonDependencyEntry dependency)
   {
      AddonId addonId = stateManager.resolveAddonId(views, dependency.getName());
      ModuleIdentifier moduleId = null;
      if (addonId != null)
      {
         Addon addon = lifecycleManager.getAddon(views, addonId);
         moduleId = findCompatibleInstalledModule(addonId);
         if (moduleId != null)
View Full Code Here

                  + "]");
   }

   private ModuleIdentifier findCompatibleInstalledModule(AddonId addonId)
   {
      ModuleIdentifier result = null;

      Addon addon = currentAddon.get();
      Version runtimeAPIVersion = AddonRepositoryImpl.getRuntimeAPIVersion();

      for (AddonRepository repository : stateManager.getViewsOf(addon).iterator().next().getRepositories())
View Full Code Here

      return "AddonModuleLoader";
   }

   public void releaseAddonModule(Addon addon)
   {
      ModuleIdentifier id = moduleCache.getModuleId(addon);
      moduleJarFileCache.closeJarFileReferences(id);
      Module loadedModule = findLoadedModuleLocal(id);
      if (loadedModule != null)
         unloadModuleLocal(loadedModule);
      moduleCache.clear(addon);
View Full Code Here

    /**
     * Add a {@link ModuleSpec} for and OSGi module as a service that can later be looked up by the {@link ServiceModuleLoader}
     */
    @Override
    public void addModule(final ModuleSpec moduleSpec) {
        ModuleIdentifier identifier = moduleSpec.getModuleIdentifier();
        ROOT_LOGGER.debugf("Add module spec to loader: %s", identifier);

        ServiceName moduleSpecName = ServiceModuleLoader.moduleSpecServiceName(identifier);
        serviceTarget.addService(moduleSpecName, new ValueService<ModuleSpec>(new ImmediateValue<ModuleSpec>(moduleSpec))).install();

View Full Code Here

        int revision = moduleId.getRevision();
        if (revision > 0)
            slot += "-rev" + revision;

        String name = ServiceModuleLoader.MODULE_PREFIX + moduleId.getName();
        ModuleIdentifier identifier = ModuleIdentifier.create(name, slot);
        resModule.addAttachment(ModuleIdentifier.class, identifier);

        return identifier;
    }
View Full Code Here

TOP

Related Classes of org.jboss.modules.ModuleIdentifier

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.