protected ModulesRegistry createModulesRegistry() { assert (mrReg == null); ModulesRegistry mr = AbstractFactory.getInstance().createModulesRegistry(); mrReg = ctx.registerService(ModulesRegistry.class.getName(), mr, null); return mr; }
public ModuleDefinition find(String name, String version) { return moduleDefs.get(AbstractFactory.getInstance().createModuleId(name, version)); }
ModulesRegistry modulesRegistry = SingleHK2Factory.getInstance().createModulesRegistry();
ModulesRegistry modulesRegistry = SingleHK2Factory.getInstance().createModulesRegistry();
protected void add(ModuleDefinition def) { moduleDefs.put(AbstractFactory.getInstance().createModuleId(def), def); }
protected ModulesRegistry createModulesRegistry() throws Exception { assert (mrReg == null); ModulesRegistry mr = AbstractFactory.getInstance().createModulesRegistry(); String hk2RepositoryUris = ctx.getProperty(Constants.HK2_REPOSITORIES); if (hk2RepositoryUris != null) { for (String s : hk2RepositoryUris.split("\\s")) { URI repoURI = URI.create(s); File repoDir = new File(repoURI); OSGiDirectoryBasedRepository repo = new OSGiDirectoryBasedRepository(repoDir.getAbsolutePath(), repoDir); repo.initialize(); mr.addRepository(repo); } } String osgiRepositoryUris = ctx.getProperty(Constants.OBR_REPOSITORIES); if (osgiRepositoryUris != null && mr instanceof OSGiObrModulesRegistryImpl) { OSGiObrModulesRegistryImpl mr1 = (OSGiObrModulesRegistryImpl) mr; for (String s : osgiRepositoryUris.split("\\s")) { mr1.addObr(URI.create(s)); } } mrReg = ctx.registerService(ModulesRegistry.class.getName(), mr, null); return mr; }
protected void remove(ModuleDefinition def) { moduleDefs.remove(AbstractFactory.getInstance().createModuleId(def)); }
public GlassFishRuntime build(BootstrapProperties bsProps) throws GlassFishException { /* Step 1. Build the classloader. */ // The classloader should contain installRoot/modules/**/*.jar files. String installRoot = getInstallRoot(bsProps); if (installRoot != null) { System.setProperty("org.glassfish.embeddable.installRoot", installRoot); } // Required to add moduleJarURLs to support 'java -jar modules/glassfish.jar case' List<URL> moduleJarURLs = getModuleJarURLs(installRoot); ClassLoader cl = getClass().getClassLoader(); if (!moduleJarURLs.isEmpty()) { cl = new StaticClassLoader(getClass().getClassLoader(), moduleJarURLs); } // Step 2. Setup the module subsystem. Main main = new EmbeddedMain(cl); SingleHK2Factory.initialize(cl); ModulesRegistry modulesRegistry = AbstractFactory.getInstance().createModulesRegistry(); modulesRegistry.setParentClassLoader(cl); // Step 3. Create NonOSGIGlassFishRuntime GlassFishRuntime glassFishRuntime = new StaticGlassFishRuntime(main); logger.logp(Level.FINER, getClass().getName(), "build", "Created GlassFishRuntime {0} with InstallRoot {1}, Bootstrap Options {2}", new Object[]{glassFishRuntime, installRoot, bsProps}); return glassFishRuntime; }
public ModuleDefinition find(String name, String version) { return moduleDefs.get(AbstractFactory.getInstance().createModuleId(name, version)); }
public GlassFishRuntime build(BootstrapProperties bsProps) throws GlassFishException { /* Step 1. Build the classloader. */ // The classloader should contain installRoot/modules/**/*.jar files. String installRoot = getInstallRoot(bsProps); if (installRoot != null) { System.setProperty("org.glassfish.embeddable.installRoot", installRoot); } // Required to add moduleJarURLs to support 'java -jar modules/glassfish.jar case' List<URL> moduleJarURLs = getModuleJarURLs(installRoot); ClassLoader cl = getClass().getClassLoader(); if (!moduleJarURLs.isEmpty()) { cl = new StaticClassLoader(getClass().getClassLoader(), moduleJarURLs); } // Step 2. Setup the module subsystem. Main main = new EmbeddedMain(cl); SingleHK2Factory.initialize(cl); ModulesRegistry modulesRegistry = AbstractFactory.getInstance().createModulesRegistry(); modulesRegistry.setParentClassLoader(cl); // Step 3. Create NonOSGIGlassFishRuntime GlassFishRuntime glassFishRuntime = new StaticGlassFishRuntime(main); logger.logp(Level.FINER, getClass().getName(), "build", "Created GlassFishRuntime {0} with InstallRoot {1}, Bootstrap Options {2}", new Object[]{glassFishRuntime, installRoot, bsProps}); return glassFishRuntime; }
protected void add(ModuleDefinition def) { moduleDefs.put(AbstractFactory.getInstance().createModuleId(def), def); }
/** * Start the server from the command line * * @param args * the command line arguments */ public void start(String[] args) throws BootException { File bootstrap = this.getBootstrapFile(); File root = bootstrap.getAbsoluteFile().getParentFile(); // root is the directory in which this bootstrap.jar is located // For most cases, this is the lib directory although this is completely // dependent on the usage of this facility. if (root == null) { throw new BootException("Cannot find root installation from " + bootstrap); } // get the ModuleStartup implementation. ModulesRegistry mr = AbstractFactory.getInstance().createModulesRegistry(); StartupContext context = new StartupContext( ArgumentManager.argsToMap(args)); launch(mr, context.getPlatformMainServiceName(), context); }
protected void remove(ModuleDefinition def) { moduleDefs.remove(AbstractFactory.getInstance().createModuleId(def)); }
/** * Start the server from the command line * * @param args * the command line arguments */ public void start(String[] args) throws BootException { File bootstrap = this.getBootstrapFile(); File root = bootstrap.getAbsoluteFile().getParentFile(); // root is the directory in which this bootstrap.jar is located // For most cases, this is the lib directory although this is completely // dependent on the usage of this facility. if (root == null) { throw new BootException("Cannot find root installation from " + bootstrap); } // get the ModuleStartup implementation. ModulesRegistry mr = AbstractFactory.getInstance().createModulesRegistry(); StartupContext context = new StartupContext( ArgumentManager.argsToMap(args)); launch(mr, context.getPlatformMainServiceName(), context); }
protected void loadModuleDefs(Map<ModuleId, ModuleDefinition> moduleDefs, List<URI> libraries) throws IOException { if (!repository.exists()) { throw new FileNotFoundException(repository.getAbsolutePath()); } try { File[] files = repository.listFiles(); for (File aFile : files) { if (aFile.getName().endsWith(".jar") && !isDisabled(aFile)) { ModuleDefinition moduleDef = loadJar(aFile); if (moduleDef!=null) { moduleDefs.put(AbstractFactory.getInstance().createModuleId(moduleDef), moduleDef); } else { libraries.add(aFile.toURI()); } } } } catch (IOException e) { IOException x = new IOException("Failed to load modules from " + repository); x.initCause(e); throw x; } }
protected void loadModuleDefs(Map<ModuleId, ModuleDefinition> moduleDefs, List<URI> libraries) throws IOException { if (!repository.exists()) { throw new FileNotFoundException(repository.getAbsolutePath()); } try { File[] files = repository.listFiles(); for (File aFile : files) { if (aFile.getName().endsWith(".jar") && !isDisabled(aFile)) { ModuleDefinition moduleDef = loadJar(aFile); if (moduleDef!=null) { moduleDefs.put(AbstractFactory.getInstance().createModuleId(moduleDef), moduleDef); } else { libraries.add(aFile.toURI()); } } } } catch (IOException e) { IOException x = new IOException("Failed to load modules from " + repository); x.initCause(e); throw x; } }
Repository repo = repos.get(key); for (ModuleDefinition moduleDef : repo.findAll()) { if (modules.get(AbstractFactory.getInstance().createModuleId(moduleDef)) == null) { Module newModule = newModule(moduleDef); if (newModule != null) {
Repository repo = repos.get(key); for (ModuleDefinition moduleDef : repo.findAll()) { if (modules.get(AbstractFactory.getInstance().createModuleId(moduleDef)) == null) { Module newModule = newModule(moduleDef); if (newModule != null) {
ModuleId id = AbstractFactory.getInstance().createModuleId( newModule.getModuleDefinition()); if (modules.get(id) != null) return;
ModuleId id = AbstractFactory.getInstance().createModuleId( newModule.getModuleDefinition()); if (modules.get(id) != null) return;