Seam SVN: r13680 - in branches/community/Seam_2_2: src/test/ftest/examples/dvdstore and 1 other directory.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-08-31 10:41:32 -0400 (Tue, 31 Aug 2010)
New Revision: 13680
Added:
branches/community/Seam_2_2/examples/dvdstore/build-jboss42.xml
Modified:
branches/community/Seam_2_2/examples/dvdstore/build.xml
branches/community/Seam_2_2/examples/dvdstore/readme.txt
branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/build.xml
Log:
JBSEAM-4560 added new ant target only for jboss 4.2.x
Added: branches/community/Seam_2_2/examples/dvdstore/build-jboss42.xml
===================================================================
--- branches/community/Seam_2_2/examples/dvdstore/build-jboss42.xml (rev 0)
+++ branches/community/Seam_2_2/examples/dvdstore/build-jboss42.xml 2010-08-31 14:41:32 UTC (rev 13680)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<project name="Blog" default="deploy" basedir=".">
+
+ <property name="han.lib" value="yes"/>
+
+ <import file="../build.xml"/>
+
+</project>
Property changes on: branches/community/Seam_2_2/examples/dvdstore/build-jboss42.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: branches/community/Seam_2_2/examples/dvdstore/build.xml
===================================================================
--- branches/community/Seam_2_2/examples/dvdstore/build.xml 2010-08-31 13:44:19 UTC (rev 13679)
+++ branches/community/Seam_2_2/examples/dvdstore/build.xml 2010-08-31 14:41:32 UTC (rev 13680)
@@ -36,5 +36,9 @@
<include name="*.jpdl.xml" />
<exclude name=".gpd.*.jpdl.xml" />
</fileset>
+
+ <target name="jboss42" description="Build the DvdStore example artifacts, and deploy to JBoss 4.2.x.GA">
+ <ant antfile="build-jboss42.xml"/>
+ </target>
</project>
Modified: branches/community/Seam_2_2/examples/dvdstore/readme.txt
===================================================================
--- branches/community/Seam_2_2/examples/dvdstore/readme.txt 2010-08-31 13:44:19 UTC (rev 13679)
+++ branches/community/Seam_2_2/examples/dvdstore/readme.txt 2010-08-31 14:41:32 UTC (rev 13680)
@@ -5,4 +5,6 @@
process management. It runs on JBoss AS as an EAR and Tomcat with Embedded
JBoss as a WAR.
+JBoss AS 4.2 needs additional hibernate libraries, use ant target jboss42 for deploying to it.
+
example.name=dvdstore
Modified: branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/build.xml 2010-08-31 13:44:19 UTC (rev 13679)
+++ branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/build.xml 2010-08-31 14:41:32 UTC (rev 13680)
@@ -23,7 +23,8 @@
<project name="dvdstore.ftest.build" basedir="." default="build">
<property name="example.name" value="dvdstore" />
<property name="example.homepage" value="/home" />
-
+ <property name="jboss4.deploy.target" value="jboss42" />
+
<import file="../build.xml" />
</project>
14 years, 2 months
Seam SVN: r13679 - modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-08-31 09:44:19 -0400 (Tue, 31 Aug 2010)
New Revision: 13679
Modified:
modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonAction.java
Log:
address changes should be cascaded
Modified: modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonAction.java
===================================================================
--- modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonAction.java 2010-08-31 13:40:20 UTC (rev 13678)
+++ modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonAction.java 2010-08-31 13:44:19 UTC (rev 13679)
@@ -46,10 +46,6 @@
else
{
person = entityManager.merge(person);
- for (Address address : person.getAddresses())
- {
- entityManager.merge(address);
- }
}
conversation.end();
14 years, 2 months
Seam SVN: r13678 - in modules/remoting/trunk: core and 5 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-08-31 09:40:20 -0400 (Tue, 31 Aug 2010)
New Revision: 13678
Added:
modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/EntityManagerProducer.java
Modified:
modules/remoting/trunk/core/pom.xml
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/Call.java
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/NonInjectionRemoting.java
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/wrapper/BagWrapper.java
modules/remoting/trunk/examples/model/pom.xml
modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonAction.java
modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonSearch.java
modules/remoting/trunk/pom.xml
Log:
fix compiler/deployment/runtime exceptions, code cleanup
Modified: modules/remoting/trunk/core/pom.xml
===================================================================
--- modules/remoting/trunk/core/pom.xml 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/core/pom.xml 2010-08-31 13:40:20 UTC (rev 13678)
@@ -20,6 +20,7 @@
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
Modified: modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/Call.java
===================================================================
--- modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/Call.java 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/Call.java 2010-08-31 13:40:20 UTC (rev 13678)
@@ -156,10 +156,9 @@
*
* @throws Exception
*/
- @SuppressWarnings("unchecked")
public void execute() throws Exception
{
- CreationalContext ctx = beanManager.createCreationalContext(targetBean);
+ CreationalContext<?> ctx = beanManager.createCreationalContext(targetBean);
// Get an instance of the component
Object instance = beanManager.getReference(targetBean, targetBean.getBeanClass(), ctx);;
Modified: modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java
===================================================================
--- modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/ExecutionHandler.java 2010-08-31 13:40:20 UTC (rev 13678)
@@ -18,7 +18,8 @@
import org.dom4j.io.SAXReader;
import org.jboss.seam.remoting.util.Strings;
import org.jboss.seam.remoting.wrapper.Wrapper;
-import org.jboss.weld.conversation.ConversationManager;
+import org.jboss.weld.conversation.ConversationManager2;
+import org.jboss.weld.servlet.BeanProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,7 +34,6 @@
private static final Logger log = LoggerFactory.getLogger(ExecutionHandler.class);
@Inject BeanManager beanManager;
- @Inject ConversationManager conversationManager;
@Inject Conversation conversation;
/**
@@ -69,10 +69,12 @@
final Element env = doc.getRootElement();
final RequestContext ctx = new RequestContext(env.element("header"));
+ ConversationManager2 conversationManager = BeanProvider.conversationManager(request.getServletContext());
+
if (ctx.getConversationId() != null && !Strings.isEmpty(ctx.getConversationId()))
{
// this is non portable ;/
- conversationManager.beginOrRestoreConversation(ctx.getConversationId());
+ conversationManager.setupConversation(ctx.getConversationId());
}
// Extract the calls from the request
@@ -82,7 +84,7 @@
// Store the conversation ID in the outgoing context
try
{
- ctx.setConversationId(conversation.getId());
+ ctx.setConversationId(conversation.isTransient() ? null : conversation.getId());
}
catch (ContextNotActiveException ex)
{
@@ -118,11 +120,10 @@
// First reconstruct all the references
Element refsNode = callElement.element("refs");
- Iterator iter = refsNode.elementIterator("ref");
+ Iterator<Element> iter = refsNode.elementIterator("ref");
while (iter.hasNext())
{
- call.getContext()
- .createWrapperFromElement((Element) iter.next());
+ call.getContext().createWrapperFromElement(iter.next());
}
// Now unmarshal the ref values
Modified: modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/NonInjectionRemoting.java
===================================================================
--- modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/NonInjectionRemoting.java 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/NonInjectionRemoting.java 2010-08-31 13:40:20 UTC (rev 13678)
@@ -13,7 +13,7 @@
import org.jboss.seam.remoting.model.ModelHandler;
import org.jboss.weld.Container;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.weld.exceptions.ForbiddenStateException;
+import org.jboss.weld.exceptions.IllegalStateException;
import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.servlet.api.ServletServices;
@@ -26,16 +26,17 @@
BeanDeploymentArchive war = Container.instance().services().get(ServletServices.class).getBeanDeploymentArchive(ctx);
if (war == null)
{
- throw new ForbiddenStateException(BEAN_DEPLOYMENT_ARCHIVE_MISSING, ctx);
+ throw new IllegalStateException(BEAN_DEPLOYMENT_ARCHIVE_MISSING, ctx);
}
BeanManagerImpl beanManager = Container.instance().beanDeploymentArchives().get(war);
if (beanManager == null)
{
- throw new ForbiddenStateException(BEAN_MANAGER_FOR_ARCHIVE_NOT_FOUND, ctx, war);
+ throw new IllegalStateException(BEAN_MANAGER_FOR_ARCHIVE_NOT_FOUND, ctx, war);
}
return beanManager;
}
+ @SuppressWarnings("unchecked")
@Override
protected ExecutionHandler getExecutionHandler()
{
@@ -45,6 +46,7 @@
return bean.create(beanManager.createCreationalContext(bean));
}
+ @SuppressWarnings("unchecked")
@Override
protected InterfaceGenerator getInterfaceHandler()
{
@@ -54,6 +56,7 @@
return bean.create(beanManager.createCreationalContext(bean));
}
+ @SuppressWarnings("unchecked")
@Override
protected ModelHandler getModelHandler()
{
Modified: modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java
===================================================================
--- modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java 2010-08-31 13:40:20 UTC (rev 13678)
@@ -29,11 +29,8 @@
import org.jboss.seam.remoting.wrapper.BeanWrapper;
import org.jboss.seam.remoting.wrapper.MapWrapper;
import org.jboss.seam.remoting.wrapper.Wrapper;
-import org.jboss.weld.Container;
-import org.jboss.weld.context.ContextLifecycle;
-import org.jboss.weld.context.ConversationContext;
-import org.jboss.weld.conversation.ConversationManager;
-import org.jboss.weld.servlet.ConversationBeanStore;
+import org.jboss.weld.conversation.ConversationManager2;
+import org.jboss.weld.servlet.BeanProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,7 +44,6 @@
private static final Logger log = LoggerFactory.getLogger(ModelHandler.class);
@Inject BeanManager beanManager;
- @Inject ConversationManager conversationManager;
@Inject ModelRegistry registry;
@Inject Conversation conversation;
@@ -74,75 +70,49 @@
final Element env = doc.getRootElement();
final RequestContext ctx = new RequestContext(env.element("header"));
- ConversationContext conversationContext = null;
- try
- {
- // Initialize the conversation context
- // TODO - this is non-portable, we should at least use the new ConversationManager API once Nik has
- // written it, and non-portable code should be abstracted out
- conversationContext = Container.instance().services().get(ContextLifecycle.class).getConversationContext();
-
- if (ctx.getConversationId() != null && !Strings.isEmpty(ctx.getConversationId()))
- {
- conversationContext.setBeanStore(new ConversationBeanStore(
- request.getSession(), false, ctx.getConversationId()));
- conversationContext.setActive(true);
- conversationManager.beginOrRestoreConversation(ctx.getConversationId());
- }
- else
+ ConversationManager2 conversationManager = BeanProvider.conversationManager(request.getServletContext());
+
+ if (ctx.getConversationId() != null && !Strings.isEmpty(ctx.getConversationId()))
+ {
+ conversationManager.setupConversation(ctx.getConversationId());
+ }
+
+ Element modelElement = env.element("body").element("model");
+ String operation = modelElement.attributeValue("operation");
+
+ if ("expand".equals(operation))
+ {
+ processExpandRequest(modelElement, ctx, response.getOutputStream());
+ }
+ else
+ {
+ Model model = null;
+ if ("fetch".equals(operation))
{
- conversationContext.setBeanStore(new ConversationBeanStore(
- request.getSession(), false,
- ((org.jboss.weld.conversation.ConversationImpl) conversation).getUnderlyingId()));
- conversationContext.setActive(true);
+ model = processFetchRequest(modelElement);
}
-
- Element modelElement = env.element("body").element("model");
- String operation = modelElement.attributeValue("operation");
-
- if ("expand".equals(operation))
+ else if ("apply".equals(operation))
{
- processExpandRequest(modelElement, ctx, response.getOutputStream());
+ model = processApplyRequest(modelElement);
}
- else
+
+ if (model.getAction() != null && model.getAction().getException() != null)
{
- Model model = null;
- if ("fetch".equals(operation))
- {
- model = processFetchRequest(modelElement);
- }
- else if ("apply".equals(operation))
- {
- model = processApplyRequest(modelElement);
- }
-
- if (model.getAction() != null && model.getAction().getException() != null)
- {
- response.getOutputStream().write(ENVELOPE_TAG_OPEN);
- response.getOutputStream().write(BODY_TAG_OPEN);
- MarshalUtils.marshalException(model.getAction().getException(),
- model.getAction().getContext(), response.getOutputStream());
- response.getOutputStream().write(BODY_TAG_CLOSE);
- response.getOutputStream().write(ENVELOPE_TAG_CLOSE);
- response.getOutputStream().flush();
- return;
- }
-
- model.evaluate();
-
- ctx.setConversationId(conversation.isTransient() ? null : conversation.getId());
- marshalResponse(model, ctx, response.getOutputStream());
+ response.getOutputStream().write(ENVELOPE_TAG_OPEN);
+ response.getOutputStream().write(BODY_TAG_OPEN);
+ MarshalUtils.marshalException(model.getAction().getException(),
+ model.getAction().getContext(), response.getOutputStream());
+ response.getOutputStream().write(BODY_TAG_CLOSE);
+ response.getOutputStream().write(ENVELOPE_TAG_CLOSE);
+ response.getOutputStream().flush();
+ return;
}
+
+ model.evaluate();
+
+ ctx.setConversationId(conversation.isTransient() ? null : conversation.getId());
+ marshalResponse(model, ctx, response.getOutputStream());
}
- finally
- {
- conversationManager.cleanupConversation();
- if (conversationContext != null)
- {
- conversationContext.setBeanStore(null);
- conversationContext.setActive(false);
- }
- }
}
@SuppressWarnings({ "unchecked" })
Modified: modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/wrapper/BagWrapper.java
===================================================================
--- modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/wrapper/BagWrapper.java 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/wrapper/BagWrapper.java 2010-08-31 13:40:20 UTC (rev 13678)
@@ -51,7 +51,7 @@
{
try
{
- Class cls = Class.forName("org.hibernate.collection.PersistentCollection");
+ Class<?> cls = Class.forName("org.hibernate.collection.PersistentCollection");
// Fix to prevent uninitialized lazy loading in Hibernate
if (cls.isInstance(value) && !loadLazy)
@@ -116,9 +116,9 @@
vals.add(context.createWrapperFromElement((Element) e.elements().get(0)));
}
- if (type instanceof Class && ((Class) type).isArray())
+ if (type instanceof Class && ((Class<?>) type).isArray())
{
- Class arrayType = ((Class) type).getComponentType();
+ Class<?> arrayType = ((Class<?>) type).getComponentType();
value = Array.newInstance(arrayType, vals.size()); // Fix this
for (int i = 0; i < vals.size(); i++)
{
@@ -126,11 +126,11 @@
}
}
else if (type instanceof Class &&
- Collection.class.isAssignableFrom((Class) type))
+ Collection.class.isAssignableFrom((Class<?>) type))
{
try
{
- value = getConcreteClass((Class) type).newInstance();
+ value = getConcreteClass((Class<?>) type).newInstance();
}
catch (Exception ex)
{
@@ -144,9 +144,9 @@
}
}
else if (type instanceof ParameterizedType &&
- Collection.class.isAssignableFrom((Class) ((ParameterizedType) type).getRawType()))
+ Collection.class.isAssignableFrom((Class<?>) ((ParameterizedType) type).getRawType()))
{
- Class rawType = (Class) ((ParameterizedType) type).getRawType();
+ Class<?> rawType = (Class<?>) ((ParameterizedType) type).getRawType();
Type genType = Object.class;
for (Type t : ((ParameterizedType) type).getActualTypeArguments())
Modified: modules/remoting/trunk/examples/model/pom.xml
===================================================================
--- modules/remoting/trunk/examples/model/pom.xml 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/examples/model/pom.xml 2010-08-31 13:40:20 UTC (rev 13678)
@@ -31,6 +31,24 @@
</dependency>
<dependency>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence-impl</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>junit</artifactId>
+ <groupId>junit</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<scope>provided</scope>
Added: modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/EntityManagerProducer.java
===================================================================
--- modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/EntityManagerProducer.java (rev 0)
+++ modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/EntityManagerProducer.java 2010-08-31 13:40:20 UTC (rev 13678)
@@ -0,0 +1,17 @@
+package org.jboss.seam.remoting.examples.model;
+
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+
+import org.jboss.seam.persistence.SeamManaged;
+
+public class EntityManagerProducer
+{
+ @PersistenceUnit
+ @ConversationScoped
+ @Produces
+ @SeamManaged
+ EntityManagerFactory emf;
+}
Modified: modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonAction.java
===================================================================
--- modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonAction.java 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonAction.java 2010-08-31 13:40:20 UTC (rev 13678)
@@ -7,16 +7,16 @@
import javax.enterprise.context.ConversationScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
+import org.jboss.seam.persistence.transaction.Transactional;
import org.jboss.seam.remoting.annotations.WebRemote;
-@ConversationScoped
-public class PersonAction implements Serializable
+
+public @ConversationScoped @Transactional class PersonAction implements Serializable
{
private static final long serialVersionUID = -1923705862231821692L;
- @PersistenceContext EntityManager entityManager;
+ @Inject EntityManager entityManager;
@Inject Conversation conversation;
private Person person;
@@ -46,6 +46,10 @@
else
{
person = entityManager.merge(person);
+ for (Address address : person.getAddresses())
+ {
+ entityManager.merge(address);
+ }
}
conversation.end();
Modified: modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonSearch.java
===================================================================
--- modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonSearch.java 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/PersonSearch.java 2010-08-31 13:40:20 UTC (rev 13678)
@@ -2,9 +2,9 @@
import java.util.List;
-import javax.inject.Named;
+import javax.enterprise.inject.Model;
+import javax.inject.Inject;
import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
import org.jboss.seam.remoting.annotations.WebRemote;
@@ -13,10 +13,9 @@
*
* @author Shane Bryzak
*/
-@Named("personSearch")
-public class PersonSearch
+public @Model class PersonSearch
{
- @PersistenceContext EntityManager entityManager;
+ @Inject EntityManager entityManager;
@WebRemote @SuppressWarnings("unchecked")
public List<Person> listPeople()
Modified: modules/remoting/trunk/pom.xml
===================================================================
--- modules/remoting/trunk/pom.xml 2010-08-31 12:53:46 UTC (rev 13677)
+++ modules/remoting/trunk/pom.xml 2010-08-31 13:40:20 UTC (rev 13678)
@@ -5,7 +5,7 @@
<parent>
<artifactId>seam-parent</artifactId>
<groupId>org.jboss.seam</groupId>
- <version>1</version>
+ <version>3-SNAPSHOT</version>
</parent>
<groupId>org.jboss.seam.remoting</groupId>
@@ -46,6 +46,12 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
14 years, 2 months
Seam SVN: r13677 - branches/enterprise/JBPAPP_5_0/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-08-31 08:53:46 -0400 (Tue, 31 Aug 2010)
New Revision: 13677
Modified:
branches/enterprise/JBPAPP_5_0/build/core.pom.xml
branches/enterprise/JBPAPP_5_0/build/root.pom.xml
Log:
JBPAPP-4970
Modified: branches/enterprise/JBPAPP_5_0/build/core.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/core.pom.xml 2010-08-31 11:42:04 UTC (rev 13676)
+++ branches/enterprise/JBPAPP_5_0/build/core.pom.xml 2010-08-31 12:53:46 UTC (rev 13677)
@@ -300,12 +300,6 @@
<artifactId>concurrent</artifactId>
<optional>true</optional>
</dependency>
-
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <optional>true</optional>
- </dependency>
<dependency>
<groupId>org.jboss</groupId>
Modified: branches/enterprise/JBPAPP_5_0/build/root.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2010-08-31 11:42:04 UTC (rev 13676)
+++ branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2010-08-31 12:53:46 UTC (rev 13677)
@@ -397,6 +397,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </exclusion>
</exclusions>
</dependency>
@@ -421,6 +425,10 @@
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </exclusion>
</exclusions>
</dependency>
@@ -449,6 +457,10 @@
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </exclusion>
</exclusions>
</dependency>
@@ -1203,12 +1215,6 @@
</dependency>
<dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.8.0.8.patch03-brew</version>
- </dependency>
-
- <dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>common</artifactId>
<version>3.2.0-v20060603</version>
14 years, 2 months
Seam SVN: r13676 - branches/enterprise/JBPAPP_5_0/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-08-31 07:42:04 -0400 (Tue, 31 Aug 2010)
New Revision: 13676
Modified:
branches/enterprise/JBPAPP_5_0/build/root.pom.xml
Log:
JBPAPP-4970 - added exclusion of hsqldb
Modified: branches/enterprise/JBPAPP_5_0/build/root.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2010-08-31 11:01:04 UTC (rev 13675)
+++ branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2010-08-31 11:42:04 UTC (rev 13676)
@@ -369,6 +369,10 @@
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </exclusion>
</exclusions>
</dependency>
14 years, 2 months
Seam SVN: r13675 - in modules/xml/trunk: impl/src/main/java/org/jboss/seam/xml/core and 1 other directories.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-08-31 07:01:04 -0400 (Tue, 31 Aug 2010)
New Revision: 13675
Modified:
modules/xml/trunk/examples/princess-rescue/readme.txt
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/VirtualProducerField.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/XmlId.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
Log:
minor
Modified: modules/xml/trunk/examples/princess-rescue/readme.txt
===================================================================
--- modules/xml/trunk/examples/princess-rescue/readme.txt 2010-08-31 10:55:58 UTC (rev 13674)
+++ modules/xml/trunk/examples/princess-rescue/readme.txt 2010-08-31 11:01:04 UTC (rev 13675)
@@ -1,7 +1,15 @@
-To run the example:
+To run the example with embedded jetty:
mvn jetty:run
Then navigate to:
-http://localhost:9090/princess-rescue/home.jsf
\ No newline at end of file
+http://localhost:9090/princess-rescue/home.jsf
+
+To run the exmaple using embbeded tomcat:
+
+mvn tomcat:run
+
+Then navigate to:
+
+http://localhost:6060/princess-rescue/home.jsf
\ No newline at end of file
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/VirtualProducerField.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/VirtualProducerField.java 2010-08-31 10:55:58 UTC (rev 13674)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/VirtualProducerField.java 2010-08-31 11:01:04 UTC (rev 13675)
@@ -22,7 +22,7 @@
package org.jboss.seam.xml.core;
/**
- * This class used to reigister virtual producer fields
+ * The class used to register virtual producer fields
*
* @author stuart
*
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/XmlId.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/XmlId.java 2010-08-31 10:55:58 UTC (rev 13674)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/XmlId.java 2010-08-31 11:01:04 UTC (rev 13675)
@@ -27,8 +27,6 @@
/**
* Annotation that allows tracing of annotated types through the startup process
*
- * TODO: This approach currently breaks replication as the id's are non
- * deterministic
*
* @author stuart
*
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-08-31 10:55:58 UTC (rev 13674)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-08-31 11:01:04 UTC (rev 13675)
@@ -223,6 +223,12 @@
return result;
}
+ /**
+ * Builds up a bean result for a virtual producer field.
+ *
+ * @param manager
+ * @return
+ */
public BeanResult<?> createVirtualFieldBeanResult(BeanManager manager)
{
boolean override = !getChildrenOfType(ReplacesXmlItem.class).isEmpty();
14 years, 2 months
Seam SVN: r13674 - modules/xml/trunk/docs/src/main/docbook/en-US.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-08-31 06:55:58 -0400 (Tue, 31 Aug 2010)
New Revision: 13674
Modified:
modules/xml/trunk/docs/src/main/docbook/en-US/xml-general.xml
Log:
add section on virtual producer fields
Modified: modules/xml/trunk/docs/src/main/docbook/en-US/xml-general.xml
===================================================================
--- modules/xml/trunk/docs/src/main/docbook/en-US/xml-general.xml 2010-08-31 08:50:05 UTC (rev 13673)
+++ modules/xml/trunk/docs/src/main/docbook/en-US/xml-general.xml 2010-08-31 10:55:58 UTC (rev 13674)
@@ -521,6 +521,54 @@
</section>
<section>
+ <title>Virtual Producer Fields</title>
+ <para>
+ Seam XML supports configuration of virtual producer fields. These allow for configuration
+ of resource producer fields, Weld Extensions generic bean and constant values directly via
+ XML. First an exmaple:
+ </para>
+<programlisting role="XML" >
+<![CDATA[
+<s:EntityManager>
+ <s:Produces/>
+ <sPersistenceContext unitName="customerPu" />
+</s:EntityManager>
+
+<s:String>
+ <s:Produces/>
+ <my:VersionQualifier />
+ <value>Version 1.23</value>
+</s:String>
+]]>
+</programlisting>
+ <para>
+ The first example configures a resource producer field. The second configures a bean
+ of type String, with the qualifier <literal>@VersionQualifier</literal> and the value
+ <literal>'Version 1.23'</literal>. The corresponding java for the above XML is:
+ </para>
+<programlisting role="java" >
+<![CDATA[
+public class SomeClass
+{
+
+ @Produces
+ @PersistenceContext(unitName="customerPu")
+ EntityManager field1;
+
+ @Produces
+ @VersionQualifier
+ String field2 = "Version 1.23";
+
+}
+]]>
+</programlisting>
+ <para>
+ Although these look superficially like normal bean declarations, the <literal><Produces></literal>
+ declaration means it is treated as a producer field instead of a normal bean.
+ </para>
+ </section>
+
+ <section>
<title>More Information</title>
<para>For further information look at the units tests in the seam-xml distribution, also the
JSR-299 Public Review Draft section on XML Configuration was the base for this extension,
14 years, 2 months
Seam SVN: r13673 - in modules/persistence/trunk/impl/src: test/java/org/jboss/seam/persistence/test and 1 other directory.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-08-31 04:50:05 -0400 (Tue, 31 Aug 2010)
New Revision: 13673
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/PersistenceContextProxyHandler.java
modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/HibernateSearchTest.java
modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextELTest.java
modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTest.java
modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextTest.java
Log:
refactor SMPC proxy handler
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-31 08:44:47 UTC (rev 13672)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-08-31 08:50:05 UTC (rev 13673)
@@ -25,6 +25,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
+import java.util.Collections;
import java.util.Set;
import javax.enterprise.context.ContextNotActiveException;
@@ -34,6 +35,7 @@
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
+import org.jboss.seam.persistence.transaction.FlushModeType;
import org.jboss.seam.persistence.transaction.SeamTransaction;
import org.jboss.seam.persistence.transaction.literal.DefaultTransactionLiteral;
import org.jboss.seam.persistence.util.InstanceResolver;
@@ -61,13 +63,19 @@
private final PersistenceContexts persistenceContexts;
+ private final Set<Annotation> qualifiers;
+
+ private final SeamPersistenceProvider provider;
+
private boolean persistenceContextsTouched = false;
static final Logger log = LoggerFactory.getLogger(ManagedPersistenceContextProxyHandler.class);
public ManagedPersistenceContextProxyHandler(EntityManager delegate, BeanManager beanManager, Set<Annotation> qualifiers, PersistenceContexts persistenceContexts, SeamPersistenceProvider provider)
{
- super(delegate, beanManager, qualifiers, provider);
+ super(delegate, beanManager);
+ this.qualifiers = qualifiers;
+ this.provider = provider;
this.delegate = delegate;
this.userTransactionInstance = InstanceResolver.getInstance(SeamTransaction.class, beanManager, DefaultTransactionLiteral.INSTANCE);
this.persistenceContexts = persistenceContexts;
@@ -80,6 +88,23 @@
joinTransaction();
}
touch((ManagedPersistenceContext) proxy);
+ if ("changeFlushMode".equals(method.getName()) && method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(FlushModeType.class))
+ {
+ changeFushMode((FlushModeType) args[0]);
+ return null;
+ }
+ if ("getBeanType".equals(method.getName()) && method.getParameterTypes().length == 0)
+ {
+ return EntityManager.class;
+ }
+ if ("getQualifiers".equals(method.getName()) && method.getParameterTypes().length == 0)
+ {
+ return Collections.unmodifiableSet(qualifiers);
+ }
+ if ("getPersistenceProvider".equals(method.getName()) && method.getParameterTypes().length == 0)
+ {
+ return provider;
+ }
return super.invoke(proxy, method, args);
}
@@ -104,6 +129,11 @@
}
}
+ private void changeFushMode(FlushModeType flushModeType)
+ {
+ provider.setFlushMode(delegate, flushModeType);
+ }
+
void touch(ManagedPersistenceContext delegate)
{
if (!persistenceContextsTouched)
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-31 08:44:47 UTC (rev 13672)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextProxyHandler.java 2010-08-31 08:50:05 UTC (rev 13673)
@@ -22,18 +22,13 @@
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;
import javax.persistence.EntityManager;
import javax.persistence.Query;
-import org.jboss.seam.persistence.transaction.FlushModeType;
import org.jboss.seam.persistence.util.InstanceResolver;
import org.jboss.weld.extensions.el.Expressions;
import org.slf4j.Logger;
@@ -55,21 +50,12 @@
private final Instance<Expressions> expressionsInstance;
- private final Instance<DefaultPersistenceProvider> persistenceProvider;
-
- private final Set<Annotation> qualifiers;
-
- private final SeamPersistenceProvider provider;
-
static final Logger log = LoggerFactory.getLogger(ManagedPersistenceContextProxyHandler.class);
- public PersistenceContextProxyHandler(EntityManager delegate, BeanManager beanManager, Set<Annotation> qualifiers, SeamPersistenceProvider provider)
+ public PersistenceContextProxyHandler(EntityManager delegate, BeanManager beanManager)
{
this.delegate = delegate;
- this.provider = provider;
expressionsInstance = InstanceResolver.getInstance(Expressions.class, beanManager);
- persistenceProvider = InstanceResolver.getInstance(DefaultPersistenceProvider.class, beanManager);
- this.qualifiers = new HashSet<Annotation>(qualifiers);
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
@@ -78,31 +64,10 @@
{
return handleCreateQueryWithString(method, args);
}
- if ("changeFlushMode".equals(method.getName()) && method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(FlushModeType.class))
- {
- changeFushMode((FlushModeType) args[0]);
- return null;
- }
- if ("getBeanType".equals(method.getName()) && method.getParameterTypes().length == 0)
- {
- return EntityManager.class;
- }
- if ("getQualifiers".equals(method.getName()) && method.getParameterTypes().length == 0)
- {
- return Collections.unmodifiableSet(qualifiers);
- }
- if ("getPersistenceProvider".equals(method.getName()) && method.getParameterTypes().length == 0)
- {
- return provider;
- }
+
return method.invoke(delegate, args);
}
- private void changeFushMode(FlushModeType flushModeType)
- {
- persistenceProvider.get().setFlushMode(delegate, flushModeType);
- }
-
protected Object handleCreateQueryWithString(Method method, Object[] args) throws Throwable
{
if (args[0] == null)
Modified: modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/HibernateSearchTest.java
===================================================================
--- modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/HibernateSearchTest.java 2010-08-31 08:44:47 UTC (rev 13672)
+++ modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/HibernateSearchTest.java 2010-08-31 08:50:05 UTC (rev 13673)
@@ -34,7 +34,7 @@
import org.hibernate.search.jpa.FullTextEntityManager;
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.persistence.PersistenceContextExtension;
+import org.jboss.seam.persistence.SePersistenceContextExtension;
import org.jboss.seam.persistence.transaction.DefaultTransaction;
import org.jboss.seam.persistence.transaction.SeamTransaction;
import org.jboss.seam.persistence.transaction.TransactionExtension;
@@ -66,7 +66,7 @@
war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.LUCENE_ANALYZERS));
war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.LUCENE_CORE));
war.addPackage(TransactionExtension.class.getPackage());
- war.addPackage(PersistenceContextExtension.class.getPackage());
+ war.addPackage(SePersistenceContextExtension.class.getPackage());
war.addPackage(TransactionScopeExtension.class.getPackage());
war.addPackage(NamingUtils.class.getPackage());
war.addClasses(HibernateSearchTest.class, IndexedHotel.class, ManagedPersistenceContextProvider.class, HelloService.class);
Modified: modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextELTest.java
===================================================================
--- modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextELTest.java 2010-08-31 08:44:47 UTC (rev 13672)
+++ modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextELTest.java 2010-08-31 08:50:05 UTC (rev 13673)
@@ -31,7 +31,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.persistence.PersistenceContextExtension;
+import org.jboss.seam.persistence.SePersistenceContextExtension;
import org.jboss.seam.persistence.transaction.DefaultTransaction;
import org.jboss.seam.persistence.transaction.SeamTransaction;
import org.jboss.seam.persistence.transaction.TransactionExtension;
@@ -60,7 +60,7 @@
war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
war.addPackage(TransactionExtension.class.getPackage());
- war.addPackage(PersistenceContextExtension.class.getPackage());
+ war.addPackage(SePersistenceContextExtension.class.getPackage());
war.addPackage(TransactionExtension.class.getPackage());
war.addPackage(TransactionScopeExtension.class.getPackage());
war.addPackage(NamingUtils.class.getPackage());
Modified: modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTest.java
===================================================================
--- modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTest.java 2010-08-31 08:44:47 UTC (rev 13672)
+++ modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTest.java 2010-08-31 08:50:05 UTC (rev 13673)
@@ -38,7 +38,7 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.persistence.FlushModeManager;
import org.jboss.seam.persistence.ManagedPersistenceContext;
-import org.jboss.seam.persistence.PersistenceContextExtension;
+import org.jboss.seam.persistence.SePersistenceContextExtension;
import org.jboss.seam.persistence.PersistenceContexts;
import org.jboss.seam.persistence.transaction.FlushModeType;
import org.jboss.seam.persistence.transaction.TransactionExtension;
@@ -66,7 +66,7 @@
war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
war.addPackage(TransactionExtension.class.getPackage());
- war.addPackage(PersistenceContextExtension.class.getPackage());
+ war.addPackage(SePersistenceContextExtension.class.getPackage());
war.addPackage(TransactionScopeExtension.class.getPackage());
war.addPackage(NamingUtils.class.getPackage());
war.addClasses(ManagedPersistenceContextFlushModeTest.class, Hotel.class, ManagedPersistenceContextProvider.class, HelloService.class);
Modified: modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextTest.java
===================================================================
--- modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextTest.java 2010-08-31 08:44:47 UTC (rev 13672)
+++ modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextTest.java 2010-08-31 08:50:05 UTC (rev 13673)
@@ -35,7 +35,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.persistence.PersistenceContextExtension;
+import org.jboss.seam.persistence.SePersistenceContextExtension;
import org.jboss.seam.persistence.transaction.DefaultTransaction;
import org.jboss.seam.persistence.transaction.SeamTransaction;
import org.jboss.seam.persistence.transaction.TransactionExtension;
@@ -63,7 +63,7 @@
war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.WELD_EXTENSIONS));
war.addLibraries(MavenArtifactResolver.resolve(ArtifactNames.SEAM_PERSISTENCE_API));
war.addPackage(TransactionExtension.class.getPackage());
- war.addPackage(PersistenceContextExtension.class.getPackage());
+ war.addPackage(SePersistenceContextExtension.class.getPackage());
war.addPackage(TransactionScopeExtension.class.getPackage());
war.addPackage(NamingUtils.class.getPackage());
war.addClasses(ManagedPersistenceContextTest.class, Hotel.class, ManagedPersistenceContextProvider.class, HelloService.class);
14 years, 2 months
Seam SVN: r13672 - in modules/persistence/trunk/impl/src/main: resources/META-INF/services and 1 other directory.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-08-31 04:44:47 -0400 (Tue, 31 Aug 2010)
New Revision: 13672
Added:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/SePersistenceContextExtension.java
Removed:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextExtension.java
Modified:
modules/persistence/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
Log:
rename PersistenceContextExtension
Deleted: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextExtension.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextExtension.java 2010-08-31 08:14:15 UTC (rev 13671)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextExtension.java 2010-08-31 08:44:47 UTC (rev 13672)
@@ -1,245 +0,0 @@
-/*
- * 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.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.Alternative;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.ProcessProducer;
-import javax.enterprise.inject.spi.Producer;
-import javax.inject.Qualifier;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.seam.persistence.util.EnvironmentUtils;
-import org.jboss.weld.extensions.literal.AnyLiteral;
-import org.jboss.weld.extensions.literal.DefaultLiteral;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Support for managed persistence contexts in a Java SE environment or Servlet
- * container.
- *
- * <p>
- * Unlike with standard Java EE, the unitName attribute on
- * {@link PersistenceContext} must be provided if the persistence unit is
- * assigned a name in persistence.xml. This class supports multiple persistence
- * units, but it does not permit multiple producers for the same persistence
- * unit (naturally).
- * </p>
- *
- * @author Gavin King
- * @author Dan Allen
- */
-public class PersistenceContextExtension implements Extension
-{
- private static final Logger log = LoggerFactory.getLogger(PersistenceContextExtension.class);
-
- private Map<String, Bean<EntityManagerFactory>> emfBeans = new HashMap<String, Bean<EntityManagerFactory>>();
-
- private Boolean bootstrapRequired;
-
- /**
- * For @PersistenceContext producer fields, make a bean for the EMF, then
- * wrap the producer CDI creates, to get the EM from the EMF bean we made
- * instead of trying to get it from the Java EE component environment.
- */
- void processProducer(@Observes ProcessProducer<?, EntityManager> pp, final BeanManager bm)
- {
- if (Boolean.FALSE.equals(bootstrapRequired))
- {
- return;
- }
- else if (bootstrapRequired == null)
- {
- if (EnvironmentUtils.isEEEnvironment())
- {
- bootstrapRequired = false;
- return;
- }
- else
- {
- bootstrapRequired = true;
- log.info("Java SE persistence bootstrap required");
- }
- }
-
- if (pp.getAnnotatedMember().isAnnotationPresent(PersistenceContext.class))
- {
- AnnotatedField<?> field = (AnnotatedField<?>) pp.getAnnotatedMember();
- final String unitName = field.getAnnotation(PersistenceContext.class).unitName();
- if (!emfBeans.containsKey(unitName))
- {
- log.info("Found persistence context producer for persistence unit: " + unitName);
- final Class<?> module = field.getJavaMember().getDeclaringClass();
- final Set<Annotation> qualifiers = new HashSet<Annotation>();
- for (Annotation ann : field.getAnnotations())
- {
- Class<? extends Annotation> annotationType = ann.annotationType();
- // if ( bm.isQualifier(annotationType)) {
- if (annotationType.isAnnotationPresent(Qualifier.class))
- { // work around bug in Weld
- qualifiers.add(ann);
- }
- }
- if (qualifiers.isEmpty())
- {
- qualifiers.add(DefaultLiteral.INSTANCE);
- }
- qualifiers.add(AnyLiteral.INSTANCE);
- final boolean alternative = field.isAnnotationPresent(Alternative.class);
- final Set<Type> types = new HashSet<Type>()
- {
- /** default value. Added only to suppress compiler warnings. */
- private static final long serialVersionUID = 1L;
- {
- add(EntityManagerFactory.class);
- add(Object.class);
- }
- };
-
- // create and register a bean for the EMF
- emfBeans.put(unitName, new Bean<EntityManagerFactory>()
- {
- public Set<Type> getTypes()
- {
- return types;
- }
-
- public Class<? extends Annotation> getScope()
- {
- return ApplicationScoped.class;
- }
-
- public EntityManagerFactory create(CreationalContext<EntityManagerFactory> ctx)
- {
- return Persistence.createEntityManagerFactory(unitName);
- }
-
- public void destroy(EntityManagerFactory emf, CreationalContext<EntityManagerFactory> ctx)
- {
- emf.close();
- ctx.release();
- }
-
- public Class<?> getBeanClass()
- {
- return module;
- }
-
- public Set<InjectionPoint> getInjectionPoints()
- {
- return Collections.emptySet();
- }
-
- public String getName()
- {
- return null;
- }
-
- public Set<Annotation> getQualifiers()
- {
- return qualifiers;
- }
-
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return Collections.emptySet();
-
- }
-
- public boolean isAlternative()
- {
- return alternative;
- }
-
- public boolean isNullable()
- {
- return false;
- }
- });
-
- }
- else
- {
- throw new RuntimeException("There can only be one producer per persistence unit");
- }
-
- Producer<EntityManager> producer = new Producer<EntityManager>()
- {
- public Set<InjectionPoint> getInjectionPoints()
- {
- return Collections.emptySet();
- }
-
- public EntityManager produce(CreationalContext<EntityManager> ctx)
- {
- return getFactory(ctx).createEntityManager();
- }
-
- private EntityManagerFactory getFactory(CreationalContext<EntityManager> ctx)
- {
- return (EntityManagerFactory) bm.getReference(emfBeans.get(unitName), EntityManagerFactory.class, ctx);
- }
-
- public void dispose(EntityManager em)
- {
- if (em.isOpen()) // work around what I suspect is a bug in Weld
- {
- em.close();
- }
- }
- };
- pp.setProducer(producer);
- }
- }
-
- /**
- * Register the EMF bean with the container.
- */
- void afterBeanDiscovery(@Observes AfterBeanDiscovery abd)
- {
- for (Bean<EntityManagerFactory> emfBean : emfBeans.values())
- {
- abd.addBean(emfBean);
- }
- }
-
-}
Copied: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/SePersistenceContextExtension.java (from rev 13642, modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/PersistenceContextExtension.java)
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/SePersistenceContextExtension.java (rev 0)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/SePersistenceContextExtension.java 2010-08-31 08:44:47 UTC (rev 13672)
@@ -0,0 +1,245 @@
+/*
+ * 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.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.Producer;
+import javax.inject.Qualifier;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.persistence.util.EnvironmentUtils;
+import org.jboss.weld.extensions.literal.AnyLiteral;
+import org.jboss.weld.extensions.literal.DefaultLiteral;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Support for managed persistence contexts in a Java SE environment or Servlet
+ * container.
+ *
+ * <p>
+ * Unlike with standard Java EE, the unitName attribute on
+ * {@link PersistenceContext} must be provided if the persistence unit is
+ * assigned a name in persistence.xml. This class supports multiple persistence
+ * units, but it does not permit multiple producers for the same persistence
+ * unit (naturally).
+ * </p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public class SePersistenceContextExtension implements Extension
+{
+ private static final Logger log = LoggerFactory.getLogger(SePersistenceContextExtension.class);
+
+ private Map<String, Bean<EntityManagerFactory>> emfBeans = new HashMap<String, Bean<EntityManagerFactory>>();
+
+ private Boolean bootstrapRequired;
+
+ /**
+ * For @PersistenceContext producer fields, make a bean for the EMF, then
+ * wrap the producer CDI creates, to get the EM from the EMF bean we made
+ * instead of trying to get it from the Java EE component environment.
+ */
+ void processProducer(@Observes ProcessProducer<?, EntityManager> pp, final BeanManager bm)
+ {
+ if (Boolean.FALSE.equals(bootstrapRequired))
+ {
+ return;
+ }
+ else if (bootstrapRequired == null)
+ {
+ if (EnvironmentUtils.isEEEnvironment())
+ {
+ bootstrapRequired = false;
+ return;
+ }
+ else
+ {
+ bootstrapRequired = true;
+ log.info("Java SE persistence bootstrap required");
+ }
+ }
+
+ if (pp.getAnnotatedMember().isAnnotationPresent(PersistenceContext.class))
+ {
+ AnnotatedField<?> field = (AnnotatedField<?>) pp.getAnnotatedMember();
+ final String unitName = field.getAnnotation(PersistenceContext.class).unitName();
+ if (!emfBeans.containsKey(unitName))
+ {
+ log.info("Found persistence context producer for persistence unit: " + unitName);
+ final Class<?> module = field.getJavaMember().getDeclaringClass();
+ final Set<Annotation> qualifiers = new HashSet<Annotation>();
+ for (Annotation ann : field.getAnnotations())
+ {
+ Class<? extends Annotation> annotationType = ann.annotationType();
+ // if ( bm.isQualifier(annotationType)) {
+ if (annotationType.isAnnotationPresent(Qualifier.class))
+ { // work around bug in Weld
+ qualifiers.add(ann);
+ }
+ }
+ if (qualifiers.isEmpty())
+ {
+ qualifiers.add(DefaultLiteral.INSTANCE);
+ }
+ qualifiers.add(AnyLiteral.INSTANCE);
+ final boolean alternative = field.isAnnotationPresent(Alternative.class);
+ final Set<Type> types = new HashSet<Type>()
+ {
+ /** default value. Added only to suppress compiler warnings. */
+ private static final long serialVersionUID = 1L;
+ {
+ add(EntityManagerFactory.class);
+ add(Object.class);
+ }
+ };
+
+ // create and register a bean for the EMF
+ emfBeans.put(unitName, new Bean<EntityManagerFactory>()
+ {
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ public Class<? extends Annotation> getScope()
+ {
+ return ApplicationScoped.class;
+ }
+
+ public EntityManagerFactory create(CreationalContext<EntityManagerFactory> ctx)
+ {
+ return Persistence.createEntityManagerFactory(unitName);
+ }
+
+ public void destroy(EntityManagerFactory emf, CreationalContext<EntityManagerFactory> ctx)
+ {
+ emf.close();
+ ctx.release();
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return module;
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+
+ }
+
+ public boolean isAlternative()
+ {
+ return alternative;
+ }
+
+ public boolean isNullable()
+ {
+ return false;
+ }
+ });
+
+ }
+ else
+ {
+ throw new RuntimeException("There can only be one producer per persistence unit");
+ }
+
+ Producer<EntityManager> producer = new Producer<EntityManager>()
+ {
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ public EntityManager produce(CreationalContext<EntityManager> ctx)
+ {
+ return getFactory(ctx).createEntityManager();
+ }
+
+ private EntityManagerFactory getFactory(CreationalContext<EntityManager> ctx)
+ {
+ return (EntityManagerFactory) bm.getReference(emfBeans.get(unitName), EntityManagerFactory.class, ctx);
+ }
+
+ public void dispose(EntityManager em)
+ {
+ if (em.isOpen()) // work around what I suspect is a bug in Weld
+ {
+ em.close();
+ }
+ }
+ };
+ pp.setProducer(producer);
+ }
+ }
+
+ /**
+ * Register the EMF bean with the container.
+ */
+ void afterBeanDiscovery(@Observes AfterBeanDiscovery abd)
+ {
+ for (Bean<EntityManagerFactory> emfBean : emfBeans.values())
+ {
+ abd.addBean(emfBean);
+ }
+ }
+
+}
Modified: modules/persistence/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
===================================================================
--- modules/persistence/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension 2010-08-31 08:14:15 UTC (rev 13671)
+++ modules/persistence/trunk/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension 2010-08-31 08:44:47 UTC (rev 13672)
@@ -1,4 +1,4 @@
-org.jboss.seam.persistence.PersistenceContextExtension
+org.jboss.seam.persistence.SePersistenceContextExtension
org.jboss.seam.persistence.transaction.TransactionExtension
org.jboss.seam.persistence.transaction.scope.TransactionScopeExtension
org.jboss.seam.persistence.ManagedPersistenceContextExtension
\ No newline at end of file
14 years, 2 months