[seam-commits] Seam SVN: r13582 - modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Aug 9 07:28:07 EDT 2010
Author: swd847
Date: 2010-08-09 07:28:07 -0400 (Mon, 09 Aug 2010)
New Revision: 13582
Added:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/FlushModeManagerImpl.java
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/FlushModeManager.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/ManagedPersistenceContextProxyHandler.java
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextProxyHandler.java
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContexts.java
Log:
refactoring and bug fix
Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/FlushModeManager.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/FlushModeManager.java 2010-08-09 10:58:31 UTC (rev 13581)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/FlushModeManager.java 2010-08-09 11:28:07 UTC (rev 13582)
@@ -21,33 +21,15 @@
*/
package org.jboss.seam.persistence;
-import java.io.Serializable;
-
-import javax.enterprise.context.ApplicationScoped;
-
import org.jboss.seam.persistence.transaction.FlushModeType;
/**
- * Provides for programmatic configuration of the default flush mode.
+ * provides a means of configuring the default flush mode
*
- * TODO: implement this
- *
* @author Stuart Douglas
*
*/
- at ApplicationScoped
-public class FlushModeManager implements Serializable
+public interface FlushModeManager
{
- FlushModeType flushModeType = FlushModeType.AUTO;
-
- public FlushModeType getFlushModeType()
- {
- return flushModeType;
- }
-
- public void setFlushModeType(FlushModeType flushModeType)
- {
- this.flushModeType = flushModeType;
- }
-
+ public FlushModeType getFlushModeType();
}
Copied: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/FlushModeManagerImpl.java (from rev 13576, modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/FlushModeManager.java)
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/FlushModeManagerImpl.java (rev 0)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/FlushModeManagerImpl.java 2010-08-09 11:28:07 UTC (rev 13582)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.persistence;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.jboss.seam.persistence.transaction.FlushModeType;
+import org.jboss.weld.extensions.defaultbean.DefaultBean;
+
+/**
+ * Provides for programmatic configuration of the default flush mode.
+ *
+ * TODO: implement this
+ *
+ * @author Stuart Douglas
+ *
+ */
+ at ApplicationScoped
+ at DefaultBean(type = FlushModeManager.class)
+public class FlushModeManagerImpl implements Serializable, FlushModeManager
+{
+ FlushModeType flushModeType = FlushModeType.AUTO;
+
+ public FlushModeType getFlushModeType()
+ {
+ return flushModeType;
+ }
+
+ public void setFlushModeType(FlushModeType flushModeType)
+ {
+ this.flushModeType = flushModeType;
+ }
+
+}
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-08-09 10:58:31 UTC (rev 13581)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextExtension.java 2010-08-09 11:28:07 UTC (rev 13582)
@@ -56,9 +56,9 @@
/**
* loops through the fields on an AnnotatedType looking for a @PersistnceUnit
- * producer field that is annotated {@link SeamManaged}. Then found a
- * corresponding smpc bean is created and registered. Any scope declaration
- * on the producer are removed as this is not supported by the spec
+ * producer field that is annotated {@link SeamManaged}. Then a corresponding
+ * smpc bean is created and registered. Any scope declaration on the producer
+ * are removed as this is not supported by the spec
*
*/
public <T> void processAnnotatedType(@Observes ProcessAnnotatedType<T> event, BeanManager manager)
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-08-09 10:58:31 UTC (rev 13581)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-08-09 11:28:07 UTC (rev 13582)
@@ -25,7 +25,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -66,7 +65,7 @@
public ManagedPersistenceContextProxyHandler(EntityManager delegate, BeanManager beanManager, Set<Annotation> qualifiers)
{
- super(delegate, beanManager);
+ super(delegate, beanManager, qualifiers);
this.delegate = delegate;
this.userTransactionInstance = InstanceResolver.getInstance(SeamTransaction.class, beanManager, DefaultTransactionLiteral.INSTANCE);
this.qualifiers = new HashSet<Annotation>(qualifiers);
@@ -111,10 +110,4 @@
{
}
-
- public Set<Annotation> getQualifiers()
- {
- return Collections.unmodifiableSet(qualifiers);
- }
-
}
Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextProxyHandler.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextProxyHandler.java 2010-08-09 10:58:31 UTC (rev 13581)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextProxyHandler.java 2010-08-09 11:28:07 UTC (rev 13582)
@@ -22,7 +22,11 @@
package org.jboss.seam.persistence;
import java.io.Serializable;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.spi.BeanManager;
@@ -53,13 +57,16 @@
private final Instance<PersistenceProvider> persistenceProvider;
+ private final Set<Annotation> qualifiers;
+
static final Logger log = LoggerFactory.getLogger(ManagedPersistenceContextProxyHandler.class);
- public PersistenceContextProxyHandler(EntityManager delegate, BeanManager beanManager)
+ public PersistenceContextProxyHandler(EntityManager delegate, BeanManager beanManager, Set<Annotation> qualifiers)
{
this.delegate = delegate;
expressionsInstance = InstanceResolver.getInstance(Expressions.class, beanManager);
persistenceProvider = InstanceResolver.getInstance(PersistenceProvider.class, beanManager);
+ this.qualifiers = new HashSet<Annotation>(qualifiers);
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
@@ -77,6 +84,10 @@
{
return EntityManager.class;
}
+ if ("getQualifiers".equals(method.getName()) && method.getParameterTypes().length == 0)
+ {
+ return Collections.unmodifiableSet(qualifiers);
+ }
return method.invoke(delegate, args);
}
Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContexts.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContexts.java 2010-08-09 10:58:31 UTC (rev 13581)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContexts.java 2010-08-09 11:28:07 UTC (rev 13582)
@@ -2,15 +2,11 @@
import java.util.Set;
-import javax.inject.Inject;
-
import org.jboss.seam.persistence.PersistenceContextsImpl.PersistenceContextDefintition;
import org.jboss.seam.persistence.transaction.FlushModeType;
public interface PersistenceContexts
{
-
- @Inject
public abstract void create(FlushModeManager manager);
public abstract FlushModeType getFlushMode();
More information about the seam-commits
mailing list