[weld-commits] Weld SVN: r4193 - in core/trunk: impl and 7 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Mon Oct 19 09:14:15 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-10-19 09:14:13 -0400 (Mon, 19 Oct 2009)
New Revision: 4193

Modified:
   core/trunk/
   core/trunk/impl/pom.xml
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java
   core/trunk/impl/src/main/java/org/jboss/weld/conversation/AbstractConversationManager.java
   core/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java
   core/trunk/impl/src/main/java/org/jboss/weld/jsf/ConversationAwareViewHandler.java
   core/trunk/impl/src/main/java/org/jboss/weld/resolution/NewResolvableTransformer.java
   core/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationPropagationFilter.java
   core/trunk/jboss-tck-runner/
   core/trunk/jboss-tck-runner/src/test/resources/log4j.xml
Log:
remove conversation.isLongRunning, support @New(Foo)


Property changes on: core/trunk
___________________________________________________________________
Name: svn:ignore
   - 
target

.settings

.project

.classpath

bin

pom.xml.releaseBackup


release.properties

   + target

.project

.settings

pom.xml.releaseBackup

bin 


Modified: core/trunk/impl/pom.xml
===================================================================
--- core/trunk/impl/pom.xml	2009-10-19 07:41:09 UTC (rev 4192)
+++ core/trunk/impl/pom.xml	2009-10-19 13:14:13 UTC (rev 4193)
@@ -99,16 +99,12 @@
      <dependency>
        <groupId>org.jboss.interceptor</groupId>
        <artifactId>jboss-interceptor-api</artifactId>
-       <!-- WELD-198  -->
-<!--       <optional>true</optional>-->
      </dependency>
 
 
      <dependency>
        <groupId>org.jboss.interceptor</groupId>
        <artifactId>jboss-interceptor</artifactId>
-       <!-- WELD-198 -->
-<!--       <optional>true</optional>-->
      </dependency>
 
    </dependencies>

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java	2009-10-19 07:41:09 UTC (rev 4192)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java	2009-10-19 13:14:13 UTC (rev 4193)
@@ -26,6 +26,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.enterprise.inject.New;
+
 import org.jboss.weld.BeanManagerImpl;
 import org.jboss.weld.bean.AbstractBean;
 import org.jboss.weld.bean.AbstractClassBean;
@@ -214,16 +216,30 @@
    {
       for (WeldInjectionPoint<?, ?> injectionPoint : newInjectionPoints)
       {
-         if (getEjbDescriptors().contains(injectionPoint.getJavaClass()))
+         New _new = injectionPoint.getAnnotation(New.class);
+         if (_new.value().equals(New.class))
          {
-            newSessionBeanDescriptors.add(getEjbDescriptors().getUnique(injectionPoint.getJavaClass()));
+            addNewBeanFromInjecitonPoint(injectionPoint.getJavaClass(), injectionPoint.getBaseType());
          }
          else
          {
-            newManagedBeanClasses.add(classTransformer.loadClass(injectionPoint.getJavaClass(), injectionPoint.getBaseType()));
+            addNewBeanFromInjecitonPoint(_new.value(), _new.value());
          }
+         
       }
    }
+   
+   private void addNewBeanFromInjecitonPoint(Class<?> rawType, Type baseType)
+   {
+      if (getEjbDescriptors().contains(rawType))
+      {
+         newSessionBeanDescriptors.add(getEjbDescriptors().getUnique(rawType));
+      }
+      else
+      {
+         newManagedBeanClasses.add(classTransformer.loadClass(rawType, baseType));
+      }
+   }
 
    public Set<? extends RIBean<?>> getBeans()
    {

Modified: core/trunk/impl/src/main/java/org/jboss/weld/conversation/AbstractConversationManager.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/conversation/AbstractConversationManager.java	2009-10-19 07:41:09 UTC (rev 4192)
+++ core/trunk/impl/src/main/java/org/jboss/weld/conversation/AbstractConversationManager.java	2009-10-19 13:14:13 UTC (rev 4193)
@@ -130,7 +130,7 @@
    {
       log.trace("Cleaning up conversation for " + currentConversation);
       String cid = currentConversation.getUnderlyingId();
-      if (currentConversation.isLongRunning())
+      if (!currentConversation.isTransient())
       {
          Future<?> terminationHandle = scheduleForTermination(cid, currentConversation.getTimeout());
          // When the conversation ends, a long-running conversation needs to

Modified: core/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java	2009-10-19 07:41:09 UTC (rev 4192)
+++ core/trunk/impl/src/main/java/org/jboss/weld/conversation/ConversationImpl.java	2009-10-19 13:14:13 UTC (rev 4193)
@@ -51,7 +51,7 @@
    // The original conversation ID (if any)
    private String originalId;
    // Is the conversation long-running?
-   private boolean longRunning;
+   private boolean _transient = true;
    // The timeout in milliseconds
    private long timeout;
 
@@ -70,7 +70,7 @@
    public ConversationImpl(ConversationImpl conversation)
    {
       this.id = conversation.getUnderlyingId();
-      this.longRunning = conversation.isLongRunning();
+      this._transient = conversation.isTransient();
       this.timeout = conversation.getTimeout();
    }
 
@@ -85,18 +85,18 @@
    {
       this.id = conversationIdGenerator.nextId();
       this.timeout = timeout;
-      this.longRunning = false;
+      this._transient = true;
       log.debug("Created a new conversation " + this);
    }
 
    public void begin()
    {
-      if (isLongRunning())
+      if (!isTransient())
       {
          throw new IllegalStateException("Attempt to call begin() on a long-running conversation");
       }
       log.debug("Promoted conversation " + id + " to long-running");
-      longRunning = true;
+      this._transient = false;
    }
 
    public void begin(String id)
@@ -115,17 +115,17 @@
 
    public void end()
    {
-      if (!isLongRunning())
+      if (isTransient())
       {
          throw new IllegalStateException("Attempt to call end() on a transient conversation");
       }
       log.debug("Demoted conversation " + id + " to transient");
-      this.longRunning = false;
+      this._transient = true;
    }
 
    public String getId()
    {
-      if (isLongRunning())
+      if (!isTransient())
       {
          return id;
       }
@@ -151,11 +151,6 @@
       return timeout;
    }
 
-   public boolean isLongRunning()
-   {
-      return longRunning;
-   }
-
    public void setTimeout(long timeout)
    {
       this.timeout = timeout;
@@ -171,7 +166,7 @@
    {
       log.debug("Switched conversation from " + this);
       id = conversation.getUnderlyingId();
-      longRunning = conversation.isLongRunning();
+      this._transient = conversation.isTransient();
       timeout = conversation.getTimeout();
       log.debug(" to " + this);
    }
@@ -179,15 +174,9 @@
    @Override
    public String toString()
    {
-      return "ID: " + id + ", long-running: " + longRunning + ", timeout: " + timeout + "ms";
+      return "ID: " + id + ", transient: " + isTransient() + ", timeout: " + timeout + "ms";
    }
 
-   public void setLongRunning(boolean longRunning)
-   {
-      log.debug("Set conversation " + id + " to long-running: " + longRunning);
-      this.longRunning = longRunning;
-   }
-
    /**
     * Gets the original ID of the conversation
     * 
@@ -220,6 +209,6 @@
 
    public boolean isTransient()
    {
-      return !isLongRunning();
+      return _transient;
    }
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/jsf/ConversationAwareViewHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/jsf/ConversationAwareViewHandler.java	2009-10-19 07:41:09 UTC (rev 4192)
+++ core/trunk/impl/src/main/java/org/jboss/weld/jsf/ConversationAwareViewHandler.java	2009-10-19 13:14:13 UTC (rev 4193)
@@ -68,7 +68,7 @@
    {
       String actionUrl = super.getActionURL(context, viewId);
       ConversationImpl conversation = getModuleBeanManager(context).getInstanceByType(ConversationImpl.class);  
-      if (conversation.isLongRunning())
+      if (!conversation.isTransient())
       {
          return new FacesUrlTransformer(actionUrl, context).appendConversationIdIfNecessary(conversation.getUnderlyingId()).getUrl();
       }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/NewResolvableTransformer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/NewResolvableTransformer.java	2009-10-19 07:41:09 UTC (rev 4192)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/NewResolvableTransformer.java	2009-10-19 13:14:13 UTC (rev 4193)
@@ -17,12 +17,14 @@
 package org.jboss.weld.resolution;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
 import java.util.HashSet;
 import java.util.Set;
 
 import javax.enterprise.inject.New;
 
 import org.jboss.weld.literal.NewLiteral;
+import org.jboss.weld.util.Reflections;
 
 /**
  * @author pmuir
@@ -81,6 +83,33 @@
                
             };
          }
+         else
+         {
+            final Class<?> javaClass = originalNewAnnotation.value();
+            final Set<Type> typeClosure = new Reflections.HierarchyDiscovery(javaClass).getTypeClosureAsSet();
+            return new ForwardingResolvable()
+            {
+               
+               @Override
+               protected Resolvable delegate()
+               {
+                  return element;
+               }
+               
+               @Override
+               public Class<?> getJavaClass()
+               {
+                  return javaClass;
+               }
+               
+               @Override
+               public Set<Type> getTypeClosure()
+               {
+                  return typeClosure;
+               }
+               
+            };
+         }
       }
       return element;
    }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationPropagationFilter.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationPropagationFilter.java	2009-10-19 07:41:09 UTC (rev 4192)
+++ core/trunk/impl/src/main/java/org/jboss/weld/servlet/ConversationPropagationFilter.java	2009-10-19 13:14:13 UTC (rev 4193)
@@ -80,7 +80,7 @@
          public void sendRedirect(String path) throws IOException
          {
             ConversationImpl conversation = getModuleBeanManager(ctx) .getInstanceByType(ConversationImpl.class);
-            if (conversation.isLongRunning())
+            if (!conversation.isTransient())
             {
                String cidParamName = getModuleBeanManager(ctx).getInstanceByType(String.class, new AnnotationLiteral<ConversationIdName>(){});
                path = new FacesUrlTransformer(path, FacesContext.getCurrentInstance()).toRedirectViewId().toActionUrl().appendConversationIdIfNecessary(conversation.getUnderlyingId()).encode();


Property changes on: core/trunk/jboss-tck-runner
___________________________________________________________________
Name: svn:ignore
   - .classpath

target

.project

.settings

pom.xml.releaseBackup

   + target

.project

.settings

pom.xml.releaseBackup

bin

.classpath



Modified: core/trunk/jboss-tck-runner/src/test/resources/log4j.xml
===================================================================
--- core/trunk/jboss-tck-runner/src/test/resources/log4j.xml	2009-10-19 07:41:09 UTC (rev 4192)
+++ core/trunk/jboss-tck-runner/src/test/resources/log4j.xml	2009-10-19 13:14:13 UTC (rev 4193)
@@ -14,7 +14,7 @@
         </filter>
         <filter class="org.apache.log4j.varia.StringMatchFilter">
         	<param name="AcceptOnMatch" value="false" />
-        	<param name="StringToMatch" value="Error destroying org.jboss.weld.bean-test-ManagedBean-org.jboss.jsr299.tck.tests.implementation.simple.lifecycle.Cod" />
+        	<param name="StringToMatch" value="Error destroying org.jboss.weld.bean-test-ManagedBean-class org.jboss.jsr299.tck.tests.implementation.simple.lifecycle.Cod" />
         </filter>
     </appender>
 



More information about the weld-commits mailing list