Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365653 - ADD_TO_EAR property is blocking the EJB Client Jar generation
Summary: ADD_TO_EAR property is blocking the EJB Client Jar generation
Status: RESOLVED FIXED
Alias: None
Product: WTP EJB Tools
Classification: WebTools
Component: jst.ejb (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.3.2   Edit
Assignee: Carl Anderson CLA
QA Contact: Kaloyan Raev CLA
URL:
Whiteboard: PMC_Approved
Keywords:
Depends on:
Blocks: 366621
  Show dependency tree
 
Reported: 2011-12-05 14:06 EST by Zina Mostafia CLA
Modified: 2012-02-07 13:33 EST (History)
4 users (show)

See Also:
ccc: pmc_approved? (david_williams)
ccc: pmc_approved? (raghunathan.srinivasan)
ccc: pmc_approved? (naci.dai)
ccc: pmc_approved? (deboer)
ccc: pmc_approved? (neil.hauge)
ccc: pmc_approved? (kaloyan)
cbridgha: pmc_approved+
kaloyan: review+


Attachments
Add an "ALLOW_EJB_CLIENT" flag (2.98 KB, patch)
2011-12-06 13:49 EST, Carl Anderson CLA
no flags Details | Diff
Add and "ALLOW_EJB_CLIENT" flag (v2) (4.37 KB, patch)
2011-12-06 18:04 EST, Roberto Sanchez Herrera CLA
ccc: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zina Mostafia CLA 2011-12-05 14:06:27 EST
I need to generate an EJB project, and an EJB Client jar project. But I do not want to add the result to an EAR. I have a different containing application that contains both my EJB and EJB Client projects. The property  IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR need to be set to false.
This would disable the page where a user can select to generate an EJB Client Jar.

We tried to set IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR to true, to enable the UI, and then set it to false only when the user selects to Finish, but that did not work either.
Because the underneath Code blocks the EJB Client generation if the IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR is set to false (not only the UI is blocked).  The following code snippet in the EjbFacetInstallDataModelProvider class propertySet() method  is just the tip of the problem:

 } else if (propertyName.equals(ADD_TO_EAR)) {
   			boolean addToEar = (Boolean) propertyValue;
	    	if (!addToEar && isPropertySet(CREATE_CLIENT)) {
	    		model.setBooleanProperty(CREATE_CLIENT, false);  // create client disabled!
	    	} else {

If we leave the IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR to true, the wizard would finish and generates an EAR project , and this is not what we need.
Seems this property is used for a double purpose. It actually means a creation of an EAR project and it is used to enable the EJB Client generation.
Now we either have no Client jar generation , or we have to end up with an EAR getting generated in the workspace. We need to decouple these two logic with two separate flags.

Suggest to add a new flag like ADD_TO_APPLICATION, which does not imply creation of an application, but means that the project would be part of an application.
Comment 1 Carl Anderson CLA 2011-12-06 13:49:05 EST
Created attachment 208013 [details]
Add an "ALLOW_EJB_CLIENT" flag

This seems like the smallest change we could make to support this scenario.  All this does is allow the EJB Client properties to be enabled if the ALLOW_EJB_CLIENT data model flag is set.
Comment 2 Roberto Sanchez Herrera CLA 2011-12-06 18:04:29 EST
Created attachment 208031 [details]
Add and "ALLOW_EJB_CLIENT" flag (v2)

Slightly modified patch. I did some minor changes, and also changed EjbFacetPostInstallDelegate to allow creating the EJB client project even if the EJB project is not in an EAR.
Comment 3 Kaloyan Raev CLA 2011-12-07 02:27:54 EST
I am OK with this change. However, it looks to me more like an enhancement than a bugfix. So, if you want to commit this in the maintenance stream, please get a PMC approval too.
Comment 4 Carl Anderson CLA 2011-12-07 09:56:56 EST
Seeking PMC approval to introduce an enhancement into a maintenance stream.

Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such.

This is requested by an adopter - IBM.

Is there a work-around? If so, why do you believe the work-around is insufficient?

Currently, there is no way for an adopter to reuse our EJB Client jar project creation support outside of an EAR project.  The workaround would be to rewrite the WTP data models and wizards.

How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added?

The fix has been tested by hand and the Java EE JUnit bucket has been run against it.

Give a brief technical overview. Who has reviewed this fix?

A new flag has been added to the data model to allow adopters to programmatically enable the EJB Client jar project support in the data models and operation without requiring an EAR project.  Since the default for the flag is false, this will not effect current WTP behavior.  Carl and Kaloyan have reviewed Roberto's fix.

What is the risk associated with this fix?

The risk is low- the same behavior that exists today will continue, unless an adopter programmatically changes this flag.
Comment 5 Chuck Bridgham CLA 2011-12-08 15:57:22 EST
approved.  allowing the use of this operation within another programming model.

Existing behavior is unchanged
Comment 6 Carl Anderson CLA 2011-12-13 15:32:33 EST
Committed to R3_3_maintenance and HEAD for WTP 3.3.2 and WTP 3.4.0 M5