Author: swd847
Date: 2010-10-05 02:20:55 -0400 (Tue, 05 Oct 2010)
New Revision: 13791
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/InjectionEventListener.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/ManagedPersistenceContextExtension.java
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/hibernate/HibernateManagedPersistenceContextBeanLifecycle.java
Log:
update to work with latest weld-extensions
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/InjectionEventListener.java
===================================================================
---
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/InjectionEventListener.java 2010-10-04
20:03:56 UTC (rev 13790)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/InjectionEventListener.java 2010-10-05
06:20:55 UTC (rev 13791)
@@ -29,11 +29,10 @@
import java.util.concurrent.ConcurrentHashMap;
import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionTarget;
import javax.inject.Inject;
-import org.jboss.weld.extensions.beanManager.BeanManagerAccessor;
+import org.jboss.weld.extensions.beanManager.BeanManagerAware;
import org.jboss.weld.extensions.reflection.Reflections;
import org.jboss.weld.extensions.reflection.annotated.AnnotatedTypeBuilder;
import org.slf4j.Logger;
@@ -53,21 +52,15 @@
* @author Stuart Douglas
*
*/
-public class InjectionEventListener
+public class InjectionEventListener extends BeanManagerAware
{
private final static Logger log =
LoggerFactory.getLogger(InjectionEventListener.class);
private final Map<Class<?>, InjectionTarget<?>> injectionTargets =
new ConcurrentHashMap<Class<?>, InjectionTarget<?>>();
- BeanManager manager;
-
public void load(Object entity)
{
- if (manager == null)
- {
- this.manager = BeanManagerAccessor.getManager();
- }
if (!injectionTargets.containsKey(entity.getClass()))
{
if (!injectionRequired(entity.getClass()))
@@ -80,7 +73,7 @@
// it is ok for this code to run twice, so we don't really need to
// lock
AnnotatedTypeBuilder<?> builder = new
AnnotatedTypeBuilder().readFromType(entity.getClass());
- InjectionTarget<?> injectionTarget =
manager.createInjectionTarget(builder.create());
+ InjectionTarget<?> injectionTarget =
getBeanManager().createInjectionTarget(builder.create());
injectionTargets.put(entity.getClass(), injectionTarget);
log.info("Enabling injection into entity {}", entity.getClass());
}
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-10-04
20:03:56 UTC (rev 13790)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextBeanLifecycle.java 2010-10-05
06:20:55 UTC (rev 13791)
@@ -38,7 +38,7 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
-import org.jboss.weld.extensions.bean.BeanLifecycle;
+import org.jboss.weld.extensions.bean.ContextualLifecycle;
import org.jboss.weld.extensions.literal.DefaultLiteral;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,7 +49,7 @@
* @author Stuart Douglas
*
*/
-public class ManagedPersistenceContextBeanLifecycle implements
BeanLifecycle<EntityManager>
+public class ManagedPersistenceContextBeanLifecycle implements
ContextualLifecycle<EntityManager>
{
private static final Logger log =
LoggerFactory.getLogger(ManagedPersistenceContextBeanLifecycle.class);
@@ -115,7 +115,7 @@
{
persistenceContexts = getPersistenceContexts();
}
- catch (ContextNotActiveException e)
+ catch (ContextNotActiveException e)
{
// it's null already
}
@@ -132,14 +132,14 @@
throw new RuntimeException(e);
}
}
-
+
private FlushModeType getFlushMode()
{
try
{
return getPersistenceContexts().getFlushMode();
}
- catch (ContextNotActiveException e)
+ catch (ContextNotActiveException e)
{
// TODO Set the default flush mode for the app
return FlushModeType.AUTO;
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextExtension.java
===================================================================
---
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextExtension.java 2010-10-04
20:03:56 UTC (rev 13790)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextExtension.java 2010-10-05
06:20:55 UTC (rev 13791)
@@ -299,7 +299,7 @@
builder.getTypes().add(Object.class);
builder.beanLifecycle(lifecycle);
builder.alternative(alternative);
- builder.setToString("Seam Managed Persistence Context with qualifiers ["
+ qualifiers + "] with configured by [" + member + "]");
+ builder.toString("Seam Managed Persistence Context with qualifiers [" +
qualifiers + "] with configured by [" + member + "]");
beans.add(builder.create());
}
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/hibernate/HibernateManagedPersistenceContextBeanLifecycle.java
===================================================================
---
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/hibernate/HibernateManagedPersistenceContextBeanLifecycle.java 2010-10-04
20:03:56 UTC (rev 13790)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/hibernate/HibernateManagedPersistenceContextBeanLifecycle.java 2010-10-05
06:20:55 UTC (rev 13791)
@@ -38,7 +38,7 @@
import org.jboss.seam.persistence.HibernatePersistenceProvider;
import org.jboss.seam.persistence.ManagedPersistenceContext;
import org.jboss.seam.persistence.PersistenceContexts;
-import org.jboss.weld.extensions.bean.BeanLifecycle;
+import org.jboss.weld.extensions.bean.ContextualLifecycle;
import org.jboss.weld.extensions.literal.DefaultLiteral;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,7 +49,7 @@
* @author Stuart Douglas
*
*/
-public class HibernateManagedPersistenceContextBeanLifecycle implements
BeanLifecycle<Session>
+public class HibernateManagedPersistenceContextBeanLifecycle implements
ContextualLifecycle<Session>
{
private static final Logger log =
LoggerFactory.getLogger(HibernateManagedPersistenceContextBeanLifecycle.class);
Show replies by date