4 Replies Latest reply on Sep 11, 2008 12:24 PM by mail.micke

    Seam managed beans and static analysis

    mail.micke

      Hi

      Is it possible to make use of the static analysis tests in a seam project that doesn't use faces-config for its managed beans?

      Not sure about an efficient way of scanning the classpath which isn't a performance hog. Some limitations on what is being scanned would be nice though.

      Searched the forum and JIRA but couldn't locate a discussions on that topic, didn't send a tremendous amount of time though so sorry if it has already been covered.

      Cheers,
      micke

        • 1. Re: Seam managed beans and static analysis
          ssilvert

          Static analysis doesn't cover that at the moment. But there have been a few requests for it.

          Perhaps Seam provides some discovery code we could call? If someone has the time it's worth looking into.

          Stan

          • 2. Re: Seam managed beans and static analysis
            mail.micke

            Hi

            A bit of an FYI

            Had a quick look at this and there seems to be something in Seam which could be reused to locate all the Seam components.

            Dug around the init code of seam and found the StandardDeploymentStrategy class.

            Ex:

             public void testSeamStuff(){
            
             StandardDeploymentStrategy sds = new StandardDeploymentStrategy(
             Thread.currentThread().getContextClassLoader()
             );
            
             sds.scan();
            
             Set<Class<Object>> components = sds.getScannedComponentClasses();
             for(Class<Object> clazz : components){
             System.out.println(clazz.getName());
             java.lang.annotation.Annotation[] annotations = clazz.getDeclaredAnnotations();
             for(java.lang.annotation.Annotation anno : annotations){
             System.out.println("\t" +anno.toString());
             }
            
             }
             }
            


            Produces the following in my toy project:
            com.dkib.riskit.sandbox.micke.SelectRerenderBacking
             @org.jboss.seam.annotations.Name(value=srb)
             @org.jboss.seam.annotations.Scope(value=PAGE)
            org.jboss.seam.core.Events
             @org.jboss.seam.annotations.Scope(value=STATELESS)
             @org.jboss.seam.annotations.intercept.BypassInterceptors()
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.core.events)
             @org.jboss.seam.annotations.Install(classDependencies=[], dependencies=[], precedence=0, value=true, genericDependencies=[], debug=false)
            com.dkib.riskit.sandbox.advanced.backing.FileSystemBacking
             @org.jboss.seam.annotations.Name(value=fileSystemBacking)
             @org.jboss.seam.annotations.Scope(value=SESSION)
            org.jboss.seam.pdf.DocumentStore
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.pdf.documentStore)
             @org.jboss.seam.annotations.Scope(value=CONVERSATION)
             @org.jboss.seam.annotations.Install(classDependencies=[], dependencies=[], precedence=0, value=true, genericDependencies=[], debug=false)
            org.jboss.seam.ui.facelet.FaceletsRenderer
             @org.jboss.seam.annotations.Scope(value=STATELESS)
             @org.jboss.seam.annotations.intercept.BypassInterceptors()
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.faces.renderer)
             @org.jboss.seam.annotations.AutoCreate()
             @org.jboss.seam.annotations.Install(classDependencies=[com.sun.facelets.Facelet], dependencies=[], precedence=0, value=true, genericDependencies=[], debug=false)
            org.jboss.seam.persistence.HibernatePersistenceProvider
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.persistence.persistenceProvider)
             @org.jboss.seam.annotations.Scope(value=STATELESS)
             @org.jboss.seam.annotations.intercept.BypassInterceptors()
             @org.jboss.seam.annotations.Install(classDependencies=[org.hibernate.Session, javax.persistence.EntityManager], dependencies=[], precedence=10, value=true, genericDependencies=[], debug=false)
            org.jboss.seam.debug.hot.HotDeployFilter
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.debug.hotDeployFilter)
             @org.jboss.seam.annotations.Install(classDependencies=[], dependencies=[], precedence=0, value=true, genericDependencies=[], debug=true)
             @org.jboss.seam.annotations.intercept.BypassInterceptors()
             @org.jboss.seam.annotations.Scope(value=APPLICATION)
             @org.jboss.seam.annotations.web.Filter(within=[], around=[])
            org.jboss.seam.ioc.spring.SpringELResolver
             @org.jboss.seam.annotations.Scope(value=APPLICATION)
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.ioc.spring.springELResolver)
             @org.jboss.seam.annotations.Install(classDependencies=[org.springframework.beans.factory.BeanFactory], dependencies=[], precedence=10, value=true, genericDependencies=[], debug=false)
             @org.jboss.seam.annotations.Startup(depends=[])
             @org.jboss.seam.annotations.intercept.BypassInterceptors()
            org.jboss.seam.bpm.TaskInstancePriorityList
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.bpm.taskInstancePriorityList)
             @org.jboss.seam.annotations.Scope(value=APPLICATION)
             @org.jboss.seam.annotations.Install(classDependencies=[], dependencies=[org.jboss.seam.bpm.jbpm], precedence=0, value=true, genericDependencies=[], debug=false)
            org.jboss.seam.faces.FacesMessages
             @org.jboss.seam.annotations.Scope(value=CONVERSATION)
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.faces.facesMessages)
             @org.jboss.seam.annotations.Install(classDependencies=[javax.faces.context.FacesContext], dependencies=[], precedence=0, value=true, genericDependencies=[], debug=false)
             @org.jboss.seam.annotations.intercept.BypassInterceptors()
            org.jboss.seam.web.Ajax4jsfFilter
             @org.jboss.seam.annotations.Scope(value=APPLICATION)
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.web.ajax4jsfFilter)
             @org.jboss.seam.annotations.Install(classDependencies=[], dependencies=[org.jboss.seam.web.ajax4jsfFilterInstantiator], precedence=0, value=true, genericDependencies=[], debug=false)
             @org.jboss.seam.annotations.intercept.BypassInterceptors()
             @org.jboss.seam.annotations.web.Filter(within=[], around=[])
            com.dkib.riskit.sandbox.person.backing.PersonsBacking
             @org.jboss.seam.annotations.Name(value=personsBacking)
             @org.jboss.seam.annotations.Scope(value=SESSION)
            com.dkib.riskit.sandbox.extended.model.MyExtendedDataModel
             @org.jboss.seam.annotations.Name(value=someObjectData)
             @org.jboss.seam.annotations.Scope(value=PAGE)
            org.jboss.seam.bpm.Actor
             @org.jboss.seam.annotations.Name(value=org.jboss.seam.bpm.actor)
             @org.jboss.seam.annotations.Scope(value=SESSION)
             @org.jboss.seam.annotations.intercept.BypassInterceptors()
             @org.jboss.seam.annotations.Install(classDependencies=[], dependencies=[org.jboss.seam.bpm.jbpm], precedence=0, value=true, genericDependencies=[], debug=false)
            org.jboss.seam.faces.IsUserInRole
            
            //cut
            


            • 3. Re: Seam managed beans and static analysis
              ssilvert

              Thanks for doing the research. I've added a jira task for it:
              https://jira.jboss.org/jira/browse/JSFUNIT-165

              Stan

              • 4. Re: Seam managed beans and static analysis
                mail.micke

                I figured I'd take a crack at this myself, but quickly ran into a dependency dilemma.

                I planned to make the AbstractViewTestCase a base class for a SeamViewTestCase and a PlainViewTestCase class.
                The problem is that the analysis module knows nothing about seam and the seam module knows nothing about the analysis module (ViewParser).

                Read somewhere that you plan on skipping the seam module.

                - micke