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


Java ServiceUtils类代码示例

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


ServiceUtils类属于org.apache.deltaspike.core.util包,在下文中一共展示了ServiceUtils类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lookup

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
/**
 * Looks up a unique service implementation.
 *
 * @return ProxyClassGenerator service
 */
public static DeltaSpikeProxyClassGenerator lookup()
{
    if (generator == null)
    {
        List<DeltaSpikeProxyClassGenerator> proxyClassGeneratorList =
                ServiceUtils.loadServiceImplementations(DeltaSpikeProxyClassGenerator.class);

        if (proxyClassGeneratorList.size() != 1)
        {
            throw new IllegalStateException(proxyClassGeneratorList.size()
                + " implementations of " + DeltaSpikeProxyClassGenerator.class.getName()
                + " found. Expected exactly one implementation.");
        }

        generator = proxyClassGeneratorList.get(0);
    }

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

示例2: initScheduler

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
private void initScheduler(AfterBeanDiscovery afterBeanDiscovery)
{
    List<Scheduler> availableSchedulers = ServiceUtils.loadServiceImplementations(Scheduler.class, true);

    this.scheduler = findScheduler(availableSchedulers, this.jobClass);

    if (this.scheduler != null)
    {
        try
        {
            this.scheduler.start();
        }
        catch (Throwable t)
        {
            afterBeanDiscovery.addDefinitionError(t);
        }
    }
    else if (!this.foundManagedJobClasses.isEmpty())
    {
        LOG.warning(
            this.foundManagedJobClasses.size() + " scheduling-jobs found, but there is no configured scheduler");
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:24,代码来源:SchedulerExtension.java

示例3: resolveConfigSources

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
private static List<ConfigSource> resolveConfigSources()
{
    List<ConfigSource> appConfigSources = ServiceUtils.loadServiceImplementations(ConfigSource.class);

    List<ConfigSourceProvider> configSourceProviderServiceLoader =
        ServiceUtils.loadServiceImplementations(ConfigSourceProvider.class);

    for (ConfigSourceProvider configSourceProvider : configSourceProviderServiceLoader)
    {
        appConfigSources.addAll(configSourceProvider.getConfigSources());
    }

    List<? extends ConfigFilter> configFilters = ServiceUtils.loadServiceImplementations(ConfigFilter.class);
    for (ConfigFilter configFilter : configFilters)
    {
        addConfigFilter(configFilter);
    }

    return appConfigSources;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:21,代码来源:ConfigResolver.java

示例4: processConfigurationValidation

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
protected void processConfigurationValidation(AfterDeploymentValidation adv)
{
    for (ConfigValidator configValidator : ServiceUtils.loadServiceImplementations(ConfigValidator.class))
    {
        Set<String> violations = configValidator.processValidation();

        if (violations == null)
        {
            continue;
        }

        for (String violation : violations)
        {
            adv.addDeploymentProblem(new IllegalStateException(violation));
        }
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:18,代码来源:ConfigurationExtension.java

示例5: lookupOfSpiImplementations

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
@Test
public void lookupOfSpiImplementations()
{
    //exclude it due to an issue with the arquillian-adapter for owb 1.1.x and 1.2.0
    Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_OWB_1_1_x) &&
            !CdiContainerUnderTest.is(CONTAINER_OWB_1_2_0));

    Assert.assertTrue(ServiceUtils.loadServiceImplementations(MyInterface.class).iterator().hasNext());

    Assert.assertNotNull(ServiceUtils.loadServiceImplementations(MyInterface.class));
    Assert.assertFalse(ServiceUtils.loadServiceImplementations(MyInterface.class).isEmpty());
    Assert.assertEquals(1, ServiceUtils.loadServiceImplementations(MyInterface.class).size());

    Assert.assertEquals(
        "test", ServiceUtils.loadServiceImplementations(MyInterface.class).iterator().next().getValue());
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:17,代码来源:ServiceUtilsTest.java

示例6: registerPropertyFileConfigs

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
/**
 * Load all {@link PropertyFileConfig}s which are registered via
 * {@code java.util.ServiceLoader}.
 */
private void registerPropertyFileConfigs() {
	List<? extends PropertyFileConfig> propertyFileConfigs = ServiceUtils
			.loadServiceImplementations(PropertyFileConfig.class);
	for (PropertyFileConfig propertyFileConfig : propertyFileConfigs) {
		EnvironmentPropertyConfigSourceProvider environmentPropertyConfigSourceProvider = new EnvironmentPropertyConfigSourceProvider(
				propertyFileConfig.getPropertyFileName(), propertyFileConfig.isOptional());

		configSources.addAll(environmentPropertyConfigSourceProvider.getConfigSources());
	}
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:15,代码来源:GeneratorConfigSourceProvider.java

示例7: CdiTestRunner

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
public CdiTestRunner(Class<?> testClass) throws InitializationError
{
    super(testClass);

    TestControl testControl = testClass.getAnnotation(TestControl.class);
    this.testContext = new ContainerAwareTestContext(testControl, null);

    //benefits from the fallback-handling in ContainerAwareTestContext
    Class<? extends Handler> logHandlerClass = this.testContext.getLogHandlerClass();

    if (!Handler.class.equals(logHandlerClass))
    {
        try
        {
            LOGGER.addHandler(logHandlerClass.newInstance());
        }
        catch (Exception e)
        {
            throw ExceptionUtils.throwAsRuntimeException(e);
        }
    }

    this.statementDecoratorFactories = ServiceUtils.loadServiceImplementations(TestStatementDecoratorFactory.class);
    Collections.sort(this.statementDecoratorFactories, new Comparator<TestStatementDecoratorFactory>()
    {
        @Override
        public int compare(TestStatementDecoratorFactory f1, TestStatementDecoratorFactory f2)
        {
            return f1.getOrdinal() > f2.getOrdinal() ? 1 : -1;
        }
    });
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:33,代码来源:CdiTestRunner.java

示例8: registerPropertyFileConfigs

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
/**
 * Load all {@link PropertyFileConfig}s which are registered via
 * {@code java.util.ServiceLoader}.
 */
private void registerPropertyFileConfigs()
{
    List<? extends PropertyFileConfig> propertyFileConfigs =
            ServiceUtils.loadServiceImplementations(PropertyFileConfig.class);
    for (PropertyFileConfig propertyFileConfig : propertyFileConfigs)
    {
        EnvironmentPropertyConfigSourceProvider environmentPropertyConfigSourceProvider
            = new EnvironmentPropertyConfigSourceProvider(propertyFileConfig.getPropertyFileName(),
                propertyFileConfig.isOptional());

        configSources.addAll(environmentPropertyConfigSourceProvider.getConfigSources());
    }
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:18,代码来源:DefaultConfigSourceProvider.java

示例9: startScopes

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
private void startScopes(CdiContainer container,
                         Class testClass,
                         Method testMethod,
                         Class<? extends Annotation>... restrictedScopes) {

    ContextControl contextControl = container.getContextControl();

    List<Class<? extends Annotation>> scopeClasses = new ArrayList<Class<? extends Annotation>>();

    Collections.addAll(scopeClasses, this.testControl.startScopes());

    if (scopeClasses.isEmpty()) {
        addScopesForDefaultBehavior(scopeClasses);
    } else {
        List<TestControlValidator> testControlValidatorList =
                ServiceUtils.loadServiceImplementations(TestControlValidator.class);

        for (TestControlValidator testControlValidator : testControlValidatorList) {
            if (testControlValidator instanceof TestAware) {
                if (testMethod != null) {
                    ((TestAware) testControlValidator).setTestMethod(testMethod);
                }
                ((TestAware) testControlValidator).setTestClass(testClass);
            }
            try {
                testControlValidator.validate(this.testControl);
            } finally {
                if (testControlValidator instanceof TestAware) {
                    ((TestAware) testControlValidator).setTestClass(null);
                    ((TestAware) testControlValidator).setTestMethod(null);
                }
            }
        }
    }

    for (Class<? extends Annotation> scopeAnnotation : scopeClasses) {
        if (this.parent != null && this.parent.isScopeStarted(scopeAnnotation)) {
            continue;
        }

        if (isRestrictedScope(scopeAnnotation, restrictedScopes)) {
            continue;
        }

        try {
            //force a clean context - TODO discuss onScopeStopped call
            contextControl.stopContext(scopeAnnotation);

            contextControl.startContext(scopeAnnotation);
            this.startedScopes.add(scopeAnnotation);

            onScopeStarted(scopeAnnotation);
        } catch (RuntimeException e) {
            Logger logger = Logger.getLogger(CdiCucumberTestRunner.class.getName());
            logger.setLevel(Level.SEVERE);
            logger.log(Level.SEVERE, "failed to start scope @" + scopeAnnotation.getName(), e);
        }
    }

}
 
开发者ID:database-rider,项目名称:database-rider,代码行数:61,代码来源:CdiCucumberTestRunner.java

示例10: init

import org.apache.deltaspike.core.util.ServiceUtils; //导入依赖的package包/类
protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
{
    isActivated = ClassDeactivationUtils.isActivated(getClass());
    mockFilters = ServiceUtils.loadServiceImplementations(MockFilter.class);
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:6,代码来源:MockExtension.java


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