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


Java ConfigResolver.getPropertyValue方法代码示例

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


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

示例1: setServletConfig

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
private void setServletConfig(ServletConfigSource configSource, ServletContextEvent sce)
{
    ServletContext servletContext = sce.getServletContext();
    String servletContextName = servletContext.getServletContextName();
    if (servletContextName != null && servletContextName.length() > 0)
    {
        String oldAppName = ConfigResolver.getPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG);

        // we first need to unregister the old MBean
        // as we don't know whether the CDI Extension or the Servlet Listener comes first.
        // It's simply not defined by the spec :/
        ConfigurationExtension.unRegisterConfigMBean(oldAppName);

        configSource.setPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG, servletContextName);

        // and as we now did set the new name -> register again:
        ConfigurationExtension.registerConfigMBean();
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:20,代码来源:ServletConfigListener.java

示例2: resolveProjectStage

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
/**
 * Resolves the project-stage configured for DeltaSpike
 * @return the resolved {@link ProjectStage} or <code>null</code> if none defined.
 */
protected ProjectStage resolveProjectStage()
{
    for (String configLocation : CONFIG_SETTING_KEYS)
    {
        String stageName = ConfigResolver.getPropertyValue(configLocation);

        if (stageName != null && !stageName.isEmpty())
        {
            return ProjectStage.valueOf(stageName);
        }

    }

    return null;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:20,代码来源:ProjectStageProducer.java

示例3: isActivated

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
@Override
public Boolean isActivated(Class<? extends Deactivatable> targetClass)
{
    final String key = KEY_PREFIX + targetClass.getName();
    final String value = ConfigResolver.getPropertyValue(key);
    if (value == null)
    {
        return null;
    }
    else
    {
        if (LOG.isLoggable(Level.FINE))
        {
            LOG.log(Level.FINE, "Deactivation setting for {0} found to be {1} based on configuration.",
                    new Object[]{key, value});
        }
        return !Boolean.valueOf(value);
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:20,代码来源:DefaultClassDeactivator.java

示例4: getDescription

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
private String getDescription(final String description, String defaultDescription)
{
    if (description.isEmpty())
    {
        return defaultDescription;
    }

    String descriptionValue = description.trim();

    if (descriptionValue.startsWith("{") && descriptionValue.endsWith("}"))
    {
        return ConfigResolver.getPropertyValue(
            descriptionValue.substring(1, descriptionValue.length() - 1), defaultDescription);
    }
    return description;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:17,代码来源:DynamicMBeanWrapper.java

示例5: registerConfigMBean

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
public static void registerConfigMBean()
{
    String appName = ConfigResolver.getPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG);
    if (appName != null && appName.length() > 0)
    {
        try
        {
            MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();

            ClassLoader tccl = ClassUtils.getClassLoader(ConfigurationExtension.class);
            DeltaSpikeConfigInfo cfgMBean = new DeltaSpikeConfigInfo(tccl);

            ObjectName name = new ObjectName("deltaspike.config." + appName + ":type=DeltaSpikeConfig");
            mBeanServer.registerMBean(cfgMBean, name);
        }
        catch (InstanceAlreadyExistsException iae)
        {
            // all fine, the CfgBean got already registered.
            // Most probably by the ServletConfigListener
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:27,代码来源:ConfigurationExtension.java

示例6: testConfigViaSystemProperty

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
@Test
public void testConfigViaSystemProperty()
{
    String key = "testProperty01";
    String value = "test_value_01";

    // the value is not yet configured
    String configuredValue = ConfigResolver.getPropertyValue(key);
    Assert.assertNull(configuredValue);

    String myDefaultValue = "theDefaultValueDummy";
    configuredValue = ConfigResolver.getPropertyValue(key, myDefaultValue);
    Assert.assertEquals(myDefaultValue, configuredValue);

    // now we set a value for the config key
    System.setProperty(key, value);
    configuredValue = ConfigResolver.getPropertyValue(key);
    Assert.assertEquals(value, configuredValue);

    System.setProperty(key, "");
    configuredValue = ConfigResolver.getPropertyValue(key);
    Assert.assertEquals("", configuredValue);

}
 
开发者ID:apache,项目名称:deltaspike,代码行数:25,代码来源:ConfigSourceTest.java

示例7: testOverruledValue

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
@Test
public void testOverruledValue()
{
    String result = ConfigResolver.getPropertyValue("test");

    Assert.assertEquals("test2", result);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:8,代码来源:ConfigResolverTest.java

示例8: testConfigVariableRecursiveDeclaration

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
@Test
public void testConfigVariableRecursiveDeclaration()
{
    String url = ConfigResolver.getPropertyValue("deltaspike.test.recursive.variable1", "", true);
    Assert.assertEquals("pre-crazy-post/ohgosh/crazy", url);

    ConfigResolver.TypedResolver<String> tr = ConfigResolver.resolve("deltaspike.test.recursive.variable1")
        .evaluateVariables(true).logChanges(true);
    Assert.assertEquals("pre-crazy-post/ohgosh/crazy", tr.getValue());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:11,代码来源:ConfigResolverTest.java

示例9: init

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
public void init()
{
    Set<String> ruleConfigKeys = new HashSet<String>();

    // first we collect all the rule property names
    for (String propertyName : ConfigResolver.getAllProperties().keySet())
    {
        if (propertyName.startsWith(CoreBaseConfig.InterDynCustomization.INTERDYN_RULE_PREFIX) &&
            propertyName.contains(".match"))
        {
            ruleConfigKeys.add(propertyName.substring(0, propertyName.indexOf(".match")));
        }
    }

    for (String ruleConfigKey : ruleConfigKeys)
    {
        String match = ConfigResolver.getPropertyValue(ruleConfigKey + ".match");
        String annotationClassName = ConfigResolver.getPropertyValue(ruleConfigKey + ".annotation");

        if (match != null && annotationClassName != null &&
            match.length() > 0 && annotationClassName.length() > 0)
        {
            Annotation anno = getAnnotationImplementation(annotationClassName);
            interceptorRules.add(new AnnotationRule(match, anno));
        }
    }


    if (interceptorRules.isEmpty())
    {
        enabled = false;
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:34,代码来源:InterDynExtension.java

示例10: getConfigurableAttribute

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
private String getConfigurableAttribute(final String annotationAttributeValue, final String defaultValue)
{
    String val = annotationAttributeValue.trim();
    if (val.startsWith("{") && val.endsWith("}"))
    {
        val = ConfigResolver.getPropertyValue(val.substring(1, val.length() - 1), defaultValue);
    }
    return val == null || val.isEmpty() ? defaultValue : val;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:10,代码来源:MBeanExtension.java

示例11: freeConfigSources

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
/**
 * This method triggers freeing of the ConfigSources.
 */
@SuppressWarnings("UnusedDeclaration")
public void freeConfigSources(@Observes BeforeShutdown bs)
{
    String appName = ConfigResolver.getPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG);
    unRegisterConfigMBean(appName);

    ConfigResolver.freeConfigSources();
    detectedParentPropertyFileConfigs.remove(ClassUtils.getClassLoader(null));
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:13,代码来源:ConfigurationExtension.java

示例12: testCustomPropertyConfigSources

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
@Test
public void testCustomPropertyConfigSources() throws Exception
{
    Assert.assertTrue(
            Thread.currentThread().getContextClassLoader().getResources(CONFIG_FILE_NAME).hasMoreElements());

    String value = ConfigResolver.getPropertyValue("some.propertykey");
    Assert.assertNotNull(value);
    Assert.assertEquals("somevalue", value);

    String bootTimeValue = ConfigResolver.getPropertyValue("some.boottimekey");
    Assert.assertNotNull(bootTimeValue);
    Assert.assertEquals("correctvalue", bootTimeValue);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:15,代码来源:PropertyConfigSourceTest.java

示例13: testConfigViaClasspathPropertyFile

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
@Test
public void testConfigViaClasspathPropertyFile()
{
    String key = "testProperty02";
    String value = "test_value_02";

    String configuredValue = ConfigResolver.getPropertyValue(key);
    Assert.assertEquals(value, configuredValue);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:10,代码来源:ConfigSourceTest.java

示例14: testConfigUninitializedDefaultValue

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
@Test
public void testConfigUninitializedDefaultValue()
{
    String key = "nonexistingProperty01";

    // passing in null as default value should work fine
    String configuredValue = ConfigResolver.getPropertyValue(key, null);
    Assert.assertNull(configuredValue);

    String myDefaultValue = "theDefaultValueDummy";
    configuredValue = ConfigResolver.getPropertyValue(key, myDefaultValue);
    Assert.assertEquals(myDefaultValue, configuredValue);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:14,代码来源:ConfigSourceTest.java

示例15: testConfigViaMetaInfPropertyFile

import org.apache.deltaspike.core.api.config.ConfigResolver; //导入方法依赖的package包/类
@Test
public void testConfigViaMetaInfPropertyFile()
{
    String key = "testProperty03";
    String value = "test_value_03";

    String configuredValue = ConfigResolver.getPropertyValue(key);
    Assert.assertEquals(value, configuredValue);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:10,代码来源:ConfigSourceTest.java


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