Adding Tomcat runtime configuration via plugin [message #181303] |
Tue, 10 October 2006 14:06 |
Eclipse User |
|
|
|
Originally posted by: twojenski.itgp.com
Hi,
We need our plugin to be more closely integrated with WTP. Can anyone tell
me what would be the best way of adding a tomcat runtime configuration
programmatically from with in the plugin? We want to eliminate the steps of
configuring Tomcat for our end users via the current wizard. Our plugin
knows of the tomcat location already, and it would be very 'user friendly'
for our plugin to pre-configure a New Server Runtime for Tomcat 5.5.
I'm currently looking at the TomcatRuntimeComposite class for inspiration,
but I can not find APIs how to: 1) Create a new IRuntime & 2) Add this new
IRuntime back to eclipse (SeverCore?).
Any help will be greatly appreciated.
Tek
|
|
|
Re: Adding Tomcat runtime configuration via plugin [message #181317 is a reply to message #181303] |
Tue, 10 October 2006 15:18 |
|
You need to create a RuntimeWorkingCopy. Take a look at ResourceManager,
inside of wst.server
"Tek" <twojenski@itgp.com> wrote in news:egg9cn$kus$1@utils.eclipse.org:
> Hi,
> We need our plugin to be more closely integrated with WTP. Can anyone
> tell me what would be the best way of adding a tomcat runtime
> configuration programmatically from with in the plugin? We want to
> eliminate the steps of configuring Tomcat for our end users via the
> current wizard. Our plugin knows of the tomcat location already, and
> it would be very 'user friendly' for our plugin to pre-configure a New
> Server Runtime for Tomcat 5.5.
>
> I'm currently looking at the TomcatRuntimeComposite class for
> inspiration, but I can not find APIs how to: 1) Create a new IRuntime
> & 2) Add this new IRuntime back to eclipse (SeverCore?).
>
> Any help will be greatly appreciated.
>
> Tek
>
>
>
Regards,
--
Angel Vera
WTP Server Tools Developer
|
|
|
Re: Adding Tomcat runtime configuration via plugin [message #181332 is a reply to message #181303] |
Tue, 10 October 2006 15:59 |
Eclipse User |
|
|
|
Originally posted by: kosta.bea.com
The API that you need is in org.eclipse.wst.server.core. You first need
to retrieve the IRuntimeType object that corresponds to the tomcat
runtime of the appropriate version. You can do that using the ServerCore
class. Once you have the IRuntimeType object, it has a factory method
for creating an IRuntimeWorkingCopy. You create the working copy, fill
it out and use the save method to persist your changes. That adds the
runtime to the workspace. Also, make sure to call validate prior to
calling save to make sure that you are not saving a mis-configured runtime.
- Konstantin
|
|
|
Re: Adding Tomcat runtime configuration via plugin [message #181348 is a reply to message #181332] |
Tue, 10 October 2006 17:48 |
Eclipse User |
|
|
|
Originally posted by: twojenski.itgp.com
Konstantin, thank you very much! Your comments were very detailed and I was
able to implement this in 15 minutes.
If I can ask a follow up question. Once a IRuntimeWorkingCopy is defined
and saved, what are the APIs to locate it? I do not want to add the server
if it is already there.
Thanks
Tek
"Konstantin Komissarchik" <kosta@bea.com> wrote in message
news:eggg1c$sst$1@utils.eclipse.org...
> The API that you need is in org.eclipse.wst.server.core. You first need to
> retrieve the IRuntimeType object that corresponds to the tomcat runtime of
> the appropriate version. You can do that using the ServerCore class. Once
> you have the IRuntimeType object, it has a factory method for creating an
> IRuntimeWorkingCopy. You create the working copy, fill it out and use the
> save method to persist your changes. That adds the runtime to the
> workspace. Also, make sure to call validate prior to calling save to make
> sure that you are not saving a mis-configured runtime.
>
> - Konstantin
|
|
|
Re: Adding Tomcat runtime configuration via plugin [message #181367 is a reply to message #181348] |
Tue, 10 October 2006 18:16 |
Eclipse User |
|
|
|
Originally posted by: kosta.bea.com
Try ServerCore.getRuntimes(). You would need to iterate over the
runtimes, check their types, and then look at the location. Or you can
use ServerCore.findRuntime( String name ) if you only care whether a
runtime with a certain name is defined.
- Konstantin
|
|
|
Powered by
FUDForum. Page generated in 0.04092 seconds