• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConfigContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ConfigContext类属于org.kuali.rice.core.api.config.property包,在下文中一共展示了ConfigContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: submit

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=submit")
public ModelAndView submit(@ModelAttribute("KualiForm") DummyLoginForm uifForm, BindingResult result,
        HttpServletRequest request, HttpServletResponse response) {
    String returnUrl = decode(uifForm.getReturnLocation());
    if (StringUtils.isBlank(returnUrl)) {
        returnUrl = ConfigContext.getCurrentContextConfig().getProperty(KRADConstants.APPLICATION_URL_KEY);
    }

    Properties props = new Properties();
    String user = uifForm.getLogin_user();
    if (StringUtils.isNotBlank(user)) {
        props.put("__login_user", user);
    }

    String password = uifForm.getLogin_pw();
    if (StringUtils.isNotBlank(password)) {
        props.put("__login_pw", password);
    }

    return performRedirect(uifForm, returnUrl, props);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:DummyLoginController.java


示例3: 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


示例4: createKSBResourceLoaderNoApplicationIdImpl

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
protected void createKSBResourceLoaderNoApplicationIdImpl(String configType) throws Exception {
	
	Properties props = new Properties();
	Config config = getConfigObject(configType,props);
	config.parseConfig();
	ConfigContext.init(config);
	
	boolean errorThrown = false;
	try {
		KSBResourceLoaderFactory.createRootKSBRemoteResourceLoader();
		fail("should have thrown configuration exception with no applicationId present");
	} catch (IllegalStateException ce) {
		errorThrown = true;
	}
	assertTrue(errorThrown);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:KSBResourceLoaderFactoryTest.java


示例5: configureJta

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
/**
 * If the user injected JTA classes into this configurer, verify that both the
 * UserTransaction and TransactionManager are set and then attach them to
 * the configuration.
 */
protected void configureJta() {
    if (this.userTransaction != null) {
        ConfigContext.getCurrentContextConfig().putObject(RiceConstants.USER_TRANSACTION_OBJ, this.userTransaction);
    }
    if (this.transactionManager != null) {
        ConfigContext.getCurrentContextConfig().putObject(RiceConstants.TRANSACTION_MANAGER_OBJ, this.transactionManager);
    }
    boolean userTransactionConfigured = this.userTransaction != null || !StringUtils.isEmpty(ConfigContext.getCurrentContextConfig().getProperty(RiceConstants.USER_TRANSACTION_JNDI));
    boolean transactionManagerConfigured = this.transactionManager != null || !StringUtils.isEmpty(ConfigContext.getCurrentContextConfig().getProperty(RiceConstants.TRANSACTION_MANAGER_JNDI));
    if (userTransactionConfigured && !transactionManagerConfigured) {
        throw new ConfigurationException("When configuring JTA, both a UserTransaction and a TransactionManager are required.  Only the UserTransaction was configured.");
    }
    if (transactionManagerConfigured && !userTransactionConfigured) {
        throw new ConfigurationException("When configuring JTA, both a UserTransaction and a TransactionManager are required.  Only the TransactionManager was configured.");
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:CoreConfigurer.java


示例6: addDelegationRule

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
public ActionForward addDelegationRule(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
	ActionForward result = null;

    String ruleTemplateId = request.getParameter("delegationRule.ruleTemplate.id");
    String docTypeName = request.getParameter("delegationRule.documentType.name");
    List rules = getRuleService().search(docTypeName, null, ruleTemplateId, "", null, null, Boolean.FALSE, Boolean.TRUE, new HashMap(), null);
    
    if (rules.size() == 1) {
        RuleBaseValues rule = (RuleBaseValues)rules.get(0);
        String url = ConfigContext.getCurrentContextConfig().getKEWBaseURL() +
            "/DelegateRule.do?methodToCall=start" +
        	"&parentRuleId=" + rule.getId();
        result = new ActionForward(url, true);
    } else {
    	makeLookupPathParam(mapping, request);
    	result = new ActionForward(ConfigContext.getCurrentContextConfig().getKRBaseURL() + 
    			"/lookup.do?methodToCall=start&"+ stripMethodToCall(request.getQueryString()), true);
    }
    
    return result;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:RuleQuickLinksAction.java


示例7: validateConfigurerState

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
@Override
public final void validateConfigurerState() {
	if (StringUtils.isBlank(this.moduleName)) {
		throw new IllegalStateException("the module name for this module has not been set");
	}
	
	if (CollectionUtils.isEmpty(this.validRunModes)) {
		throw new IllegalStateException("the valid run modes for this module has not been set");
	}
	
	// ConfigContext must be initialized...
	if (!ConfigContext.isInitialized()) {
   		throw new ConfigurationException("ConfigContext has not yet been initialized, please initialize prior to using.");
   	}
	
	validateRunMode();
	
	doAdditonalConfigurerValidations();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:ModuleConfigurer.java


示例8: testNestedLegacyContext

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
@Test
public void testNestedLegacyContext() {
    ConfigContext.getCurrentContextConfig().putProperty(KRADConstants.Config.ENABLE_LEGACY_DATA_FRAMEWORK, "true");
    assertFalse(detector.isInLegacyContext());
    detector.beginLegacyContext();
    try {
        assertTrue(detector.isInLegacyContext());
        detector.beginLegacyContext();
        try {
            detector.beginLegacyContext();
            try {
                assertTrue(detector.isInLegacyContext());
            } finally {
                detector.endLegacyContext();
            }
            assertTrue(detector.isInLegacyContext());
        } finally {
            detector.endLegacyContext();
        }
        assertTrue(detector.isInLegacyContext());
    } finally {
        detector.endLegacyContext();
    }
    assertFalse(detector.isInLegacyContext());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:LegacyDetectorTest.java


示例9: getDisabledCachesConfig

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
private static Set<String> getDisabledCachesConfig() {
    Set<String> disabledCaches = new HashSet<String>();

    String disabledCachesParam =
            ConfigContext.getCurrentContextConfig().getProperty(DISABLED_CACHES_PARAM);

    if (!StringUtils.isBlank(disabledCachesParam)) {
        for (String cacheName : disabledCachesParam.split(",")) {
            cacheName = cacheName.trim();
            if (!StringUtils.isBlank(cacheName)) {
                disabledCaches.add(cacheName);
            }
        }
    }
    return Collections.unmodifiableSet(disabledCaches);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:DistributedCacheManagerDecorator.java


示例10: initGrl

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
@BeforeClass
public static void initGrl() throws Exception {

    MetadataRepository metadataRepository = mock(MetadataRepository.class);
    DataDictionaryService dataDictionaryService = mock(DataDictionaryService.class);
    ResourceLoader resourceLoader = mock(ResourceLoader.class);

    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, LegacyUtilsTest.class.getName());
    config.putProperty(KRADConstants.Config.ENABLE_LEGACY_DATA_FRAMEWORK, "true");
    ConfigContext.init(config);

    when(resourceLoader.getName()).thenReturn(QName.valueOf(LegacyUtilsTest.class.getName()));
    when(resourceLoader.getService(QName.valueOf("metadataRepository"))).thenReturn(metadataRepository);
    when(resourceLoader.getService(QName.valueOf("dataDictionaryService"))).thenReturn(dataDictionaryService);

    GlobalResourceLoader.addResourceLoader(resourceLoader);
    GlobalResourceLoader.start();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:LegacyUtilsTest.java


示例11: installRiceKualiModuleService

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
@Before
public void installRiceKualiModuleService() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();

    KualiModuleService riceKualiModuleService = mock(KualiModuleService.class);
    when(riceKualiModuleService.getInstalledModuleServices()).thenReturn(riceModuleServices);

    testBf.addBean(KRADServiceLocatorWeb.KUALI_MODULE_SERVICE, riceKualiModuleService);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleservicebase-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:KualiModuleServiceImplTest.java


示例12: testCustomIncrementerDatasourceNoVersion

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
@Test
public void testCustomIncrementerDatasourceNoVersion() throws Exception {
    SimpleConfig config = new SimpleConfig();
    config.putProperty("rice.krad.data.platform.incrementer.mysql",
            "org.kuali.rice.krad.data.platform.testincrementers.CustomIncrementerMySQLVersion5");
    config.putProperty("rice.krad.data.platform.incrementer.oracle",
            "org.kuali.rice.krad.data.platform.testincrementers.CustomIncrementerOracleVersion11");
    ConfigContext.init(config);

    DataFieldMaxValueIncrementer mySQLMaxVal = MaxValueIncrementerFactory.getIncrementer(mysql,"test_mySQL");
    assertTrue("Found MySQL custom incrementer",mySQLMaxVal != null);
    assertTrue("Custom incrementer for MySQL should be mySQL5 for String val",
            StringUtils.equals(mySQLMaxVal.nextStringValue(),"mySQL5"));

    DataFieldMaxValueIncrementer oracleMaxVal = MaxValueIncrementerFactory.getIncrementer(oracle,"test_oracle");
    assertTrue("Found Oracle custom incrementer", oracleMaxVal != null);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:MaxValueIncrementerFactoryTest.java


示例13: propertySource

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
@Override
@Bean
public PropertySource<?> propertySource() {
    // Combine locations making sure Rice properties go in last
    List<Location> locations = new ArrayList<Location>();
    locations.addAll(jdbcConfig.jdbcPropertyLocations());
    locations.addAll(sourceSqlConfig.riceSourceSqlPropertyLocations());
    locations.addAll(ingestXmlConfig.riceIngestXmlPropertyLocations());

    // Default behavior is load->decrypt->resolve
    // -Dproperties.resolve=false turns off placeholder resolution
    Properties properties = service.getProperties(locations);
    logger.info("Loaded {} regular properties", properties.size());

    // Combine normal properties with Rice properties using Rice's custom placeholder resolution logic to resolve everything
    Config rootCfg = RiceConfigUtils.getRootConfig(properties, KR_SAMPLE_APP_CONFIG, servletContext);

    // Make sure ConfigContext.getCurrentContextConfig() return's the rootCfg object
    ConfigContext.init(rootCfg);

    // Make Spring and Rice use the exact same source for obtaining property values
    return new ConfigPropertySource("riceConfig", rootCfg);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:SampleAppPSC.java


示例14: generateInitiatorUrl

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
protected HtmlData.AnchorHtmlData generateInitiatorUrl(String principalId) {
    HtmlData.AnchorHtmlData link = new HtmlData.AnchorHtmlData();
    if (StringUtils.isBlank(principalId) ) {
        return link;
    }
    if (isRouteLogPopup()) {
        link.setTarget("_blank");
    }
    else {
        link.setTarget("_self");
    }
    link.setDisplayText("Initiator Inquiry for User with ID:" + principalId);
    String url = ConfigContext.getCurrentContextConfig().getProperty(Config.KIM_URL) + "/" +
            "identityManagementPersonInquiry.do?principalId=" + principalId;
    link.setHref(url);
    return link;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:DocumentSearchCriteriaBoLookupableHelperService.java


示例15: PersistenceServiceStructureImplBase

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
/**
 * Constructs a PersistenceServiceImpl instance.
 */
public PersistenceServiceStructureImplBase() {
	String ojbPropertyFileLocation = ConfigContext.getCurrentContextConfig().getProperty(BaseOjbConfigurer.RICE_OJB_PROPERTIES_PARAM);
       String currentValue = System.getProperty(BaseOjbConfigurer.OJB_PROPERTIES_PROP);
	try {
		System.setProperty(BaseOjbConfigurer.OJB_PROPERTIES_PROP, ojbPropertyFileLocation);
		org.apache.ojb.broker.metadata.MetadataManager metadataManager = org.apache.ojb.broker.metadata.MetadataManager.getInstance();
		descriptorRepository = metadataManager.getGlobalRepository();
    } finally {
        if (currentValue == null) {
            System.getProperties().remove(BaseOjbConfigurer.OJB_PROPERTIES_PROP);
        } else {
            System.setProperty(BaseOjbConfigurer.OJB_PROPERTIES_PROP, currentValue);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:PersistenceServiceStructureImplBase.java


示例16: createSoapServiceDefinition

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
/**
 * Creates a {@link org.kuali.rice.ksb.api.bus.support.SoapServiceDefinition} based on the properties set on this
 * exporter.  Subclasses may override this method in order to customize how the SOAP service definition is created.
 *
 * @return the SoapServiceDefinition to be exported
 */
protected SoapServiceDefinition createSoapServiceDefinition() {
    SoapServiceDefinition serviceDefinition = new SoapServiceDefinition();

    // configured setup
    serviceDefinition.setLocalServiceName(getLocalServiceName());
    serviceDefinition.setServiceNameSpaceURI(getServiceNameSpaceURI());
    serviceDefinition.setServiceName(getServiceName());

    serviceDefinition.setService(getCallbackService());
    serviceDefinition.setServicePath(getServicePath());
    serviceDefinition.setEndpointUrl(getEndpointUrl());
    serviceDefinition.setServiceInterface(getServiceInterface());

    // standard setup
    serviceDefinition.setJaxWsService(true);
    serviceDefinition.setBusSecurity(getBusSecurity());
    serviceDefinition.setServiceVersion(ConfigContext.getCurrentContextConfig().getRiceVersion());

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


示例17: save

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
public PersistedMessageBO save(PersistedMessageBO routeQueue) {
    if (Boolean.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KSBConstants.Config.MESSAGE_PERSISTENCE))) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Persisting Message " + routeQueue);
        }
        return getMessageQueueDao().save(routeQueue);
    }
    return routeQueue;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:MessageQueueServiceImpl.java


示例18: 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


示例19: getCreateNewUrl

import org.kuali.rice.core.api.config.property.ConfigContext; //导入依赖的package包/类
@Override
public String getCreateNewUrl() {
       String url = "";
       if (getLookupableHelperService().allowsMaintenanceNewOrCopyAction()) {
       	String kewBaseUrl = ConfigContext.getCurrentContextConfig().getKEWBaseURL();
           url = "<a title=\"Create a new record\" href=\""+kewBaseUrl+"/DelegateRule.do\"><img src=\"images/tinybutton-createnew.gif\" alt=\"create new\" width=\"70\" height=\"15\"/></a>";
       }
       return url;
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:RuleDelegationLookupableImpl.java


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LightColors类代码示例发布时间:2022-05-22
下一篇:
Java RoundedTransformationBuilder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap