当前位置: 首页>>代码示例>>Java>>正文


Java ConfigContext.getCurrentContextConfig方法代码示例

本文整理汇总了Java中org.kuali.rice.core.api.config.property.ConfigContext.getCurrentContextConfig方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigContext.getCurrentContextConfig方法的具体用法?Java ConfigContext.getCurrentContextConfig怎么用?Java ConfigContext.getCurrentContextConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.core.api.config.property.ConfigContext的用法示例。


在下文中一共展示了ConfigContext.getCurrentContextConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
private synchronized void init() {
    if (initted) {
        return;
    }
    
    LOG.debug("Initializing BootstrapListener...");
    
    Config cfg = ConfigContext.getCurrentContextConfig();
    
    @SuppressWarnings({ "unchecked", "rawtypes" })
    final Map<String, String> properties = new HashMap<String, String>((Map) cfg.getProperties());
    
    for (Map.Entry<String, String> entry : properties.entrySet()) {
        String key = entry.getKey().toString();
        if (key.startsWith(LISTENER_PREFIX) && key.endsWith(CLASS_SUFFIX)) {
            String name = key.substring(LISTENER_PREFIX.length(), key.length() - CLASS_SUFFIX.length());
            String value = entry.getValue();
            addListener(name, value);
        }
    }

    initted = true;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:BootstrapListener.java

示例2: getIpNumber

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
public static synchronized String getIpNumber() {
    if ( instanceIpAddress == null ) {
        // protect from running upon startup
        if ( ConfigContext.getCurrentContextConfig() != null ) {
            // attempt to load from environment
            String ip = System.getProperty("host.ip");
            if ( StringUtils.isBlank(ip) ) {
                ip = ConfigContext.getCurrentContextConfig().getProperty("host.ip");
            }
            // if not set at all just return
            if ( StringUtils.isBlank(ip) ) {                    
                return getCurrentEnvironmentNetworkIp();
            } else { 
                // ok - it was set in configuration or by this method, set it permanently for this instance
                instanceIpAddress = ip;
            }
        } else {
            // prior to startup, just return it
            return getCurrentEnvironmentNetworkIp();
        }
    }
    return instanceIpAddress;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:RiceUtilities.java

示例3: getHostName

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
public static synchronized String getHostName() {
       if ( instanceHostName == null ) {
           try {
               // protect from running upon startup
               if ( ConfigContext.getCurrentContextConfig() != null ) {
                   String host = System.getProperty("host.name");
                   if ( StringUtils.isBlank(host) ) {
                       host = ConfigContext.getCurrentContextConfig().getProperty("host.name");
                   }
                   // if not set at all just return
                   if ( StringUtils.isBlank(host) ) {
                       return InetAddress.getByName( getCurrentEnvironmentNetworkIp() ).getHostName();
                   } else { 
                       // ok - it was set in configuration or by this method, set it permanently for this instance
                       instanceHostName = host;
                   }
               } else {
                   // prior to startup, just return it
                   return InetAddress.getByName( getCurrentEnvironmentNetworkIp() ).getHostName();
               }
           } catch ( Exception ex ) {
               return "localhost";
           }
       }
       return instanceHostName;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:27,代码来源:RiceUtilities.java

示例4: getRootConfig

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/**
    * Gets the {@link Config} from both the current configuration and the ones in {@code loaded}, at {@code location},
    * and in the {@code servletContext}.
    *
    * @param loaded the loaded properties
    * @param location the location of additional properties
    * @param servletContext the servlet context in which to add more properties
    *
    * @return the final configuration
    */
public static Config getRootConfig(Properties loaded, String location, ServletContext servletContext) {
	// Get the Rice config object the listener created
	Config config = ConfigContext.getCurrentContextConfig();
	Preconditions.checkNotNull(config, "'config' cannot be null");
	Properties listenerProperties = getProperties(config);

	// Parse config from the location indicated, using listener properties in the process of doing so
	JAXBConfigImpl parsed = parseConfig(location, listenerProperties);

	// Add and override loaded properties with parsed properties
	addAndOverride(loaded, parsed.getRawProperties());

	// Priority is servlet -> env -> system
	// Override anything we've loaded with servlet, env, and system properties
	Properties servlet = PropertySources.convert(servletContext);
	Properties global = PropertyUtils.getGlobalProperties(servlet);
	addAndOverride(loaded, global);
	logger.info("Using {} distinct properties", Integer.valueOf(loaded.size()));

	// Use JAXBConfigImpl in order to perform Rice's custom placeholder resolution logic now that everything is loaded
	return new JAXBConfigImpl(loaded);

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:34,代码来源:RiceConfigUtils.java

示例5: isSerializationCheckEnabled

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/**
 * Determines whether we are running in a production environment.  Factored out for testability.
 */
private Boolean isSerializationCheckEnabled() {
    if (serializationCheckEnabled == null) {
        Config c = ConfigContext.getCurrentContextConfig();
        serializationCheckEnabled = c != null && c.getBooleanProperty(ENABLE_SERIALIZATION_CHECK);
    }
    return serializationCheckEnabled;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:NonSerializableSessionListener.java

示例6: getMinThreads

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/**
 * Gets the minimum number of lifecycle worker threads to maintain.
 * 
 * <p>
 * This value is controlled by the configuration parameter
 * &quot;krad.uif.lifecycle.asynchronous.minThreads&quot;.
 * </p>
 * 
 * @return minimum number of worker threads to maintain
 */
public static int getMinThreads() {
    if (minThreads == null) {
        String propStr = null;
        if (ConfigContext.getCurrentContextConfig() != null) {
            propStr = ConfigContext.getCurrentContextConfig().getProperty(
                    KRADConstants.ConfigParameters.KRAD_VIEW_LIFECYCLE_MINTHREADS);
        }

        minThreads = propStr == null ? 4 : Integer.parseInt(propStr);
    }

    return minThreads;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:AsynchronousViewLifecycleProcessor.java

示例7: getMaxThreads

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/**
 * Gets the maximum number of lifecycle worker threads to maintain.
 * 
 * <p>
 * This value is controlled by the configuration parameter
 * &quot;krad.uif.lifecycle.asynchronous.maxThreads&quot;.
 * </p>
 * 
 * @return maximum number of worker threads to maintain
 */
public static int getMaxThreads() {
    if (maxThreads == null) {
        String propStr = null;
        if (ConfigContext.getCurrentContextConfig() != null) {
            propStr = ConfigContext.getCurrentContextConfig().getProperty(
                    KRADConstants.ConfigParameters.KRAD_VIEW_LIFECYCLE_MAXTHREADS);
        }

        maxThreads = propStr == null ? 48 : Integer.parseInt(propStr);
    }

    return maxThreads;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:AsynchronousViewLifecycleProcessor.java

示例8: getTimeout

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/**
 * Gets the time, in milliseconds, to wait for a initial phase to process.
 * 
 * <p>
 * This value is controlled by the configuration parameter
 * &quot;krad.uif.lifecycle.asynchronous.timeout&quot;.
 * </p>
 * 
 * @return time in milliseconds to wait for the initial phase to process
 */
public static long getTimeout() {
    if (timeout == null) {
        String propStr = null;
        if (ConfigContext.getCurrentContextConfig() != null) {
            propStr = ConfigContext.getCurrentContextConfig().getProperty(
                    KRADConstants.ConfigParameters.KRAD_VIEW_LIFECYCLE_TIMEOUT);
        }

        timeout = propStr == null ? 30000 : Long.parseLong(propStr);
    }

    return timeout;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:AsynchronousViewLifecycleProcessor.java

示例9: setUp

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();
    Config c = ConfigContext.getCurrentContextConfig();
    c.putProperty(Config.APPLICATION_NAME, "ServiceCallVersioningTest");
    c.putProperty(Config.APPLICATION_VERSION, "99.99-SNAPSHOT");
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:ServiceCallVersioningTest.java

示例10: testSigning

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/**
	 * This method tests the existing rice keystore file
	 * 
	 * @throws Exception
	 */
	@Test public void testSigning() throws Exception {
		
		Config config = ConfigContext.getCurrentContextConfig();
//		config.parseConfig(); 
//		
		Signature rsa = Signature.getInstance("SHA1withRSA");
		String keystoreLocation = config.getKeystoreFile();
		String keystoreAlias = config.getKeystoreAlias();
		String keystorePassword = config.getKeystorePassword();
        KeyStore keystore = KeyStore.getInstance("JKS");
        keystore.load(new FileInputStream(keystoreLocation), keystorePassword.toCharArray());
		PrivateKey privateKey = (PrivateKey)keystore.getKey(keystoreAlias, keystorePassword.toCharArray());
        
		rsa.initSign(privateKey);
		
		String imLovinIt = "Ba-da-ba-ba-baa, I'm lovin' it!";
		rsa.update(imLovinIt.getBytes());
		
		byte[] sigToVerify = rsa.sign();
		
		
		PublicKey publicKey = keystore.getCertificate(keystoreAlias).getPublicKey();
	    Signature verifySig = Signature.getInstance("SHA1withRSA");
	    verifySig.initVerify(publicKey);
	    verifySig.update(imLovinIt.getBytes());
	    boolean verifies = verifySig.verify(sigToVerify);
	    System.out.println("signature verifies: " + verifies);
		
	}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:DigitalSignatureTest.java

示例11: initialize

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/** 
 * inits the root config or merges this config with the root config.
 * 
 * <p>
 * This logic used to happen in the RiceConfigurer but was moved to facilitate the modularity work.
 * </p>
 */
public static void initialize(org.kuali.rice.core.api.config.property.Config config) {
	final org.kuali.rice.core.api.config.property.Config rootConfig = ConfigContext.getCurrentContextConfig();
	if (rootConfig == null) {
		ConfigContext.init(config);
	} else {
		rootConfig.putConfig(config);
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:ConfigInitializer.java

示例12: createDataSourceInstance

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
private DataSource createDataSourceInstance() throws Exception {
    final DataSource dataSource;Config config = ConfigContext.getCurrentContextConfig();
    dataSource = createDataSource(config);
    if (dataSource == null && !isNullAllowed()) {
        throw new ConfigurationException("Failed to configure the Primary Data Source.");
    }
    return dataSource;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:PrimaryDataSourceFactoryBean.java

示例13: getObject

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
@Override
public TransactionManager getObject() throws Exception {
    if (ConfigContext.getCurrentContextConfig() != null &&
            ConfigContext.getCurrentContextConfig().getObject(RiceConstants.SPRING_TRANSACTION_MANAGER) != null) {
        return null;
    }
    return (TransactionManager) Proxy.newProxyInstance(getClass().getClassLoader(),
            new Class<?>[]{getObjectType()},
            new LazyInitializationHandler());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:TransactionManagerFactoryBean.java

示例14: productionEnvironmentDetected

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/**
 * Determines whether we are running in a production environment.  Factored out for testability.
 */
private static boolean productionEnvironmentDetected() {
    Config c = ConfigContext.getCurrentContextConfig();
    return c != null && c.isProductionEnvironment();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:NonSerializableSessionListener.java

示例15: getCustomizedIncrementer

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/**
 * Checks the config file for any references to
 * {@code rice.krad.data.platform.incrementer.(DATASOURCE, ex mysql, oracle).(VERSION optional)}.
 *
 * <p>If matching one found attempts to instantiate it to return back to factory for use.</p>
 *
 * @param platformInfo the {@link DatabasePlatformInfo}.
 * @param dataSource the {@link DataSource} for which to retrieve the incrementer.
 * @param incrementerName the name of the incrementer.
 * @param columnName the name of the column to increment.
 * @return a config set customized incrementer that matches and can be used to generate the next incremented value
 *         for the given incrementer against the specified {@link DataSource}
 * @throws InstantiationError if cannot instantiate passed in class.
 */
private static DataFieldMaxValueIncrementer getCustomizedIncrementer(DatabasePlatformInfo platformInfo, DataSource dataSource, String incrementerName, String columnName){
    if(platformInfo == null){
        throw new  IllegalArgumentException("DataSource platform must not be null");
    }
    if(ConfigContext.getCurrentContextConfig() == null){
        return null;
    }
    Map<String,String> incrementerPropToIncrementer = ConfigContext.getCurrentContextConfig().
                            getPropertiesWithPrefix(PLATFORM_INCREMENTER_PREFIX, true);
    String platformNameVersion = platformInfo.getName().toLowerCase() + "." + platformInfo.getMajorVersion();
    String incrementerClassName = "";

     if(incrementerPropToIncrementer.containsKey(platformNameVersion)){
        incrementerClassName = incrementerPropToIncrementer.get(platformNameVersion);
     } else if(incrementerPropToIncrementer.containsKey(platformInfo.getName().toLowerCase())){
         incrementerClassName = incrementerPropToIncrementer.get(platformInfo.getName().toLowerCase());
     }

    if(StringUtils.isNotBlank(incrementerClassName)){
        try {
            Class incrementerClass = Class.forName(incrementerClassName);
            if(AbstractSequenceMaxValueIncrementer.class.isAssignableFrom(incrementerClass)){
                AbstractSequenceMaxValueIncrementer abstractSequenceMaxValueIncrementer = (AbstractSequenceMaxValueIncrementer)incrementerClass.newInstance();
                abstractSequenceMaxValueIncrementer.setDataSource(dataSource);
                abstractSequenceMaxValueIncrementer.setIncrementerName(incrementerName);
                return abstractSequenceMaxValueIncrementer;

            } else if(AbstractColumnMaxValueIncrementer.class.isAssignableFrom(incrementerClass)){
                AbstractColumnMaxValueIncrementer abstractColumnMaxValueIncrementer = (AbstractColumnMaxValueIncrementer)incrementerClass.newInstance();
                abstractColumnMaxValueIncrementer.setDataSource(dataSource);
                abstractColumnMaxValueIncrementer.setIncrementerName(incrementerName);
                abstractColumnMaxValueIncrementer.setColumnName(columnName);
                return abstractColumnMaxValueIncrementer;
            } else {
                throw new InstantiationError("Cannot create incrementer class "+incrementerClassName +" it has to extend "
                        + "AbstractSequenceMaxValueIncrementer or AbstractColumnMaxValueIncrementer");
            }
        } catch (Exception e){
            throw new InstantiationError("Could not instantiate custom incrementer "+incrementerClassName);
        }
    }
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:58,代码来源:MaxValueIncrementerFactory.java


注:本文中的org.kuali.rice.core.api.config.property.ConfigContext.getCurrentContextConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。