Support for @Factory annotation in JBoss Seam?

I was wondering if it was possible to the @Factory annotation in Seam supported like the @Name and @Role annotation. I guess the factory component pattern is commonly used.
That would be so nice...Also, is there some sort of in depth support planned for Seam? I'd love to see that. I think Seam pretty much goes with Idea's motto "Develop with pleasure" :), together this could be a very powerful combination.

Tino

11 comments
Comment actions Permalink

Here's a vote to NOT supporting seam. In time, the webbeans JSR will be completed and seam's proprietory bits will go away, so you're better off supporting that instead.

0
Comment actions Permalink

What kind of support should Idea offer for @Factory?
@Factory does not define a context variable. Rather it instructs Seam that the annotated
method should be used to initialize another context variable - most often one that is
defined by a @DataModel annotation.
IDEA already understands @DataModel.

Maxim Mossienko has been very fast in resolving specific issues I had with Seam support:
http://www.jetbrains.net/jira/secure/IssueNavigator.jspa?reset=true&&pid=10132&component=10772&sorter/field=priority&sorter/order=ASC

If you have specific problems, you should probably file a Jira issue.

I have not tested component definitions using components.xml (I only ever use annotations).

tino wrote:

I was wondering if it was possible to the @Factory annotation in Seam supported like the @Name and @Role annotation. I guess the factory component pattern is commonly used.
That would be so nice...Also, is there some sort of in depth support planned for Seam? I'd love to see that. I think Seam pretty much goes with Idea's motto "Develop with pleasure" :), together this could be a very powerful combination.

Tino

0
Comment actions Permalink

Hani Suleiman wrote:

Here's a vote to NOT supporting seam. In time, the webbeans JSR will be completed and seam's proprietory bits will go away, so you're better off supporting that instead.


In time? Given the JCP it's unlikely that we see a final spec this decade.

Also I'm pretty sure that WebBeans will look almost exactly like Seam (minus some advanced stuff that
will be made available as 'vendor extensions').
Just look at what happened with Hibernate and JPA.
If Idea has support for Seam it will be a snap to implement solid support for WebBeans.

Besides Idea's Seam support is already quite advanced.

0
Comment actions Permalink


In time? Given the JCP it's unlikely that we see a
final spec this decade.

What an idiotic thing to say, given that active specs are usually completed in just over a year, on average.

Just look at what happened with Hibernate and JPA.


Again, nonsense. Hibernate's annotations are derived from JPA, not the other way around. The ideas and approach of Hibernate (and toplink, and kodo) went into JPA. Tools that supported Hibernate needed a lot of work to support JPA.

0
Comment actions Permalink

Hani Suleiman wrote:
>> In time? Given the JCP it's unlikely that we see a
>> final spec this decade.
>>

What an idiotic thing to say, given that active specs are usually completed in just over a year, on average.

>> Just look at what happened with Hibernate and JPA.


Again, nonsense. Hibernate's annotations are derived from JPA, not the other way around. The ideas and approach of Hibernate (and toplink, and kodo) went into JPA. Tools that supported Hibernate needed a lot of work to support JPA.

Do you have some facts to match the fervor of your statements?

Some JSRs (just more or less randomly choosen - in fact I ommited a couple
of JSRs that seem just dead):

JSR 221 (JDBC 4.0): May 2003 - Dec 2006
JSR 919 (JavaMail Maintenance): Mar 2002 - may 2006
JSR 914 (JMS Errata): May 2001 - Dec 2003
JSR 907 (JTA): Jul 2000 - Nov 2002
JSR 245 (JSP 2.1): May 2004 - Nov 2006
JSR 277 (JavaTM Module System): Started Jun 2005, now (a year later) there is at least an Early Draft Review
JSR 220 (EJB 3.0): May 2003 - May 2006

JSR 299 (Web Beans) May 2006 - ???

To me it looks like start-to-finish time is about 2 1/2 years and up.

As to Hibernate vs. JPA - I really do think Hibernate was the strongest
influence in JPA. Most JPA annotations were available in Hibernate xml files
in near identical form even before JPA was thought of (IIRC Sun's open letter
concerning a new persistence API dates back to autumn 2004).
But probably the concepts are more or less the same in each and every O/R mapper...

First release of Hibernate annotations: Jan 2005
First public draft of JPA: Jun 2005

I don't know when TopLink first supported JPA, but I'm pretty sure that came later.

0
Comment actions Permalink

Sorry, you are wrong about the Hibernate JPA link. JPA is a complete deriviative of Hibernate 3. They copied as much as they could expect the vendors to implement. I learned this at JavaOne from the Sun lead.

Toplink came into play because Oracle was on the committee and it was killing all of the members of the committee that Flury would have the only implementation. Toplink Essentials was written to support the JPA API and was listed as the reference implementation ... but everyone knew the score.

Message was edited by:
Norris Shelton

0
Comment actions Permalink

Erm, that's certainly news to me, and was on the EJB3 Expert Group. Hibernate was certainly a big influence, but JPA is NOT based on Hibernate alone. I'd be amazed if Linda (the spec lead) had ever said so.

0
Comment actions Permalink

In fact it does define context variables, sort of implicitly. And I find it a nice way.
quote:
The factory component pattern lets a Seam component act as the instantiator for a non-component object. A factory method will be called when a context variable is referenced but has no value bound to it. We define factory methods using the @Factory annotation. The factory method binds a value to the context variable, and determines the scope of the bound value.

Link: http://docs.jboss.com/seam/latest/reference/en/html/concepts.html#d0e2884

I use it a lot, and trust me, it works just fine. Thanks for pointing me to the Jira. I'll look at it.

Tino

0
Comment actions Permalink

Interesting: On further reading we are both right ;)

This is the style of @Factory that I always use:
@DataModel List customerList; @Factory("customerList") public void initCustomerList() { customerList = ... ; } In this case @DataModel defines the variable and initCustomerList is only called to lazily initialize it. In a second kind the @Factory method must have JavaBeans getter-signature and defines a context variable: @Factory(scope=CONVERSATION) public List]]> getCustomerList() {
return ... ;
}

Or am I still missing something?


tino wrote:

In fact it does define context variables, sort of implicitly. And I find it a nice way.
quote:
A factory method will be called when a context variable is referenced but has no value bound to it.


We define factory methods using the @Factory annotation.

The factory method binds a value to the context variable, and determines the scope of the bound value.+


Link: http://docs.jboss.com/seam/latest/reference/en/html/concepts.html#d0e2884

I use it a lot, and trust me, it works just fine. Thanks for pointing me to the Jira. I'll look at it.

Tino

0
Comment actions Permalink

That is exactly how it works. :)

One rather annoying fact I am just dealing with is that using the @Factory way of binding objects to the context does not treat them as seam components, therefore doesn't in or outject anything. :\

Anyhow, support for those would be neat and I wouldn't ask if it didn't seem to me as if it was easy to implement after all the other annotations which are recognized already...


T

0
Comment actions Permalink

They went into some pretty juicy details right there in front of everyone. JBoss brings a lot of political issues.

0

Please sign in to leave a comment.