public static ServiceLocator getStaticHabitat() { if (defaultHabitat == null) { synchronized (staticLock) { if (defaultHabitat == null) { ModulesRegistry modulesRegistry = new StaticModulesRegistry(Globals.class.getClassLoader()); defaultHabitat = modulesRegistry.createServiceLocator("default"); } } } return defaultHabitat; }
@Override public Object run() { try { URLClassLoader pl = new URLClassLoader(getJars(ext)); ModulesRegistry registry = new StaticModulesRegistry(pl); locator = registry.createServiceLocator("default"); return pl; } catch (IOException ex) { // any failure here is fatal LOG.log(Level.SEVERE, ConfigApiLoggerInfo.MODULES_CL_FAILED, ex); } return ecl; } });
public static ServiceLocator getNewHabitat(String root) { Properties p = new Properties(); p.put(com.sun.enterprise.glassfish.bootstrap.Constants.INSTALL_ROOT_PROP_NAME, root); p.put(com.sun.enterprise.glassfish.bootstrap.Constants.INSTANCE_ROOT_PROP_NAME, root); ModulesRegistry registry = new StaticModulesRegistry(Utils.class.getClassLoader(), new StartupContext(p)); ServiceLocator defaultSL = registry.createServiceLocator("default"); return defaultSL; }
/** * Return a ServiceLocator used just for reading man pages from the modules * in the modules directory. */ private static synchronized ServiceLocator getManHabitat() { if (manServiceLocator != null) return manServiceLocator; ModulesRegistry registry = new StaticModulesRegistry(getModuleClassLoader()); manServiceLocator = registry.createServiceLocator("default"); return manServiceLocator; }
/** * Return a ServiceLocator used just for reading man pages from the * modules in the modules directory. */ private static synchronized ServiceLocator getManHabitat() { if (manServiceLocator != null) return manServiceLocator; ModulesRegistry registry = new StaticModulesRegistry(getModuleClassLoader()); ServiceLocator serviceLocator = registry.createServiceLocator("default"); manServiceLocator = serviceLocator; return manServiceLocator; }
/** * Launches the module system and hand over the execution to the * {@link ModuleStartup} implementation of the main module. * * @param mainModuleName * The module that will provide {@link ModuleStartup}. If null, * one will be auto-discovered. * @param context * startup context instance * @return The ModuleStartup service */ public ModuleStartup launch(ModulesRegistry registry, String mainModuleName, StartupContext context) throws BootException { // now go figure out the start up service ServiceLocator serviceLocator = registry.createServiceLocator(DEFAULT_NAME); ModuleStartup startupCode = findStartupService(registry, serviceLocator, mainModuleName, context); launch(startupCode, context); return startupCode; }
/** * Launches the module system and hand over the execution to the * {@link ModuleStartup} implementation of the main module. * * @param mainModuleName * The module that will provide {@link ModuleStartup}. If null, * one will be auto-discovered. * @param context * startup context instance * @return The ModuleStartup service */ public ModuleStartup launch(ModulesRegistry registry, String mainModuleName, StartupContext context) throws BootException { // now go figure out the start up service ServiceLocator serviceLocator = registry.createServiceLocator(DEFAULT_NAME); ModuleStartup startupCode = findStartupService(registry, serviceLocator, mainModuleName, context); launch(startupCode, context); return startupCode; }
private void prepareHabitat() { ModulesRegistry registry = new StaticModulesRegistry(getClass().getClassLoader()); ServiceLocator serviceLocator = registry.createServiceLocator("default"); habitat = serviceLocator.getService(ServiceLocator.class); StartupContext startupContext = new StartupContext(); ServiceLocatorUtilities.addOneConstant(habitat, startupContext); ServiceLocatorUtilities.addOneConstant(habitat, new ProcessEnvironment(ProcessEnvironment.ProcessType.Other)); }
ServiceLocator serviceLocator = registry.createServiceLocator("default");
public ServiceLocator getServiceLocator() { if (serviceLocator == null) { Metrix.event("Init hk2 - start"); ModulesRegistry registry = new StaticModulesRegistry(this.classLoader); serviceLocator = registry.createServiceLocator("default"); if (programOptions != null) { ServiceLocatorUtilities.addOneConstant(serviceLocator, programOptions); } if (environment != null) { ServiceLocatorUtilities.addOneConstant(serviceLocator, environment); } ServiceLocatorUtilities.addOneConstant(serviceLocator, this); Metrix.event("Init hk2 - done"); } return serviceLocator; }