[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...

Gavin King gavin.king at jboss.com
Tue Jun 19 15:02:35 EDT 2007


  User: gavin   
  Date: 07/06/19 15:02:35

  Modified:    src/main/org/jboss/seam/interceptors         
                        AsynchronousInterceptor.java
                        BusinessProcessInterceptor.java
                        ConversationInterceptor.java
                        ConversationalInterceptor.java
                        ManagedEntityIdentityInterceptor.java
                        RollbackInterceptor.java SecurityInterceptor.java
                        ValidationInterceptor.java
                        WebServiceInterceptor.java
  Log:
  repackaged built-in components
  sorry for breakage, but it had to happen eventually :-(
  
  Revision  Changes    Path
  1.15      +2 -2      jboss-seam/src/main/org/jboss/seam/interceptors/AsynchronousInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AsynchronousInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/AsynchronousInterceptor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- AsynchronousInterceptor.java	31 May 2007 00:55:40 -0000	1.14
  +++ AsynchronousInterceptor.java	19 Jun 2007 19:02:34 -0000	1.15
  @@ -4,9 +4,9 @@
   import org.jboss.seam.annotations.AroundInvoke;
   import org.jboss.seam.annotations.Asynchronous;
   import org.jboss.seam.annotations.Interceptor;
  +import org.jboss.seam.async.AbstractDispatcher;
  +import org.jboss.seam.async.Dispatcher;
   import org.jboss.seam.contexts.Contexts;
  -import org.jboss.seam.core.AbstractDispatcher;
  -import org.jboss.seam.core.Dispatcher;
   import org.jboss.seam.intercept.InvocationContext;
   
   @Interceptor(stateless=true, type=InterceptorType.CLIENT)
  
  
  
  1.57      +4 -5      jboss-seam/src/main/org/jboss/seam/interceptors/BusinessProcessInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BusinessProcessInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/BusinessProcessInterceptor.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -b -r1.56 -r1.57
  --- BusinessProcessInterceptor.java	17 Jun 2007 22:51:00 -0000	1.56
  +++ BusinessProcessInterceptor.java	19 Jun 2007 19:02:34 -0000	1.57
  @@ -8,8 +8,6 @@
   
   import java.lang.reflect.Method;
   
  -import javax.faces.context.FacesContext;
  -
   import org.jboss.seam.annotations.AroundInvoke;
   import org.jboss.seam.annotations.BeginTask;
   import org.jboss.seam.annotations.CreateProcess;
  @@ -17,11 +15,12 @@
   import org.jboss.seam.annotations.Interceptor;
   import org.jboss.seam.annotations.ResumeProcess;
   import org.jboss.seam.annotations.StartTask;
  -import org.jboss.seam.core.BusinessProcess;
  +import org.jboss.seam.bpm.BusinessProcess;
   import org.jboss.seam.core.Expressions;
   import org.jboss.seam.intercept.InvocationContext;
   import org.jboss.seam.log.LogProvider;
   import org.jboss.seam.log.Logging;
  +import org.jboss.seam.web.Parameters;
   import org.jboss.util.Strings;
   
   /**
  @@ -151,8 +150,8 @@
         }
         else
         {
  -         id = FacesContext.getCurrentInstance().getExternalContext()
  -               .getRequestParameterMap().get(paramName);
  +         String[] values = Parameters.instance().getRequestParameters().get(paramName);
  +         id = values!=null && values.length==1 ? values[0] : null;
         }
         
         if (id==null)
  
  
  
  1.65      +5 -5      jboss-seam/src/main/org/jboss/seam/interceptors/ConversationInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConversationInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ConversationInterceptor.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -b -r1.64 -r1.65
  --- ConversationInterceptor.java	18 Jun 2007 17:27:23 -0000	1.64
  +++ ConversationInterceptor.java	19 Jun 2007 19:02:34 -0000	1.65
  @@ -1,4 +1,4 @@
  -//$Id: ConversationInterceptor.java,v 1.64 2007/06/18 17:27:23 gavin Exp $
  +//$Id: ConversationInterceptor.java,v 1.65 2007/06/19 19:02:34 gavin Exp $
   package org.jboss.seam.interceptors;
   
   import java.lang.reflect.Method;
  @@ -17,9 +17,9 @@
   import org.jboss.seam.core.ConversationEntry;
   import org.jboss.seam.core.Interpolator;
   import org.jboss.seam.core.Manager;
  -import org.jboss.seam.core.Pageflow;
  -import org.jboss.seam.core.PersistenceContexts;
   import org.jboss.seam.intercept.InvocationContext;
  +import org.jboss.seam.navigation.Pageflow;
  +import org.jboss.seam.persistence.PersistenceContexts;
   
   /**
    * After the end of the invocation, begin or end a long running
  @@ -211,12 +211,12 @@
      {
         if ( !Manager.instance().isLongRunningOrNestedConversation() )
         {
  -         Manager.instance().beginConversation( getComponent().getName() );
  +         Manager.instance().beginConversation( );
            beginNavigation(pageflowName);
         }
         else if (nested)
         {
  -         Manager.instance().beginNestedConversation( getComponent().getName() );
  +         Manager.instance().beginNestedConversation( );
            beginNavigation(pageflowName);
         }
      }
  
  
  
  1.19      +9 -70     jboss-seam/src/main/org/jboss/seam/interceptors/ConversationalInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConversationalInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ConversationalInterceptor.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- ConversationalInterceptor.java	22 Feb 2007 20:21:22 -0000	1.18
  +++ ConversationalInterceptor.java	19 Jun 2007 19:02:34 -0000	1.19
  @@ -1,11 +1,8 @@
  -//$Id: ConversationalInterceptor.java,v 1.18 2007/02/22 20:21:22 gavin Exp $
  +//$Id: ConversationalInterceptor.java,v 1.19 2007/06/19 19:02:34 gavin Exp $
   package org.jboss.seam.interceptors;
   
   import java.lang.reflect.Method;
   
  -import javax.faces.application.FacesMessage;
  -import javax.faces.event.PhaseId;
  -
   import org.jboss.seam.NoConversationException;
   import org.jboss.seam.annotations.AroundInvoke;
   import org.jboss.seam.annotations.Begin;
  @@ -15,13 +12,9 @@
   import org.jboss.seam.annotations.Destroy;
   import org.jboss.seam.annotations.Interceptor;
   import org.jboss.seam.annotations.StartTask;
  -import org.jboss.seam.contexts.Lifecycle;
   import org.jboss.seam.core.Events;
  -import org.jboss.seam.core.FacesMessages;
   import org.jboss.seam.core.Manager;
   import org.jboss.seam.intercept.InvocationContext;
  -import org.jboss.seam.log.LogProvider;
  -import org.jboss.seam.log.Logging;
   
   /**
    * Check that a conversational bean is not being invoked
  @@ -35,8 +28,6 @@
   {
      private static final long serialVersionUID = 1127583515811479385L;
      
  -   private static final LogProvider log = Logging.getLogProvider(ConversationalInterceptor.class);
  -
      @AroundInvoke
      public Object aroundInvoke(InvocationContext invocation) throws Exception
      {
  @@ -44,47 +35,9 @@
   
         if ( isNoConversationForConversationalBean(method) )
         {
  -         @SuppressWarnings("deprecation")
  -         String outcome = methodIsConversational(method) ? 
  -               method.getAnnotation(Conversational.class).ifNotBegunOutcome() :
  -               getComponent().getBeanClass().getAnnotation(Conversational.class).ifNotBegunOutcome();
  -         
  -         if ( "".equals(outcome) )
  -         {
               Events.instance().raiseEvent("org.jboss.seam.noConversation");
               throw new NoConversationException( "no long-running conversation for @Conversational bean: " + getComponent().getName() );
            }
  -         else
  -         {
  -            //Deprecated functionality:
  -            if ( Lifecycle.getPhaseId()==PhaseId.INVOKE_APPLICATION )
  -            {
  -               
  -               if ( log.isDebugEnabled() )
  -               {
  -                  log.debug( "no long-running conversation for @Conversational bean: " + getComponent().getName() );
  -               }
  -               
  -               Events.instance().raiseEvent("org.jboss.seam.noConversation");
  -               
  -               FacesMessages.instance().addFromResourceBundleOrDefault( 
  -                     FacesMessage.SEVERITY_WARN, 
  -                     "org.jboss.seam.NoConversation", 
  -                     "No conversation" 
  -                  );
  -               
  -               if ( method.getReturnType().equals(String.class) )
  -               {
  -                  return outcome;
  -               }
  -               else if ( method.getReturnType().equals(void.class) )
  -               {
  -                  return null;
  -               }
  -            }
  -         }
  -         
  -      }
   
         return invocation.proceed();
      
  @@ -93,7 +46,7 @@
      private boolean isNoConversationForConversationalBean(Method method)
      {
         boolean classlevelViolation = componentIsConversational() && 
  -            ( !Manager.instance().isLongRunningOrNestedConversation() || ( componentShouldBeInitiator() && !componentIsInitiator() ) ) &&
  +            !Manager.instance().isLongRunningOrNestedConversation()  &&
               !method.isAnnotationPresent(Begin.class) &&
               !method.isAnnotationPresent(StartTask.class) &&
               !method.isAnnotationPresent(BeginTask.class) &&
  @@ -103,34 +56,20 @@
         if (classlevelViolation) return true;
         
         boolean methodlevelViolation = methodIsConversational(method) &&
  -            ( !Manager.instance().isLongRunningOrNestedConversation() || ( componentShouldBeInitiator(method) && !componentIsInitiator() ) );
  +            !Manager.instance().isLongRunningOrNestedConversation();
         
         return methodlevelViolation;
         
      }
   
  -   private boolean methodIsConversational(Method method) {
  +   private boolean methodIsConversational(Method method) 
  +   {
         return method.isAnnotationPresent(Conversational.class);
      }
   
  -   @SuppressWarnings("deprecation")
  -   private boolean componentShouldBeInitiator(Method method) {
  -      return method.getAnnotation(Conversational.class).initiator();
  -   }
  -
  -   private boolean componentIsConversational() {
  -      return getComponent().getBeanClass().isAnnotationPresent(Conversational.class);
  -   }
  -
  -   @SuppressWarnings("deprecation")
  -   private boolean componentShouldBeInitiator() {
  -      return getComponent().getBeanClass().getAnnotation(Conversational.class).initiator();
  -   }
  -
  -   @SuppressWarnings("deprecation")
  -   private boolean componentIsInitiator()
  +   private boolean componentIsConversational() 
      {
  -      return getComponent().getName().equals( Manager.instance().getCurrentConversationInitiator() );
  +      return getComponent().getBeanClass().isAnnotationPresent(Conversational.class);
      }
   
   }
  
  
  
  1.27      +16 -14    jboss-seam/src/main/org/jboss/seam/interceptors/ManagedEntityIdentityInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ManagedEntityIdentityInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ManagedEntityIdentityInterceptor.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -b -r1.26 -r1.27
  --- ManagedEntityIdentityInterceptor.java	16 Jun 2007 22:30:40 -0000	1.26
  +++ ManagedEntityIdentityInterceptor.java	19 Jun 2007 19:02:34 -0000	1.27
  @@ -1,19 +1,21 @@
   package org.jboss.seam.interceptors;
   
  +import static org.jboss.seam.util.JSF.DATA_MODEL;
  +import static org.jboss.seam.util.JSF.getWrappedData;
  +import static org.jboss.seam.util.JSF.setWrappedData;
  +
   import java.lang.reflect.Field;
   import java.lang.reflect.Modifier;
   import java.util.List;
   
  -import javax.faces.model.DataModel;
  -
   import org.jboss.seam.Seam;
   import org.jboss.seam.annotations.AroundInvoke;
   import org.jboss.seam.annotations.In;
   import org.jboss.seam.annotations.Interceptor;
   import org.jboss.seam.contexts.Contexts;
   import org.jboss.seam.contexts.PassivatedEntity;
  -import org.jboss.seam.core.PersistenceContexts;
   import org.jboss.seam.intercept.InvocationContext;
  +import org.jboss.seam.persistence.PersistenceContexts;
   import org.jboss.seam.util.Reflections;
   
   /**
  @@ -65,11 +67,11 @@
                     Object value = getFieldValue(bean, field);
                     if (value!=null)
                     {
  -                     DataModel dataModel = null;
  -                     if (value instanceof DataModel)
  +                     Object dataModel = null;
  +                     if ( DATA_MODEL.isInstance(value) )
                        {
  -                        dataModel = (DataModel) value;
  -                        value = dataModel.getWrappedData();
  +                        dataModel = value;
  +                        value = getWrappedData(dataModel);
                        }
                        if ( isRef(value) )
                        {
  @@ -95,10 +97,10 @@
                  if ( !ignore(field) )
                  {
                     Object value = getFieldValue(bean, field);
  -                  DataModel dataModel = null;
  -                  if (value!=null && value instanceof DataModel)
  +                  Object dataModel = null;
  +                  if (value!=null && DATA_MODEL.isInstance(value) )
                     {
  -                     dataModel = (DataModel) value;
  +                     dataModel = value;
                     }
                     //TODO: be more selective
                     getFromWrapper(bean, field, dataModel);
  @@ -139,7 +141,7 @@
         return getComponent().getName() + '.' + field.getName();
      }
   
  -   private void saveWrapper(Object bean, Field field, DataModel dataModel, Object value) throws Exception
  +   private void saveWrapper(Object bean, Field field, Object dataModel, Object value) throws Exception
      {
         Contexts.getConversationContext().set( getFieldId(field), value );
         if (dataModel==null)
  @@ -148,11 +150,11 @@
         }
         else
         {
  -         dataModel.setWrappedData(null);
  +         setWrappedData(dataModel, null);
         }
      }
   
  -   private void getFromWrapper(Object bean, Field field, DataModel dataModel) throws Exception
  +   private void getFromWrapper(Object bean, Field field, Object dataModel) throws Exception
      {
         Object value = Contexts.getConversationContext().get( getFieldId(field) );
         if (value!=null)
  @@ -163,7 +165,7 @@
            }
            else
            {
  -            dataModel.setWrappedData(value);
  +            setWrappedData(dataModel, value);
            }
         }
      }
  
  
  
  1.22      +14 -2     jboss-seam/src/main/org/jboss/seam/interceptors/RollbackInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RollbackInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/RollbackInterceptor.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -b -r1.21 -r1.22
  --- RollbackInterceptor.java	18 Jun 2007 04:54:11 -0000	1.21
  +++ RollbackInterceptor.java	19 Jun 2007 19:02:34 -0000	1.22
  @@ -1,4 +1,4 @@
  -//$Id: RollbackInterceptor.java,v 1.21 2007/06/18 04:54:11 gavin Exp $
  +//$Id: RollbackInterceptor.java,v 1.22 2007/06/19 19:02:34 gavin Exp $
   package org.jboss.seam.interceptors;
   
   import static org.jboss.seam.ComponentType.JAVA_BEAN;
  @@ -10,6 +10,7 @@
   import org.jboss.seam.annotations.Interceptor;
   import org.jboss.seam.intercept.InvocationContext;
   import org.jboss.seam.transaction.Transaction;
  +import org.jboss.seam.util.JSF;
   
   /**
    * Automatically sets the current transaction to rollback 
  @@ -47,9 +48,20 @@
      {
         boolean isJavaBean = getComponent().getType()==JAVA_BEAN;
         Class<? extends Exception> clazz = e.getClass();
  -      return ( isJavaBean && (e instanceof RuntimeException) && !clazz.isAnnotationPresent(APPLICATION_EXCEPTION) && !clazz.isAnnotationPresent(ApplicationException.class) ) || 
  +      return ( isSystemException(e, isJavaBean, clazz) ) || 
               ( isJavaBean && clazz.isAnnotationPresent(APPLICATION_EXCEPTION) && rollback( clazz.getAnnotation(APPLICATION_EXCEPTION) ) ) ||
               ( clazz.isAnnotationPresent(ApplicationException.class) && clazz.getAnnotation(ApplicationException.class).rollback() );
      }
      
  +   private boolean isSystemException(Exception e, boolean isJavaBean, Class<? extends Exception> clazz)
  +   {
  +      return isJavaBean && 
  +            (e instanceof RuntimeException) && 
  +            !clazz.isAnnotationPresent(APPLICATION_EXCEPTION) && 
  +            !clazz.isAnnotationPresent(ApplicationException.class) &&
  +            //TODO: this is hackish, maybe just turn off RollackInterceptor for @Converter/@Validator components
  +            !JSF.VALIDATOR_EXCEPTION.isInstance(e) &&
  +            !JSF.CONVERTER_EXCEPTION.isInstance(e);
  +   }
  +   
   }
  
  
  
  1.34      +3 -3      jboss-seam/src/main/org/jboss/seam/interceptors/SecurityInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SecurityInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/SecurityInterceptor.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -b -r1.33 -r1.34
  --- SecurityInterceptor.java	22 May 2007 00:56:25 -0000	1.33
  +++ SecurityInterceptor.java	19 Jun 2007 19:02:34 -0000	1.34
  @@ -26,11 +26,11 @@
      {
         Method interfaceMethod = invocation.getMethod();
         //TODO: optimize this:
  -      Method method = getComponent().getBeanClass().getMethod( interfaceMethod.getName(), 
  -               interfaceMethod.getParameterTypes() );
  +      Method method = getComponent().getBeanClass()
  +               .getMethod( interfaceMethod.getName(), interfaceMethod.getParameterTypes() );
         Restrict restrict = getRestriction(method);
         
  -      if (restrict != null && Identity.isSecurityEnabled())
  +      if ( restrict!=null && Identity.isSecurityEnabled() )
         {
            String expr = !Strings.isEmpty( restrict.value() ) ? 
                     restrict.value() : createDefaultExpr(method);
  
  
  
  1.30      +2 -2      jboss-seam/src/main/org/jboss/seam/interceptors/ValidationInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ValidationInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ValidationInterceptor.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -b -r1.29 -r1.30
  --- ValidationInterceptor.java	12 Feb 2007 16:47:29 -0000	1.29
  +++ ValidationInterceptor.java	19 Jun 2007 19:02:34 -0000	1.30
  @@ -1,4 +1,4 @@
  -//$Id: ValidationInterceptor.java,v 1.29 2007/02/12 16:47:29 gavin Exp $
  +//$Id: ValidationInterceptor.java,v 1.30 2007/06/19 19:02:34 gavin Exp $
   package org.jboss.seam.interceptors;
   
   import java.lang.reflect.Method;
  @@ -15,7 +15,7 @@
   import org.jboss.seam.annotations.IfInvalid;
   import org.jboss.seam.annotations.Interceptor;
   import org.jboss.seam.annotations.Outcome;
  -import org.jboss.seam.core.FacesMessages;
  +import org.jboss.seam.faces.FacesMessages;
   import org.jboss.seam.intercept.InvocationContext;
   
   /**
  
  
  
  1.7       +1 -1      jboss-seam/src/main/org/jboss/seam/interceptors/WebServiceInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WebServiceInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/WebServiceInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- WebServiceInterceptor.java	18 Jun 2007 23:18:38 -0000	1.6
  +++ WebServiceInterceptor.java	19 Jun 2007 19:02:34 -0000	1.7
  @@ -15,9 +15,9 @@
   import org.jboss.seam.core.ConversationPropagation;
   import org.jboss.seam.core.Expressions;
   import org.jboss.seam.core.Manager;
  -import org.jboss.seam.core.ServletContexts;
   import org.jboss.seam.intercept.InvocationContext;
   import org.jboss.seam.servlet.ServletRequestSessionMap;
  +import org.jboss.seam.web.ServletContexts;
   import org.jboss.seam.ws.SeamWSRequestHandler;
   
   /**
  
  
  



More information about the jboss-cvs-commits mailing list