本文整理汇总了Java中org.apache.deltaspike.core.api.provider.BeanManagerProvider类的典型用法代码示例。如果您正苦于以下问题:Java BeanManagerProvider类的具体用法?Java BeanManagerProvider怎么用?Java BeanManagerProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BeanManagerProvider类属于org.apache.deltaspike.core.api.provider包,在下文中一共展示了BeanManagerProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createTest
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
@Override
protected Object createTest() throws Exception
{
BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
Class<?> type = getTestClass().getJavaClass();
Set<Bean<?>> beans = beanManager.getBeans(type);
Object result;
if (!USE_TEST_CLASS_AS_CDI_BEAN || beans == null || beans.isEmpty())
{
result = super.createTest();
BeanProvider.injectFields(result); //fallback to simple injection
}
else
{
Bean<Object> bean = (Bean<Object>) beanManager.resolve(beans);
CreationalContext<Object> creationalContext = beanManager.createCreationalContext(bean);
result = beanManager.getReference(bean, type, creationalContext);
}
return result;
}
开发者ID:apache,项目名称:deltaspike,代码行数:23,代码来源:CdiTestRunner.java
示例2: initGlobalEntityManager
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
private synchronized void initGlobalEntityManager()
{
// switch into paranoia mode
if (this.globalEntityManagerInitialized == null)
{
this.globalEntityManagerInitialized = true;
BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
Set<Bean<?>> beans = beanManager.getBeans(EntityManager.class);
Bean<?> bean = beanManager.resolve(beans);
if (bean == null)
{
throw new IllegalStateException("Could not find EntityManager with default qualifier.");
}
globalEntityManagerIsNormalScope = beanManager.isNormalScope(bean.getScope());
if (globalEntityManagerIsNormalScope)
{
globalEntityManager = (EntityManager) beanManager.getReference(bean,
EntityManager.class,
beanManager.createCreationalContext(bean));
}
}
}
开发者ID:apache,项目名称:deltaspike,代码行数:26,代码来源:EntityManagerRefLookup.java
示例3: getEntityManagerFactoryConfiguration
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
@Override
public Properties getEntityManagerFactoryConfiguration(String persistenceUnitName)
{
Properties unitProperties = PropertyLoader.getProperties("persistence-" + persistenceUnitName);
if (unitProperties == null)
{
unitProperties = new Properties();
}
// apply ConfigFilters to the configured values.
for (Map.Entry entry : unitProperties.entrySet())
{
String key = (String) entry.getKey();
String value = (String) entry.getValue();
entry.setValue(ConfigResolver.filterConfigValue(key, value));
}
unitProperties = addConfigProperties(unitProperties, persistenceUnitName);
// add spec expected attributes
unitProperties.put("javax.persistence.bean.manager", BeanManagerProvider.getInstance().getBeanManager());
return unitProperties;
}
开发者ID:apache,项目名称:deltaspike,代码行数:27,代码来源:PersistenceConfigurationProviderImpl.java
示例4: redefineParameterValue
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Object redefineParameterValue(ParameterValue value)
{
CreationalContext<?> ctx = BeanManagerProvider.getInstance().getBeanManager()
.createCreationalContext(declaringBean);
try
{
if (value.getPosition() == handlerMethod.getHandlerParameter().getPosition())
{
return event;
}
return value.getDefaultValue(ctx);
}
finally
{
if (ctx != null)
{
ctx.release();
}
}
}
开发者ID:apache,项目名称:deltaspike,代码行数:26,代码来源:OutboundParameterValueRedefiner.java
示例5: sessionDestroyed
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
@Override
public void sessionDestroyed(ClientSession dolphinSession) {
Assert.requireNonNull(dolphinSession, "dolphinSession");
BeanManager bm = BeanManagerProvider.getInstance().getBeanManager();
ClientScopeContext clientContext = (ClientScopeContext) bm.getContext(ClientScoped.class);
clientContext.destroy();
}
开发者ID:canoo,项目名称:dolphin-platform,代码行数:8,代码来源:DolphinContextListenerCdi.java
示例6: getCdiVersion
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
public String getCdiVersion() {
try {
return ClassUtils.getJarVersion(BeanManagerProvider.getInstance().getBeanManager().getClass());
} catch (Exception e) {
e.printStackTrace();
return "Failed to get CDI Version: " + e.getMessage();
}
}
开发者ID:apache,项目名称:tomee,代码行数:9,代码来源:InfoBean.java
示例7: evaluate
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
@Override
public void evaluate() throws Throwable
{
BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
Class<?> type = this.method.getMethod().getDeclaringClass();
Set<Bean<?>> beans = beanManager.getBeans(type);
if (!USE_TEST_CLASS_AS_CDI_BEAN || beans == null || beans.isEmpty())
{
if (!ALLOW_INJECTION_POINT_MANIPULATION)
{
BeanProvider.injectFields(this.originalTarget); //fallback to simple injection
}
invokeMethod(this.originalTarget);
}
else
{
Bean<Object> bean = (Bean<Object>) beanManager.resolve(beans);
CreationalContext<Object> creationalContext = beanManager.createCreationalContext(bean);
Object target = beanManager.getReference(bean, type, creationalContext);
try
{
invokeMethod(target);
}
finally
{
if (bean.getScope().equals(Dependent.class))
{
bean.destroy(target, creationalContext);
}
}
}
}
开发者ID:apache,项目名称:deltaspike,代码行数:37,代码来源:CdiTestRunner.java
示例8: getBeanManager
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
protected BeanManager getBeanManager()
{
if (beanManager == null)
{
synchronized (this)
{
if (beanManager == null)
{
beanManager = BeanManagerProvider.getInstance().getBeanManager();
}
}
}
return beanManager;
}
开发者ID:apache,项目名称:deltaspike,代码行数:16,代码来源:EventBroadcaster.java
示例9: persist
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
@PrePersist
public void persist(Object entity)
{
BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
Set<Bean<?>> beans = beanManager.getBeans(PrePersistAuditListener.class);
for (Bean<?> bean : beans)
{
PrePersistAuditListener result = (PrePersistAuditListener) beanManager.getReference(
bean, PrePersistAuditListener.class, beanManager.createCreationalContext(bean));
result.prePersist(entity);
}
}
开发者ID:apache,项目名称:deltaspike,代码行数:13,代码来源:AuditEntityListener.java
示例10: update
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
@PreUpdate
public void update(Object entity)
{
BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
Set<Bean<?>> beans = beanManager.getBeans(PreUpdateAuditListener.class);
for (Bean<?> bean : beans)
{
PreUpdateAuditListener result = (PreUpdateAuditListener) beanManager.getReference(
bean, PreUpdateAuditListener.class, beanManager.createCreationalContext(bean));
result.preUpdate(entity);
}
}
开发者ID:apache,项目名称:deltaspike,代码行数:13,代码来源:AuditEntityListener.java
示例11: testPersistenceConfigurationProvider
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
@Test
public void testPersistenceConfigurationProvider()
{
Properties myUnitConfig = persistenceConfigurationProvider.getEntityManagerFactoryConfiguration("MyUnit");
Assert.assertEquals(4, myUnitConfig.size());
Assert.assertEquals(BeanManagerProvider.getInstance().getBeanManager(), myUnitConfig.get("javax.persistence.bean.manager"));
Assert.assertEquals("blub", myUnitConfig.get("javax.persistence.jdbc.password"));
Assert.assertEquals("sa", myUnitConfig.get("javax.persistence.jdbc.user"));
Assert.assertEquals("some.jdbc.Driver", myUnitConfig.get("javax.persistence.jdbc.driver"));
}
开发者ID:apache,项目名称:deltaspike,代码行数:11,代码来源:PersistenceConfigurationProviderTest.java
示例12: resolveManagedConverter
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
public static Converter resolveManagedConverter(Class<? extends Converter> converterClass)
{
if (JAVAX_FACES_CONVERT_PACKAGE_NAME.equals(converterClass.getPackage().getName()))
{
return null;
}
return getContextualReference(BeanManagerProvider.getInstance().getBeanManager(), converterClass);
}
开发者ID:apache,项目名称:deltaspike,代码行数:10,代码来源:ManagedArtifactResolver.java
示例13: resolveManagedValidator
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
public static Validator resolveManagedValidator(Class<? extends Validator> validatorClass)
{
if (JAVAX_FACES_VALIDATOR_PACKAGE_NAME.equals(validatorClass.getPackage().getName()))
{
return null;
}
return getContextualReference(BeanManagerProvider.getInstance().getBeanManager(), validatorClass);
}
开发者ID:apache,项目名称:deltaspike,代码行数:10,代码来源:ManagedArtifactResolver.java
示例14: processEvent
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
@Override
public void processEvent(SystemEvent e) throws AbortProcessingException
{
if (!this.isActivated)
{
return;
}
BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
beanManager.fireEvent(e);
}
开发者ID:apache,项目名称:deltaspike,代码行数:12,代码来源:JsfSystemEventBroadcaster.java
示例15: init
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
private synchronized void init()
{
if (this.beanManager == null)
{
this.beanManager = BeanManagerProvider.getInstance().getBeanManager();
this.navigationParameterContext =
BeanProvider.getContextualReference(NavigationParameterContext.class);
this.viewConfigResolver =
BeanProvider.getContextualReference(ViewConfigResolver.class);
}
}
开发者ID:apache,项目名称:deltaspike,代码行数:12,代码来源:ViewConfigAwareNavigationHandler.java
示例16: resolveInterceptors
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
private List<Interceptor<?>> resolveInterceptors(Object instance, Method method)
{
BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
Annotation[] interceptorBindings = extractInterceptorBindings(beanManager, instance, method);
if (interceptorBindings.length > 0)
{
return beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, interceptorBindings);
}
return new ArrayList<Interceptor<?>>();
}
开发者ID:apache,项目名称:deltaspike,代码行数:13,代码来源:DeltaSpikeProxyInterceptorLookup.java
示例17: instance
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
private synchronized Object instance()
{
final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classloader);
try
{
if (instance != null)
{
return instance;
}
if (normalScope)
{
instance = BeanProvider.getContextualReference(clazz, qualifiers);
}
else
{
final BeanManager bm = BeanManagerProvider.getInstance().getBeanManager();
final Set<Bean<?>> beans = bm.getBeans(clazz, qualifiers);
if (beans == null || beans.isEmpty())
{
throw new IllegalStateException("Could not find beans for Type=" + clazz
+ " and qualifiers:" + Arrays.toString(qualifiers));
}
final Bean<?> resolvedBean = bm.resolve(beans);
final CreationalContext<?> creationalContext = bm.createCreationalContext(resolvedBean);
instance = bm.getReference(resolvedBean, clazz, creationalContext);
creationalContext.release();
}
return instance;
}
finally
{
Thread.currentThread().setContextClassLoader(oldCl);
}
}
开发者ID:apache,项目名称:deltaspike,代码行数:38,代码来源:DynamicMBeanWrapper.java
示例18: testBeanManagerProvider
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
@Test
public void testBeanManagerProvider() throws Exception
{
BeanManagerProvider bmp = BeanManagerProvider.getInstance();
Assert.assertNotNull(bmp);
BeanManager bm = bmp.getBeanManager();
Assert.assertNotNull(bm);
}
开发者ID:apache,项目名称:deltaspike,代码行数:10,代码来源:BeanManagerProviderTest.java
示例19: getBeanManager
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
public static BeanManager getBeanManager()
{
return BeanManagerProvider.getInstance().getBeanManager();
}
开发者ID:ova2,项目名称:jsf-portal,代码行数:5,代码来源:FacesUtils.java
示例20: getDeltaSpikeVersion
import org.apache.deltaspike.core.api.provider.BeanManagerProvider; //导入依赖的package包/类
public String getDeltaSpikeVersion() {
return ClassUtils.getJarVersion(BeanManagerProvider.class);
}
开发者ID:apache,项目名称:tomee,代码行数:4,代码来源:InfoBean.java
注:本文中的org.apache.deltaspike.core.api.provider.BeanManagerProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论