Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 104622

Summary: Automatically add required Cactus jars to project
Product: [WebTools] WTP ServerTools Reporter: Lawrence Mandel <lmandel>
Component: jst.serverAssignee: Tim deBoer <deboer>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david_williams, deboer, dsomerfi
Version: 0.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
See Also: https://git.eclipse.org/r/107800
https://git.eclipse.org/r/107804
https://git.eclipse.org/r/107834
Whiteboard:
Attachments:
Description Flags
Patch for automatic library attachment
none
Additional libraries required for cactus code
none
Patch for automatic library attachment with external resource plug-in
none
Archive of cactus resource project
none
Patch for automatic library attachment with external resource plug-in
none
J2EE 1.3 Jar
none
Fix for Cactus test wizard on latest Eclipse build none

Description Lawrence Mandel CLA 2005-07-21 02:26:02 EDT
When creating a new Servlet Unit test using Cactus, a dialog warns that the
required Cactus jars are not included in the project and tells where to download
the jars from.

1. The location should be clickable, opening a Web browser to the download location.

2. It will be even better if launching this wizard automatically adds the
required libraries to the project. (I would go as far as to say this is expected
behaviour of an IDE such as Eclipse.) This is how the Web services wizard works
with Axis and I see no reason why it shouldn't work here as well. If we can't
get permission to redistribute Cactus (which shouldn't be a long term problem as
Cactus is an Apache project) we can create a plugin and make it available
through the SourceForge update site.
Comment 1 Daniel R Somerfield CLA 2005-07-21 13:55:53 EDT
I absolutely agree this is a must, however, it will not work until the cactus
stuff resides in its own plugin because otherwise it creates some awkward
circular dependencies.

If we can get this moved out, I agree we should do this.
Comment 2 Daniel R Somerfield CLA 2005-07-28 16:22:40 EDT
Actually, I thin I am wrong about this, we don't need a separate plug-in to get
this particular feature, but another I was thinking of. What we do need to get
the "even better" scenario is permission from the PLT to package Cactus with the
plug-in. I will ping the right people and see if we can't get this process going.
Comment 3 Lawrence Mandel CLA 2005-07-28 16:36:10 EDT
Great. I think you're right. The stumbling block will be legal approval to
redistribute the cactus libraries. Once legal approval is in place the rest
should be easy.
Comment 4 Lawrence Mandel CLA 2005-11-09 18:18:19 EST
Daniel, any progress on this?
Comment 5 Tim Wagner CLA 2006-02-21 09:32:06 EST
The EMO approved inclusion of the Cactus jars; we are cleared to add them for the 1.5 release.
Comment 6 Daniel R Somerfield CLA 2006-03-29 16:29:20 EST
Created attachment 37246 [details]
Patch for automatic library attachment

This patch also requires the forthcoming binaries to be installed. See that attachment for details.

Note: this patch also contains a fix for 106373.
Comment 7 Daniel R Somerfield CLA 2006-03-29 16:33:44 EST
Created attachment 37247 [details]
Additional libraries required for cactus code

These files need to live in the org.eclipse.jst.ui plugin under libraries/cactus/ so the wizard will find and install them when necessary. If there is another convention for binaries dependencies, that is fine with me. Just let me know and we can change the path and the installation code in the wizard.

Incidentally, shipping these jars has been approved.
Comment 8 Daniel R Somerfield CLA 2006-03-29 16:36:36 EST
Hey Tim. Do you mind apply this patch and adding these dependant jars for me?
Comment 9 Lawrence Mandel CLA 2006-03-29 16:45:27 EST
In response to comment #7, our usual approach to redistributing libraries is to create a separate plug-in for the libraries. (Take a look at http://dev.eclipse.org/viewcvs/index.cgi/wst/components/ws/thirdparty/?cvsroot=WebTools_Project for an example with Apache Axis.) 

In this case I'd say you should probably create a plug-in named org.apache.cactus.
Comment 10 Tim deBoer CLA 2006-03-29 16:49:44 EST
Agreed - we should not be repackaging the Cactus jars within this plugin's jar. We'll need to talk to David W. about adding a new plugin.
Comment 11 Tim deBoer CLA 2006-03-29 17:12:56 EST
*** Bug 106373 has been marked as a duplicate of this bug. ***
Comment 12 David Williams CLA 2006-04-14 01:18:52 EDT
BTW, seeing the list of jars in the zip .. I assume all these jars are distributed with Cactus download? Or, are they seperate downloads and projects? 

FYI, learning from bug 104622, we want to be sure to carefully consider what's listed in but cactus bundle manifest.mf. things like "junit" for example, should not be exposed, or there's risk of conflist with the junit that's shipped with eclipse. 

FWIW, You may want to study up on 
http://download.eclipse.org/eclipse/equinox/
Not sure it would be helpful this release ... but, eventually might provide more reuse and less duplication of jars in the distro. 



Comment 13 Lawrence Mandel CLA 2006-04-14 01:23:00 EDT
>but, eventually might provide more reuse and less duplication of jars in the
>distro.

A very important consideration indeed given the continuous growth in size of Eclipse and Eclipse projects. Good point David.
Comment 14 Daniel R Somerfield CLA 2006-04-14 01:47:48 EDT
All the jars are from the cactus distribution. I left some out because they served non-essential tangential purposes. These are the essential dependencies for the cactus runtime.

Incidentally, I packaged these in this plug-in because there was considerable reticence to add any new ones because of plug-in bloat. I am happy to put them in a new one if that is the consensus. Is that the case?

 Assuming it is, I assume someone else will have to put this together for me, since I don’t have committer status. Do I have a volunteer? I would happily do it locally and provide a patch but I have been lead to believe patches don’t deal with binaries too well. 
Comment 15 David Williams CLA 2006-04-14 02:06:38 EDT
(In reply to comment #14)
> ...
> 
> Incidentally, I packaged these in this plug-in because there was considerable
> reticence to add any new ones because of plug-in bloat. I am happy to put them
> in a new one if that is the consensus. Is that the case?

Yes, one new org.apache.cactus plugin is the consensus (can you have a consensus of one? :)  Our convention is to, as much as possible, to keep third party code seperate from org.eclipse code. 


> 
>  Assuming it is, I assume someone else will have to put this together for me,
> since I don’t have committer status. Do I have a volunteer? I would happily do
> it locally and provide a patch but I have been lead to believe patches don’t
> deal with binaries too well. 
> 

Well, gee Dan, seems like you've got that attaching binaries thing working just fine :) So feel free to create a plugin, zip it up, and attach it here. You can follow the xerces one as an example, if that helps. And you can attach a patch for the modifications to the feature.xml that will be needed. You could probably talk me into creating the map file entry for 'ya though :) 
Comment 16 Daniel R Somerfield CLA 2006-04-15 19:02:13 EDT
Is there any reason to put any of these jars on the classpath or in the manifest? I really only need the jars available in binary form so they can be copied into the WEB-INF/lib of the target web project. 

Admittedly, this plug-in would be considerably less useful to other plug-ins if it didn't expose anything, but if we are concerned about exposing too much, then it seems to be exposing nothing solves that problem. If someone needs access to the plug-ins externally (which may never happen), then we can expose them piecemeal.

BTW, what was the name of the bug you meant to refer to, David? 104622 is this bug.
Comment 17 David Williams CLA 2006-04-15 20:35:51 EDT
Oh, sorry Dan, it was bug 130292.  It talks about same things you are. 

And, yes, sounds like these jars would be in a resouce-only plugins. 
And, yes, should not export or list any packages on the manifest.mf
And, unless you already have it all worked out, I'd suggest this one not be 
"packed", as the jars would be easier to copy, or refer to, as files. 

I had not known this was a "resource-only" jar, but, to me, that actually adds to the "ok-ness" of delivering as a seperate plugin, as it does not add to classpath lookup times. And, btw, I agree we would only want to "expose" cactus classes on a manifest with great (huge) justification. Seems that's a whole different use case. 

But, I can envision this (quickly?) becomeing a true plugin, (still with no cactus or junit stuff exposed). Long-term we definitely should have our server-core-adapter code unaware of 'cactus' or any specific plugin. 

Seems there whould be an extension point "test-case-provider" or similar, such that this cactus plugin could provide the interfacing function, so wtp-server stuff could remain blissfully unaware of details. 

Guess its too late in cycle to make this a firm requirement. Has this 
ever been coordinated with TPTP? Don't they have a similar functionality? Can you call this bug to their attention and have them comment? Have you installed "callisto" to confirm there's not odd conflicts with "server testing"? 

Thanks, 

Comment 18 Daniel R Somerfield CLA 2006-04-19 12:16:56 EDT
I guess I have one other question about this. Currently, the new plug-in is not resource-only. I have a tiny bit of code for finding the root directory of the jars via the plug-in class. If it would be better, I can eliminate this, but I need some other way (rather than using the bundle) to find resources from an external plug-in. Is there a standard way of doing that?

As far as TPTP, I talked to them a long, long time ago about this and they expressed interest in integrating with the WTP cactus run-time, but no work has been done on this end to accomplish that, and, I think, none on their end. 

I will let them know about where this and make sure this won't cause any conflicts.
Comment 19 David Williams CLA 2006-04-19 13:53:00 EDT
It really would be best to have resource only ... and, I think easy to do. 
(famous last words :) 

The consuming plugin should be able to "get" the bundle just based on its ID (as a string, semi hard coded in consuming plugin. 

then there's several methods on "Bundle" to try .. findEntries(....)
getLocation()? 

Comment 20 David Williams CLA 2006-04-19 13:53:41 EDT
assigning to dan since he's have such fun with this, so moving tim to cc list. 
Comment 21 Daniel R Somerfield CLA 2006-04-20 12:40:28 EDT
From what I have seen, the only way to do this with a resource-only plug-in is to reach into internal classes. I can get the bundle via InternalPlatform.getBundle(). This seems like the a poor option compared to the others:

1.) Put it back the way it was with the cactus binaries nested inside the plug-in. Unless there is some legal/licensing reason this is a problem, I don't think this is a bad option.

2.) A variation on the above: break out the cactus plug-in into its own containing both the libraries and the eclipse/cactus code. This way the cactus binaries are not sitting in the midst of other jst.server code.

3.) Leave the small bit of code in the org.apache.cactus plug-in. This seems like the least good options since it has the same disadvantage as the above: it mixes 3rd party code with WTP code; not much admittedly, but a little.

Opinions? A new consensus of one?
Comment 22 David Williams CLA 2006-04-20 12:48:23 EDT
Dan, I dont' think internals are needed to get the bundle. 

Bundle cactusBundle = Platform.getBundle("cactusPluginBundleSymbolicName"); 

Should work. That way the only "dependancy" is the string value of the plugin 
name ... if versions, change, easy to swap. If some adoptes have qualms about 
"shipping" or using that third party code, easy for them to leave out. 

I hope I am being helpful, and not missing something obvious you are trying to tell me. 
Comment 23 Daniel R Somerfield CLA 2006-04-20 13:15:06 EDT
Very helpful. Thanks. I missed that somehow, digging around in internal classes. That should do the job.
Comment 24 Daniel R Somerfield CLA 2006-04-20 14:19:31 EDT
Created attachment 39084 [details]
Patch for automatic library attachment with external resource plug-in
Comment 25 Daniel R Somerfield CLA 2006-04-20 14:21:22 EDT
Created attachment 39085 [details]
Archive of cactus resource project
Comment 26 Daniel R Somerfield CLA 2006-04-20 14:25:38 EDT
Ok. Take 2 (or 3 or 4).

Tim? Mind trying that again? The patch needs to be installed and there is a new plug-in project in the attached archive.

Thanks for your help on this Tim and David.
Comment 27 Daniel R Somerfield CLA 2006-04-20 15:32:46 EDT
Created attachment 39090 [details]
Patch for automatic library attachment with external resource plug-in

New version of patch. Fixes some NLS warnings. If, by chance, you have already installed the previous patch, don't worry about it. I can create a patch on top of that at some point.
Comment 28 David Williams CLA 2006-04-26 01:33:16 EDT
FYI, I've broken the tasks in to steps, and 
I've added the resource only jar to the build since that's reduces risk of a build breaks.

Once you confirm its in the build, you can/should verify all is still ok, and then perhaps Tim can apply the rest of the patch (since I'm not really familiar with the  code). 

Note on the jar: Only substantial change was that I changed version number to 1.7.2.qualifier. (For third party code we have a convention that the plugin version be the same as the underlying third party code version). 

Other minor changes, such as to add a "provider", externalize two strings, removed empty jar file. I put code in cvs in a new directory, called "thirdparty" under the jst/server component. 

So, check builds > 4/26 and see if all looks well. 

Comment 29 Tim deBoer CLA 2006-04-28 00:18:19 EDT
Patch applied, fixed JDK 1.5 references and deprecation errors. Checked into 1.5 stream. Will release once the I-build has been declared.
Comment 30 Tim deBoer CLA 2006-05-01 00:25:27 EDT
Changes released to 1.5 stream. Dan, would appreciate it if you can test on one of the next few builds.
Comment 31 Daniel R Somerfield CLA 2006-05-09 13:28:12 EDT
Created attachment 40774 [details]
J2EE 1.3 Jar

Assuming it isn't too late to make the change, it would be great if you could replace the current cactus 1.7.2 jar with this one. There are (unfortunately) two cactus-1.7.2.jar files, one for j2ee 1.2 and one for 1.3. We have the earlier one in there now which works, but breaks the tutorial online slightly. If there is time, please replace it with this one. Thanks.
Comment 32 Daniel R Somerfield CLA 2006-05-09 13:36:36 EDT
Created attachment 40788 [details]
Fix for Cactus test wizard on latest Eclipse build

Again, assuming it isn't too late, could you run this patch against the latest version of the cactus ui code? There is a problem that is preventing the installation of the jars from working correctly.
Comment 33 Tim deBoer CLA 2006-05-09 14:44:26 EDT
Dan, I've released the second patch to 1.5 stream. We shouldn't really keep this bug open for several different things, so please open a new bug to track the new jar file. Since David was running with that part before, please assign the bug to him at least initially.
Comment 34 Daniel R Somerfield CLA 2006-05-09 15:01:28 EDT
I have created 140889 for the jar, but I do not have permission to assign it to David. David, could you grab it or Tim, could you assign it to him? Either way. Thanks.
Comment 35 Daniel R Somerfield CLA 2006-05-16 15:48:18 EDT
Verified on 1.5RC3-200605161544. Worked great. Thanks for the help everyone!
Comment 36 Lawrence Mandel CLA 2006-05-18 17:12:13 EDT
Verified on wtp-sdk-S-1.5RC3-200605162029.
Comment 37 Lawrence Mandel CLA 2006-05-18 17:12:45 EDT
Nice work. Closing bug.
Comment 38 Eclipse Genie CLA 2017-10-11 16:00:31 EDT
New Gerrit change created: https://git.eclipse.org/r/107800
Comment 39 Eclipse Genie CLA 2017-10-11 16:00:49 EDT
New Gerrit change created: https://git.eclipse.org/r/107804
Comment 40 Eclipse Genie CLA 2017-10-11 16:01:33 EDT
New Gerrit change created: https://git.eclipse.org/r/107834