1 2 3 Previous Next 32 Replies Latest reply on Oct 12, 2011 5:05 AM by bussien Go to original post
      • 15. Re: Seam 2 -> 3 migration. How to start?
        lightguard

        Wrap the two values you want outjected in a class, then you'll have both of them available once you produce them. So your producer will produce the wrapper object and set any data you need on that object. A nice side effect of this is being able to inject that wrapper object and modify any of it's state, just the same as you could in Seam 2.

        • 16. Re: Seam 2 -> 3 migration. How to start?
          gus888

          Hi Jason,


          Do you know how to migrate Seam 2's Framework EntityHome to Seam3? Or it still need to wait for Seam 3.1 (Shane ever said Seam 2' framework will be upgraded to Seam 3.1). Thanks,


          Have a good one!


          Shenghe

          • 18. Re: Seam 2 -> 3 migration. How to start?
            sunfire
            Well I have a big Seam 2 application that sooner or later I guess will have to get migrated to Seam 3. Unfortunetly as of Seam 3.0.0.Final there is no way of doing so unless a) rewriting several parts of the app from scratch and b) rewriting components that Seam 2 used to provided out of the box. While a) is to be expected and ok I feel very frustrated by b).

            Right now Seam 3 and Weld represent a great foundation and considering that it just had its first real release it only has a few minor bugs that I ran into when doing some testing. So good job there.

            BUT if I compare the Seam 3 productivity enhancing features to the ones of Seam 2 it still has some way to go. And I am not talking about the new concepts and that API's are different to achive the same results. That is no problem. Its really about the stuff that is not there in any form at all yet.

            I very much hope that sooner or later features that people who are facing a Seam 2 -> 3 migration have been asking for will get implemented. Here are only my personal top 3 missing features when I map out our migration path:

            - <s:convertEntity> and some other Seam JSF controls that are not part of JSF 2 or Seam 3 Faces yet
            - multiple conversation/workspace control features
            - application/entity framework

            Again I'd like to emphasize that IMHO Seam 3 is a great design and I like where you guys are going with it but please implement some of the still missing Seam 2 key features that many people used to love to work with.

            Thanks
            • 19. Re: Seam 2 -> 3 migration. How to start?
              florianhell

              <s:convertEntity> - no longer needed

              multiple conversation/workspace control features - ConversationScope still exists

              application/entity framework - Seam Forge is on a great way!

              So, what is the Problem?

              • 20. Re: Seam 2 -> 3 migration. How to start?
                sunfire

                Florian Hell wrote on Jun 30, 2011 08:00:


                <s:convertEntity> - no longer needed

                multiple conversation/workspace control features - ConversationScope still exists

                application/entity framework - Seam Forge is on a great way!

                So, what is the Problem?



                How exactly does Seam Forge address any of the 3 items I listed? AFAIK Seam Forge is replacing seam-gen and also provides some very nice features for rapid prototyping and code manipulation via cli. But I was not aware of the fact that it would provide JSF tag libs, enhancements to the current CDI single conversation per session paradigm and an entity framework like it used to be in Seam 2?


                I must have missed that so if you don't mind please point me to the documentation or source where I can find all this in Seam Forge? I would very much appreciate it.

                • 21. Re: Seam 2 -> 3 migration. How to start?
                  zeppelinux.dmitry.diligesoft.com

                  My Seam 2 application uses xhtml templates for email generation and Seam 2 pdf tags for pdf generation. Is there a way to do it in Seam 3 and if there is no such functionality yet - when it will be (planned to be) available?

                  • 22. Re: Seam 2 -> 3 migration. How to start?
                    lightguard

                    XHTML templates are not planned in Seam 3 (thought they could be done by creating another template provider). For email you'll want to look at the Seam Mail (which hasn't been released just yet, but should be stable, there are others using it production that I know). For PDF please look at Seam Reports. Feel free to contact the respective authors for ideas and contributions regarding xhtml.

                    • 23. Re: Seam 2 -> 3 migration. How to start?
                      ge0ffrey

                      How do I do Identity.instance() used in a class not created by CDI (so @Inject doesn't work there)?

                      • 24. Re: Seam 2 -> 3 migration. How to start?
                        lightguard

                        Geoffrey De Smet wrote on Jul 06, 2011 03:42:


                        How do I do Identity.instance() used in a class not created by CDI (so @Inject doesn't work there)?


                        Here's the code you'll want to use for this:




                        public abstract class BeanManagerUtils
                        {
                           @SuppressWarnings("unchecked")
                           public static <T> T getContextualInstance(final BeanManager manager, final Class<T> type)
                           {
                              T result = null;
                              Bean<T> bean = (Bean<T>) manager.resolve(manager.getBeans(type));
                              if (bean != null)
                              {
                                 CreationalContext<T> context = manager.createCreationalContext(bean);
                                 if (context != null)
                                 {
                                    result = (T) manager.getReference(bean, type, context);
                                 }
                              }
                              return result;
                           }
                        
                           @SuppressWarnings("unchecked")
                           public static CreationalContext<Object> injectNonContextualInstance(final BeanManager manager, final Object instance)
                           {
                              if (instance != null)
                              {
                                 CreationalContext<Object> creationalContext = manager.createCreationalContext(null);
                                 InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) manager
                                          .createInjectionTarget(manager.createAnnotatedType(instance.getClass()));
                                 injectionTarget.inject(instance, creationalContext);
                                 return creationalContext;
                              }
                              return null;
                           }
                        }
                        


                        Let's walk through this a bit to understand it. The first method, getContextualInstance is what you specifically asked about. You pass it the BeanManager (easiest way to do this is to inject it from somewhere, or (less optimally) have some class which extends Solder's BeanManagerAware and invoke getBeanManager()) and the class (in your example Identity.class). It will then pass you a contextual (active) instance of the type. This does the same as Seam 2's instance() methods.


                        The next method, injectNonContextualInstance is useful if you have a class with CDI annotations that is not picked up by CDI at deploy time (maybe some classes in a library that doesn't have a beans.xml). This will allow that object to be created and have injections performed.

                        • 25. Re: Seam 2 -> 3 migration. How to start?
                          rayn
                          <blockquote>
                          How will we have to change all our \*.page.xml files?
                          </blockquote>
                          Those will go to the ViewConfig structure in Seam Faces. Not all the functionality is there, but the majority is, you'll want to ask Brian Leathem for more info.



                          So, how to ask Brian besides here? :)
                          I'm not getting the idea of migrating from page descriptor to ViewConfig because I didn't find any doc about it.
                          As a simple example, how could we set a param (<param>) in ViewConfig?

                          • 26. Re: Seam 2 -> 3 migration. How to start?
                            bleathem

                            ViewConfig is documented in the Seam Faces documentation:

                            http://docs.jboss.org/seam/3/faces/latest/reference/en-US/html/viewconfig.html

                            • 27. Re: Seam 2 -> 3 migration. How to start?
                              rayn

                              ViewConfig is documented in the Seam Faces documentation:
                              http://docs.jboss.org/seam/3/faces/latest/reference/en-US/html/viewconfig.html

                              Thanks for answering!
                              I've already read the these documentation, but i couldn't find out how to do the example I've asked for (how to create a <param>).

                              • 28. Re: Seam 2 -> 3 migration. How to start?
                                bussien
                                Hi Jason, what is the equivalent of
                                     @RequestParameter
                                     Long gid;
                                in Seam 3?

                                they say 'RequestParam can not resovet to a type'
                                   @Inject @RequestParam
                                   private int [String] gid;
                                dosn't work nether :-(

                                Thanks for answering!
                                • 29. Re: Seam 2 -> 3 migration. How to start?
                                  shane.bryzak

                                  Marcel Bussien wrote on Oct 08, 2011 03:24:


                                  Hi Jason, what is the equivalent of
                                          @RequestParameter
                                          Long gid;
                                  in Seam 3?

                                  they say 'RequestParam can not resovet to a type'


                                     @Inject @RequestParam
                                     private int [String] gid;




                                  dosn't work nether :-(

                                  Thanks for answering!


                                  The documentation for this is here - http://docs.jboss.org/seam/3/latest/reference/en-US/html/injectablerefs.html#injectablerefs.request_param.  Are you using the latest beta release of Seam (3.1.0.Beta3)?  If so, then request parameter injection support is provided by Solder.  If you're using an earlier version, then you need to be adding the Seam Servlet jar to your project.