5 Replies Latest reply on Dec 22, 2009 7:47 AM by Nicklas Karlsson

    Weld examples

    Arbi Sookazian Master

      I'm trying to understand what concepts/APIs in CDI the Weld distro examples are covering.  (Yes, my Win7 search indexing is messed up so I can't currently search contents of files, I'm working on that now) but it seems to me it's really covering scopes, injection concepts and some SE and Wicket integration examples.  What about stereotypes, interceptors, events, decorators??  Are examples of all those covered as well?


      I think it would be nice to have one app that showcases all these concepts in their own page or page flows (conversation or use cases).

        • 1. Re: Weld examples
          Nicklas Karlsson Master

          Yep, examples will be improved. Feel free to beef up the numberguess (or create your own example). There is no better way of learning stuff than to teach it to others ;-)

          • 2. Re: Weld examples
            Arbi Sookazian Master

            IMO, there needs to be an app more along the lines of the booking app from Seam distro, using JPA with hsqldb or similar (mysqldb like wiki project?), which has at least three JSF views to demonstrate LRC and possibly demonstrates some example code in a working app like this one from ref doc for a decorator:


            @Decorator
            public abstract class LargeTransactionDecorator
            implements Account {
            
            @Inject @Delegate @Any Account account;
            @PersistenceContext EntityManager em;
            
            public void withdraw(BigDecimal amount) {
            account.withdraw(amount);
            if ( amount.compareTo(LARGE_AMOUNT)>0 ) {
            em.persist( new LoggedWithdrawl(amount) );
            }
            }
            
            public void deposit(BigDecimal amount);
            account.deposit(amount);
            if ( amount.compareTo(LARGE_AMOUNT)>0 ) {
            em.persist( new LoggedDeposit(amount) );
            }
            }



            and this one for an interceptor:


            @Transactional @Interceptor
            public class TransactionInterceptor {
            @Resource UserTransaction transaction;
            @AroundInvoke
            public Object manageTransaction(InvocationContext ctx) throws Exception { ... }
            }



            And some stereotypes like @Model, which I saw an example of in the permalink example.


            There is no reference to @ConversationScoped in the example apps?

            • 3. Re: Weld examples
              Pete Muir Master

              Arbi Sookazian wrote on Nov 23, 2009 17:23:


              IMO, there needs to be an app more along the lines of the booking app from Seam distro, using JPA with hsqldb or similar (mysqldb like wiki project?), which has at least three JSF views to demonstrate LRC and possibly demonstrates some example code in a working app like this one from ref doc for a decorator


              Definitely!


              Here are some ideas, please add to them.


              It would be really great to have some help with examples from you guys, I'm happy to discuss ideas - drop by the #weld-dev chatroom on freenode.

              • 4. Re: Weld examples
                Arbi Sookazian Master

                Pete Muir wrote on Dec 15, 2009 19:01:


                It would be really great to have some help with examples from you guys, I'm happy to discuss ideas - drop by the #weld-dev chatroom on freenode.


                I am unable to locate #weld-dev here: http://freenode.net/, plz advise.

                • 5. Re: Weld examples
                  Nicklas Karlsson Master

                  1. weld-dev is a channel on the freenode IRC network, it's not on the site itself. But on the site you should be able to find instructions on how to connect to the network.