Author: swd847
Date: 2010-07-23 07:48:34 -0400 (Fri, 23 Jul 2010)
New Revision: 13487
Modified:
modules/persistence/trunk/api/src/main/java/org/jboss/seam/persistence/transaction/Transactional.java
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextBeanLifecycle.java
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/transaction/TransactionExtension.java
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/transaction/scope/TransactionScopeContext.java
Log:
fix compile errors
Modified:
modules/persistence/trunk/api/src/main/java/org/jboss/seam/persistence/transaction/Transactional.java
===================================================================
---
modules/persistence/trunk/api/src/main/java/org/jboss/seam/persistence/transaction/Transactional.java 2010-07-23
09:35:57 UTC (rev 13486)
+++
modules/persistence/trunk/api/src/main/java/org/jboss/seam/persistence/transaction/Transactional.java 2010-07-23
11:48:34 UTC (rev 13487)
@@ -27,17 +27,21 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.enterprise.util.Nonbinding;
import javax.interceptor.InterceptorBinding;
-
/**
+ * Demarcates transaction boundaries
+ *
+ * Note that is you are using seam managed transactions seam will automatically
+ * manage your transactions for you, rendering this unnessesary
+ *
+ *
* @author Dan Allen
*/
@Inherited
-@InterceptorBinding
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.METHOD, ElementType.TYPE })
+@InterceptorBinding
public @interface Transactional
{
/**
@@ -45,6 +49,5 @@
*
* @return REQUIRED by default
*/
- @Nonbinding
TransactionPropagation value() default TransactionPropagation.REQUIRED;
}
\ No newline at end of file
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextBeanLifecycle.java
===================================================================
---
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextBeanLifecycle.java 2010-07-23
09:35:57 UTC (rev 13486)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextBeanLifecycle.java 2010-07-23
11:48:34 UTC (rev 13487)
@@ -29,14 +29,13 @@
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import org.jboss.weld.extensions.bean.BeanImpl;
import org.jboss.weld.extensions.bean.BeanLifecycle;
-import org.jboss.weld.extensions.util.BeanResolutionException;
-import org.jboss.weld.extensions.util.BeanResolver;
/**
* Class that is responsible for creating and destroying the seam managed
@@ -111,14 +110,13 @@
{
if (emf == null)
{
- try
+ Bean<EntityManagerFactory> bean = (Bean)
manager.resolve(manager.getBeans(EntityManagerFactory.class, qualifiers));
+ if (bean == null)
{
- emf = BeanResolver.getReference(EntityManagerFactory.class, manager,
qualifiers);
+ throw new RuntimeException("Could not find EntityManagerFactory bean
with qualifiers" + qualifiers);
}
- catch (BeanResolutionException e)
- {
- throw new RuntimeException(e);
- }
+ CreationalContext<EntityManagerFactory> ctx =
manager.createCreationalContext(bean);
+ emf = (EntityManagerFactory) manager.getReference(bean,
EntityManagerFactory.class, ctx);
}
return emf;
}
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
===================================================================
---
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-07-23
09:35:57 UTC (rev 13486)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-07-23
11:48:34 UTC (rev 13487)
@@ -25,14 +25,16 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.persistence.EntityManager;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
import org.jboss.seam.persistence.transaction.SeamTransaction;
import org.jboss.seam.persistence.transaction.literal.DefaultTransactionLiteral;
-import org.jboss.weld.extensions.util.BeanResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -99,14 +101,13 @@
{
if (userTransaction == null)
{
- try
+ Bean<SeamTransaction> bean = (Bean)
beanManager.resolve(beanManager.getBeans(SeamTransaction.class,
DefaultTransactionLiteral.INSTANCE));
+ if (bean == null)
{
- userTransaction = BeanResolver.getReference(SeamTransaction.class,
beanManager, DefaultTransactionLiteral.INSTANCE);
+ throw new RuntimeException("Could not find SeamTransaction bean with
qualifier " + DefaultTransaction.class.getName());
}
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
+ CreationalContext<SeamTransaction> ctx =
beanManager.createCreationalContext(bean);
+ userTransaction = (SeamTransaction) beanManager.getReference(bean,
SeamTransaction.class, ctx);
}
return userTransaction;
}
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/transaction/TransactionExtension.java
===================================================================
---
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/transaction/TransactionExtension.java 2010-07-23
09:35:57 UTC (rev 13486)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/transaction/TransactionExtension.java 2010-07-23
11:48:34 UTC (rev 13487)
@@ -34,8 +34,6 @@
import org.jboss.weld.extensions.bean.BeanImpl;
import org.jboss.weld.extensions.bean.BeanLifecycle;
import org.jboss.weld.extensions.defaultbean.DefaultBeanExtension;
-import org.jboss.weld.extensions.util.BeanResolutionException;
-import org.jboss.weld.extensions.util.BeanResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -103,14 +101,11 @@
*/
private void setupBeanDefinition()
{
- try
+ transactionBean = (Bean) manager.resolve(manager.getBeans(SeamTransaction.class,
new TransactionQualifier.TransactionQualifierLiteral()));
+ if (transactionBean == null)
{
- transactionBean = BeanResolver.resolveBean(SeamTransaction.class, manager,
new TransactionQualifier.TransactionQualifierLiteral());
+ throw new RuntimeException("Could not find SeamTransaction bean with
qualifier " + DefaultTransaction.class.getName());
}
- catch (BeanResolutionException e)
- {
- throw new RuntimeException(e);
- }
}
}
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/transaction/scope/TransactionScopeContext.java
===================================================================
---
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/transaction/scope/TransactionScopeContext.java 2010-07-23
09:35:57 UTC (rev 13486)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/transaction/scope/TransactionScopeContext.java 2010-07-23
11:48:34 UTC (rev 13487)
@@ -29,15 +29,15 @@
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
+import org.jboss.seam.persistence.transaction.DefaultTransaction;
import org.jboss.seam.persistence.transaction.SeamTransaction;
import org.jboss.seam.persistence.transaction.TransactionScoped;
import org.jboss.seam.persistence.transaction.literal.DefaultTransactionLiteral;
-import org.jboss.weld.extensions.util.BeanResolutionException;
-import org.jboss.weld.extensions.util.BeanResolver;
/**
* Context for the {@link TransactionScoped} scope
@@ -76,14 +76,13 @@
{
if (userTransaction == null)
{
- try
+ Bean<SeamTransaction> bean = (Bean)
beanManager.resolve(beanManager.getBeans(SeamTransaction.class,
DefaultTransactionLiteral.INSTANCE));
+ if (bean == null)
{
- userTransaction = BeanResolver.getReference(SeamTransaction.class,
beanManager, DefaultTransactionLiteral.INSTANCE);
+ throw new RuntimeException("Could not find SeamTransaction bean
with qualifier " + DefaultTransaction.class.getName());
}
- catch (BeanResolutionException e)
- {
- throw new RuntimeException(e);
- }
+ CreationalContext<SeamTransaction> ctx =
beanManager.createCreationalContext(bean);
+ userTransaction = (SeamTransaction) beanManager.getReference(bean,
SeamTransaction.class, ctx);
}
}
}