List of usage examples for org.apache.commons.configuration.interpol ConfigurationInterpolator registerGlobalLookup
public static void registerGlobalLookup(String prefix, StrLookup lookup)
From source file:com.manydesigns.portofino.servlets.PortofinoListener.java
public void setupCommonsConfiguration() { logger.debug("Setting up commons-configuration lookups..."); BeanLookup serverInfoLookup = new BeanLookup(serverInfo); ConfigurationInterpolator.registerGlobalLookup("serverInfo", serverInfoLookup); }
From source file:org.bgp4j.config.extensions.BootstrapExtensions.java
public void initConfiguration(@Observes ApplicationBootstrapEvent event) { ConfigurationInterpolator.registerGlobalLookup("ipv4", ipv4ConverterLookup); ConfigurationInterpolator.registerGlobalLookup("IPv4", ipv4ConverterLookup); }
From source file:org.jboss.datavirt.commons.config.ConfigurationFactory.java
/** * Registers global lookups for overlord configuration. This allows custom * property interpolation to take place. *//* w w w . j a v a 2 s. com*/ private synchronized static void registerGlobalLookups() { if (!globalLookupsRegistered) { ConfigurationInterpolator.registerGlobalLookup("vault", new VaultLookup()); globalLookupsRegistered = true; } }
From source file:org.mobicents.servlet.sip.restcomm.Bootstrapper.java
public static void bootstrap(final ServletConfig config) throws BootstrapException { final ServletContext context = config.getServletContext(); final String path = context.getRealPath("WEB-INF/conf/vnxivr.xml"); LOGGER.info("loading configuration file located at " + path); // Initialize the configuration interpolator. final ConfigurationStringLookup strings = new ConfigurationStringLookup(); strings.addProperty("home", getRestCommPath(config)); strings.addProperty("uri", getRestCommUri(config)); ConfigurationInterpolator.registerGlobalLookup("vnxivr", strings); // Load the vnxivr configuration. XMLConfiguration configuration = null; try {/*from www .j ava 2s . c o m*/ configuration = new XMLConfiguration(path); } catch (final ConfigurationException exception) { LOGGER.error("The VNXIVR environment could not be bootstrapped.", exception); throw new BootstrapException(exception); } // Register the services with the service locator. final ServiceLocator services = ServiceLocator.getInstance(); try { final Configuration runtimeConfiguration = configuration.subset("runtime-settings"); runtimeConfiguration.setProperty("home-directory", getRestCommPath(config)); runtimeConfiguration.setProperty("root-uri", getRestCommUri(config)); services.set(Configuration.class, runtimeConfiguration); final MgcpServerManager serverManager = getMgcpServerManager(configuration); services.set(MgcpServerManager.class, serverManager); final CallManager callManager = (CallManager) context .getAttribute("org.mobicents.servlet.sip.restcomm.callmanager.CallManager"); services.set(CallManager.class, callManager); services.set(ConferenceCenter.class, getConferenceCenter(serverManager)); services.set(SmsAggregator.class, getSmsAggregator(configuration)); } catch (final ObjectInstantiationException exception) { LOGGER.error("The VNXIVR environment could not be bootstrapped.", exception); throw new BootstrapException(exception); } }
From source file:org.overlord.commons.config.ConfigurationFactory.java
/** * Registers global lookups for overlord configuration. This allows custom * property interpolation to take place. *//* w w w.j a v a2 s . co m*/ private synchronized static void registerGlobalLookups() { if (!globalLookupsRegistered) { ConfigurationInterpolator.registerGlobalLookup("vault", new VaultLookup()); //$NON-NLS-1$ globalLookupsRegistered = true; } }
From source file:org.restcomm.sbc.Bootstrapper.java
@Override public void init(final ServletConfig config) throws ServletException { final ServletContext context = config.getServletContext(); final String path = context.getRealPath("WEB-INF/conf/sbc.xml"); // Initialize the configuration interpolator. final ConfigurationStringLookup strings = new ConfigurationStringLookup(); strings.addProperty("home", home(config)); strings.addProperty("uri", uri(config)); ConfigurationInterpolator.registerGlobalLookup("sbc", strings); // Load the RestComm configuration file. Configuration xml = null;/*w w w.j a v a2s. c o m*/ try { xml = new XMLConfiguration(path); } catch (final ConfigurationException exception) { logger.error(exception); } xml.setProperty("runtime-settings.home-directory", home(config)); xml.setProperty("runtime-settings.root-uri", uri(config)); context.setAttribute(Configuration.class.getName(), xml); // Initialize global dependencies. final ClassLoader loader = getClass().getClassLoader(); // Create the actor system. //final Config settings = ConfigFactory.load(); ConfigFactory.load(); // Create the storage system. DaoManager storage = null; try { storage = storage(xml, loader); } catch (final ObjectInstantiationException exception) { throw new ServletException(exception); } context.setAttribute(DaoManager.class.getName(), storage); ShiroResources.getInstance().set(DaoManager.class, storage); ShiroResources.getInstance().set(Configuration.class, xml.subset("runtime-settings")); // Create high-level restcomm configuration RestcommConfiguration.createOnce(xml); // Initialize identityContext IdentityContext identityContext = new IdentityContext(xml); context.setAttribute(IdentityContext.class.getName(), identityContext); logger.info("Extern IP:" + xml.getString("runtime-settings.external-ip")); Version.printVersion(); }
From source file:org.sonar.server.configuration.ConfigurationFactory.java
private void allowUsingEnvironmentVariables() { ConfigurationInterpolator.registerGlobalLookup("env", new StrLookup() { @Override/*w w w. j a v a 2 s . c om*/ public String lookup(String varName) { return System.getenv(varName); } }); }
From source file:org.ssh.comm.conf.CustomConfigurationBuilder.java
/** * Registers StrLookups defined in the configuration. * // w ww .j av a2 s.c o m * @throws ConfigurationException * if an error occurs */ protected void registerConfiguredLookups() throws ConfigurationException { List<HierarchicalConfiguration> nodes = configurationsAt(KEY_CONFIGURATION_LOOKUPS); for (HierarchicalConfiguration config : nodes) { XMLBeanDeclaration decl = new XMLBeanDeclaration(config); String key = config.getString(KEY_LOOKUP_KEY); StrLookup lookup = (StrLookup) BeanHelper.createBean(decl); BeanHelper.setProperty(lookup, "configuration", this); ConfigurationInterpolator.registerGlobalLookup(key, lookup); this.getInterpolator().registerLookup(key, lookup); } }