Bug 119311 - Create Default Session Bean option
Summary: Create Default Session Bean option
Status: RESOLVED FIXED
Alias: None
Product: WTP EJB Tools
Classification: WebTools
Component: jst.ejb (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Stefan Dimov CLA
QA Contact:
URL:
Whiteboard: EaseOfUse
Keywords: plan, usability
: 129195 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-05 15:54 EST by Kapil Katyal CLA
Modified: 2010-03-08 13:52 EST (History)
5 users (show)

See Also:


Attachments
No beans validation error for EJB 3.x projects (14.00 KB, patch)
2010-02-23 10:29 EST, Stefan Dimov CLA
no flags Details | Diff
No beans validation error for EJB 3.x projects v2 (14.89 KB, patch)
2010-02-24 12:42 EST, Stefan Dimov CLA
kaloyan: iplog+
Details | Diff
patch v3 (16.59 KB, patch)
2010-02-26 10:00 EST, Kaloyan Raev CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kapil Katyal CLA 2005-12-05 15:54:57 EST
Previously, when creating a new EJB project, there was an option to create a default session bean.  In current WTP drivers, I don't see this option anymore.

Is there a way to create a default session bean programmatically during the EJB project creation?
Comment 1 Neeraj Agrawal CLA 2006-03-13 12:01:20 EST
*** Bug 131406 has been marked as a duplicate of this bug. ***
Comment 2 Neeraj Agrawal CLA 2006-03-15 13:41:22 EST
*** Bug 129195 has been marked as a duplicate of this bug. ***
Comment 3 Kaloyan Raev CLA 2008-04-10 08:30:30 EDT
This could be consider for the next post-Ganymede release. 
Comment 4 kiril mitov CLA 2008-08-14 03:46:55 EDT
(In reply to comment #0)
> Previously, when creating a new EJB project, there was an option to create a
> default session bean.  In current WTP drivers, I don't see this option anymore.
> 
> Is there a way to create a default session bean programmatically during the EJB
> project creation?
> 
Is this still relevant?
In an EJB 3.0 project the ejb-jar.xml is optional. There might be 0 or * beans in the project.

Or you would like to see the option only for EJB 2.1< projects?
Comment 5 Kaloyan Raev CLA 2008-08-25 05:03:49 EDT
It is still relevant - even for EJB 3.x modules without ejb-jar.xml. In this case the EJB JAR archive is just an ordinary JAR archive. The only thing that makes it EJB JAR is the annotated bean classes in it. If there is not such class then it is not an EJB JAR. 

In WTP if you have an EJB 3.0 project without ejb-jar.xml and no bean, then it cannot be exported as valid EJB JAR. Many server runtimes like Glassfish and JBoss fails deploying such JARs, complaining that there is no EJB bean there. 

So, in EJB 3.0 you still need 1 or * beans in the project. 
Comment 6 Kaloyan Raev CLA 2010-02-10 09:45:05 EST
We will try to implement this enhancements for EJB 3.0 projects in two steps:
  - implement validation that shows error marker when an EJB 3.0 project has no enterprise bean. 
  - implement two quick fixes for the error marker: "Create Session Bean" and "Create Message-Driven Bean". Each of the quick fixes will call the corresponding wizard.
Comment 7 Stefan Dimov CLA 2010-02-23 10:29:39 EST
Created attachment 159938 [details]
No beans validation error for EJB 3.x projects

    I've created a validator (v2) for this problem which shows error on the EJB 3.x project with two quick fixes available allowing the user to open wizards for new session or message-driven bean. 

    It works fine except for the only problem that the validator could be triggered only manually. Perhaps I've implemented something wrong since the validator doesn't trigger when I add/delete a bean from the project. 

    I've debugged it and appears that when I add/delete a bean from the project the method AbstractValidator.validationStarting(...) is being invoked by the framework, but later the UIEJB3Validator.validate(...) method(s) are not invoked.

    Any ideas?
Comment 8 Stefan Dimov CLA 2010-02-24 12:42:25 EST
Created attachment 160088 [details]
No beans validation error for EJB 3.x projects v2

    This version of the patch works fine. But there is a little hack in it. I'm using the fact that the validationStarting(...) method of my validator is being invoked when it's supposed to and in its body I'm invoking the actual validation. 

    If somebody has an idea how to implement it better, please share it.
Comment 9 Kaloyan Raev CLA 2010-02-26 10:00:37 EST
Created attachment 160305 [details]
patch v3

Thanks for the patch. Everything is functionally correct. 
I just made some structural and cosmetics changes to the contribution. The most significant is that I moved the UI related code to the jee.ui plugin. This way we avoid the UI dependencies in the jee.ejb plugin.
Comment 10 Kaloyan Raev CLA 2010-02-26 10:03:53 EST
Patch v3 committed to HEAD.
Comment 11 Carl Anderson CLA 2010-02-26 15:02:48 EST
This caused a dependency cycle between jst.jee.ui (where you added a prereq to jst.ejb.ui) and jst.ejb.ui, which already prereqs jst.jee.ui.
Comment 12 Carl Anderson CLA 2010-02-26 15:44:33 EST
I moved everything you added to org.eclipse.jst.jee.ui over to org.eclipse.jst.ejb.ui - that is the quickest way to fix things up short term.

I also noticed that none of the new .java files nor the new .properties file has the EPL header in it.  (Except for the Messages.java, which has an old IBM EPL header - that should be fixed up, too.)

Please review my changes and fix up as appropriate.
Comment 13 Kaloyan Raev CLA 2010-03-01 06:28:29 EST
Thanks, Carl!
I added the missing copyright headers.
Comment 14 Carl Anderson CLA 2010-03-01 12:35:34 EST
One last change- in UIEJB3Validator, it checks to see if the total number of session and message driven beans are 0.  There are circumstances where ejbJar.getEnterpriseBeans() returns null, and this should display the validation error.  And there are times where an EJB project could have an Entity bean in it - this should not display the validation error.

I am committing a change to HEAD for UIEJB3Validator to fix those scenarios.
Comment 15 Carl Anderson CLA 2010-03-08 13:52:55 EST
One last, last change - the org.eclipse.jst.ejb.ui.internal.quickfixes.ejb was not listed in the Export-Package section of the MANIFEST.MF for org.eclipse.jst.ejb.ui.  I am adding it in as an internal package.