本文整理汇总了Java中org.apache.deltaspike.core.api.provider.BeanProvider.getDependent方法的典型用法代码示例。如果您正苦于以下问题:Java BeanProvider.getDependent方法的具体用法?Java BeanProvider.getDependent怎么用?Java BeanProvider.getDependent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.deltaspike.core.api.provider.BeanProvider
的用法示例。
在下文中一共展示了BeanProvider.getDependent方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
/**
* Executes the pipeline stage with the given pipeline context and returns the result.
* <p>
* Invokes the prepare method on the stage and returns the result. The stage is invoked in it's own transaction. If an exception is caught the transaction is rolled back and the stage is marked
* as FAILED.
* </p>
*
* @param pipelineContext
* the pipeline context
* @param pipelineStage
* the pipeline stage class
* @return a {@link PipelineStageResult}
*/
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public PipelineStageResult execute(PipelineContext pipelineContext, Class<PipelineStage> pipelineStage) {
DependentProvider<PipelineStage> dependentProvider = null;
try {
logBefore(pipelineContext, pipelineStage, "preparing");
dependentProvider = BeanProvider.getDependent(pipelineStage);
PipelineStageResult result = dependentProvider.get().prepare(pipelineContext);
logAfter(pipelineContext, pipelineStage, result);
return result;
} catch (Exception e) {
ejbContext.setRollbackOnly();
String message = "Pipeline execution failed at stage " + pipelineStage.getName() + ". Reason " + e.getMessage();
LOGGER.error(message, e);
return PipelineStageResult.builder(pipelineContext.getPipelineId(), PipelineStageStatus.FAILED).addMessages(ImmutableSet.of(message)).build();
} finally {
if (dependentProvider != null) {
dependentProvider.destroy();
}
}
}
示例2: onCallback
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
/**
* Executes the pipeline stage with the given pipeline context and callback event before returning the result.
* <p>
* Invoke the callback method on the stage and returns the result. The stage is invoked in it's own transaction. If an exception is caught the transaction is rolled back and the stage is marked
* as FAILED.
* </p>
*
* @param pipelineContext
* the pipeline context
* @param pipelineStage
* the pipeline stage
* @param callbackEvent
* the callback event
* @return a {@link PipelineStageResult}
*/
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public PipelineStageResult onCallback(PipelineContext pipelineContext, Class<PipelineStage> pipelineStage, CallbackEvent callbackEvent) {
DependentProvider<PipelineStage> dependentProvider = null;
try {
logBefore(pipelineContext, pipelineStage, "resuming");
dependentProvider = BeanProvider.getDependent(pipelineStage);
PipelineStageResult result = dependentProvider.get().onCallback(pipelineContext, callbackEvent);
logAfter(pipelineContext, pipelineStage, result);
return result;
} catch (Exception e) {
ejbContext.setRollbackOnly();
String message = "Pipeline execution failed at stage " + pipelineStage.getName() + ". Reason " + e.getMessage();
LOGGER.error(message, e);
return PipelineStageResult.builder(pipelineContext.getPipelineId(), PipelineStageStatus.FAILED).addMessages(ImmutableSet.of(message)).build();
} finally {
if (dependentProvider != null) {
dependentProvider.destroy();
}
}
}
示例3: onFailure
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void onFailure(PipelineContext pipelineContext, Class<PipelineFailureStage> pipelineFailureStage) {
DependentProvider<PipelineFailureStage> dependentProvider = null;
try {
LOGGER.debug("executing pipeline failure stage " + pipelineFailureStage.getName());
dependentProvider = BeanProvider.getDependent(pipelineFailureStage);
dependentProvider.get().onFailure(pipelineContext);
LOGGER.debug("executed pipeline failure stage " + pipelineFailureStage.getName());
} catch (Exception e) {
ejbContext.setRollbackOnly();
String message = "Failed to execute pipeline failure stage " + pipelineFailureStage.getName() + ". Reason " + e.getMessage();
LOGGER.error(message, e);
} finally {
if (dependentProvider != null) {
dependentProvider.destroy();
}
}
}
示例4: getQueryInOutMapper
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
public QueryInOutMapper<?> getQueryInOutMapper()
{
if (repositoryMethodMetadata.getQueryInOutMapperClass() == null)
{
return null;
}
QueryInOutMapper<?> result = null;
if (repositoryMethodMetadata.isQueryInOutMapperIsNormalScope())
{
result = BeanProvider.getContextualReference(repositoryMethodMetadata.getQueryInOutMapperClass());
}
else
{
DependentProvider<? extends QueryInOutMapper<?>> mappedProvider =
BeanProvider.getDependent(repositoryMethodMetadata.getQueryInOutMapperClass());
result = mappedProvider.get();
this.addDestroyable(new DependentProviderDestroyable(mappedProvider));
}
return result;
}
示例5: resolveUserTransaction
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
protected UserTransaction resolveUserTransaction()
{
//manual lookup needed because injecting UserTransactionResolver can fail (see the comment there)
try
{
DependentProvider<UserTransactionResolver> provider =
BeanProvider.getDependent(this.beanManager, UserTransactionResolver.class);
UserTransaction userTransaction = provider.get().resolveUserTransaction();
provider.destroy();
return userTransaction;
}
catch (Exception e)
{
return null;
}
}
示例6: start
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
public void start() {
cdiContainer.start();
DependentProvider<WorkerRegistrar> workerRegistrarProvider = BeanProvider.getDependent(WorkerRegistrar.class);
try {
workerRegistrarProvider.get().register();
startCamel();
} catch(Exception e) {
LOGGER.error("Unable to start worker. Reason:" + e.getMessage(), e);
shutdown();
} finally {
workerRegistrarProvider.destroy();
}
}
示例7: shutdown
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
public void shutdown() {
DependentProvider<WorkerRegistrar> workerRegistrarProvider = BeanProvider.getDependent(WorkerRegistrar.class);
try {
stopCamel();
workerRegistrarProvider.get().unregister();
} finally {
workerRegistrarProvider.destroy();
}
cdiContainer.stop();
}
示例8: startContexts
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
public void startContexts(Scheduled scheduled)
{
Collections.addAll(this.scopes, scheduled.startScopes());
if (!this.scopes.isEmpty())
{
this.contextControl = BeanProvider.getDependent(ContextControl.class);
for (Class<? extends Annotation> scopeAnnotation : this.scopes)
{
contextControl.get().startContext(scopeAnnotation);
}
}
}
示例9: create
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
@Override
public T create(Bean<T> bean, CreationalContext<T> creationalContext)
{
invocationHandlerProvider = BeanProvider.getDependent(beanManager, MessageBundleInvocationHandler.class);
return createMessageBundleProxy((Class<T>) bean.getBeanClass(), invocationHandlerProvider.get());
}
示例10: testDependentBeanSerialization
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
@Test
public void testDependentBeanSerialization() throws Exception
{
// this test is known to not work under owb-1.1.x as ManagedBean for Dependent scoped classes did not implement PassivationCapable.
Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_OWB_1_1_x));
Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_TOMEE_1_5_x));
DependentProvider<DependentTestBean> dependentTestBeanProvider = BeanProvider.getDependent(DependentTestBean.class);
Serializer<DependentProvider<DependentTestBean>> serializer = new Serializer<DependentProvider<DependentTestBean>>();
DependentProvider<DependentTestBean> provider2 = serializer.roundTrip(dependentTestBeanProvider);
Assert.assertNotNull(provider2);
}
示例11: ArchiveRetrievalNotificationConsumer
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
public ArchiveRetrievalNotificationConsumer() {
taskStatusQueueProvider = BeanProvider.getDependent(TaskStatusQueue.class);
}
示例12: resolveUserTransaction
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
public UserTransaction resolveUserTransaction()
{
UserTransaction userTransaction;
try
{
DependentProvider<ManagedUserTransactionResolver> provider =
BeanProvider.getDependent(this.beanManager, ManagedUserTransactionResolver.class);
userTransaction = provider.get().resolveUserTransaction();
provider.destroy();
}
catch (Throwable t)
{
//it was just a try
userTransaction = null;
}
if (userTransaction != null)
{
return userTransaction;
}
String jndiName = JpaBaseConfig.UserTransaction.JNDI_NAME;
String[] jndiNames = jndiName.split(",");
for (String currentJndiName : jndiNames)
{
try
{
userTransaction = JndiUtils.lookup(currentJndiName, UserTransaction.class);
if (userTransaction != null)
{
break;
}
}
catch (Exception e)
{
userTransaction = null;
}
}
return userTransaction;
}
示例13: testDependentBeanResolving
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
@Test
public void testDependentBeanResolving() throws Exception
{
DependentProvider<DependentTestBean> dependentTestBeanProvider = BeanProvider.getDependent(DependentTestBean.class);
checkDependentProvider(dependentTestBeanProvider);
}
示例14: testNamedDependentBeanResolving
import org.apache.deltaspike.core.api.provider.BeanProvider; //导入方法依赖的package包/类
@Test
public void testNamedDependentBeanResolving() throws Exception
{
DependentProvider<DependentTestBean> dependentTestBeanProvider = BeanProvider.getDependent("dependentTestBean");
checkDependentProvider(dependentTestBeanProvider);
}