本文整理汇总了Java中org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReferences方法的典型用法代码示例。如果您正苦于以下问题:Java BeanProvider.getContextualReferences方法的具体用法?Java BeanProvider.getContextualReferences怎么用?Java BeanProvider.getContextualReferences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.deltaspike.core.api.provider.BeanProvider
的用法示例。
在下文中一共展示了BeanProvider.getContextualReferences方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readPatternsFromCode
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
private Map<String, String> readPatternsFromCode() {
Map<String, String> result = new HashMap<>();
List<ProgrammaticURLProtectionProvider> urlProtectionProviders = BeanProvider.getContextualReferences(ProgrammaticURLProtectionProvider.class, true);
for (ProgrammaticURLProtectionProvider urlProtectionProvider : urlProtectionProviders) {
result.putAll(urlProtectionProvider.getURLEntriesToAdd());
}
return result;
}
示例2: onSuccessfulLogin
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
protected void onSuccessfulLogin(AuthenticationToken token, AuthenticationInfo info, WebSubject subject) {
List<AfterSuccessfulLoginHandler> handlers = BeanProvider.getContextualReferences(AfterSuccessfulLoginHandler.class, true);
for (AfterSuccessfulLoginHandler handler : handlers) {
handler.onSuccessfulLogin(token, info, subject);
}
rememberMeSuccessfulLogin(token, info, subject); // TODO Convert the rememberMe to AfterSuccessfulLoginHandler
}
示例3: startCamel
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
private void startCamel() {
camelActivator = BeanProvider.getContextualReference(CamelActivator.class, false);
// Register a route for each tool on the class path
List<Tool> tools = BeanProvider.getContextualReferences(Tool.class, true);
camelActivator.registerRoutes(tools);
camelActivator.start();
}
示例4: dbUnitSetup
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
protected void dbUnitSetup() {
List<EntityManager> entityManagerList =
BeanProvider.getContextualReferences(EntityManager.class, true, false);
for (EntityManager entityManager : entityManagerList) {
if (entityManager.getTransaction().isActive()) {
em = entityManager;
break;
}
}
if (em == null) {
throw new IllegalStateException("Entity Manager == null");
}
Connection conn = DbConnectionProvider.unwrap(em);
if (conn == null) {
throw new IllegalStateException("Connection == null");
}
this.connection = conn;
try {
databaseTester = new JdbcConnectionDatabaseTester(connection);
databaseTester.setOperationListener(new NoOpOperationListener());
dbUnitConnection = databaseTester.getConnection();
dbUnitRunner = new DbUnitRunner(dbUnitConnection);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例5: alternativeImplementationWithClassAsBaseType
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
@Test
public void alternativeImplementationWithClassAsBaseType()
{
List<BaseBean2> testBeans = BeanProvider.getContextualReferences(BaseBean2.class, true);
Assert.assertEquals(1, testBeans.size());
Assert.assertEquals(BaseBean2.class.getName(), testBeans.get(0).getClass().getName());
}
示例6: multiBeanLookupWithDependentBean
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
@Test
public void multiBeanLookupWithDependentBean() throws Exception
{
List<MultiBean> result = BeanProvider.getContextualReferences(MultiBean.class, false);
Assert.assertNotNull(result);
Assert.assertEquals(2, result.size());
}
示例7: multiBeanLookupWithoutDependentBean
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
@Test
public void multiBeanLookupWithoutDependentBean() throws Exception
{
List<MultiBean> result = BeanProvider.getContextualReferences(MultiBean.class, false, false);
Assert.assertNotNull(result);
Assert.assertEquals(1, result.size());
}
示例8: init
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
@PostConstruct
public void init() {
logoutURLProcessors = BeanProvider.getContextualReferences(LogoutURLProcessor.class, true);
}
示例9: performConsistencyCheck
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
private Throwable performConsistencyCheck(Throwable t)
{
Throwable result = t;
if (t instanceof InvocationTargetException)
{
result = t.getCause();
}
List<EntityManager> entityManagerList =
BeanProvider.getContextualReferences(EntityManager.class, true, false);
for (Field field : this.target.getClass().getDeclaredFields())
{
if (EntityManager.class.isAssignableFrom(field.getType()))
{
field.setAccessible(true);
try
{
entityManagerList.add((EntityManager) field.get(this.target));
}
catch (Exception e)
{
throw ExceptionUtils.throwAsRuntimeException(e);
}
}
}
for (EntityManager entityManager : entityManagerList)
{
if (entityManager.getTransaction().isActive())
{
if (t instanceof AssertionFailedError)
{
LOG.severe("assert failed within a transaction");
}
LOG.severe("start manual rollback");
//force rollback - otherwise there can be side-effects in other tests or cleanup-code
// (e.g. 'TRUNCATE SCHEMA' would fail)
entityManager.getTransaction().rollback();
if (result == null)
{
result = new IllegalStateException("open transaction found");
}
}
}
return result;
}