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

Bug 323542

Summary: Need to be able to use labels for server status/state other than the existing ones.
Product: [WebTools] WTP ServerTools Reporter: Rajiv Senthilnathan <rajiv.senthilnathan>
Component: wst.serverAssignee: Angel Vera <arvera>
Status: CLOSED FIXED QA Contact: Angel Vera <arvera>
Severity: enhancement    
Priority: P3 CC: david_williams, eyuen7, gregory.amerson, kaloyan
Version: unspecifiedFlags: david_williams: pmc_approved+
arvera: pmc_approved? (raghunathan.srinivasan)
arvera: pmc_approved? (naci.dai)
arvera: pmc_approved? (deboer)
arvera: pmc_approved? (neil.hauge)
arvera: pmc_approved? (kaloyan)
Target Milestone: 3.2.2   
Hardware: PC   
OS: All   
See Also: https://git.eclipse.org/r/108986
https://git.eclipse.org/r/108987
https://git.eclipse.org/r/109833
https://git.eclipse.org/c/servertools/webtools.servertools.git/commit/?id=7d4e1e034827ac64ce51219cc080d2bba9cacb84
Whiteboard: PMC_approved
Attachments:
Description Flags
v1.0 - for 3.2.2 (multi-project patch)
none
sample extension point adopter none

Description Rajiv Senthilnathan CLA 2010-08-24 17:37:00 EDT
Build Identifier: 

My product is built on top of WTP and I need to be able to change the label for the server status from the traditional start, stop, starting, stopping states. I don't see that there is a way to do that with the existing way that the server states are managed.

Reproducible: Always
Comment 1 Angel Vera CLA 2010-08-25 10:38:04 EDT
Rajiv, 

You are right there is no way of doing this. From the conversation that we had offline and looking into the code this would be a pretty simple request to fulfill, I got the code almost ready. We will allow access to change the state label in the UI only, the underlying code and states are the same. Because the underlying code is the same, I will create a new extension point that loads serverLabelProviders per server type and request them to provide a new label, instead of the default provided. 

As I understand you need this function in 3.2.2. Since this is new function and a new extension point in a maintenance release we need PMC approval.
Comment 2 Angel Vera CLA 2010-08-25 11:03:20 EDT
* 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. 
Although this is a not a stop-ship this is new function requested by the adopter in a maintenance release. 

* Is there a work-around? If so, why do you believe the work-around is insufficient? 
There is no workaround for this function

* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 
I will add a JUnit to ensure that we don't break this provisional API, and extension point

* Give a brief technical overview. Who has reviewed this fix? 
The fix in this case is simple. 

There is two places where the state label is requested. This two places will be now combined into one place in the ServerDecorator class. Whenever a request is made for the server state label, we will try to find (in a pre-loaded HashMap) a adopter who has implemented the extension point for a particular server type, if one is given then he will be responsible for providing a translated state label to be displayed in the UI, instead of the default: Started, Starting, Stopped, Stopping, etc.. 

If no adopters are found the LabelProvider will revert back to its original behaviour using a default pre-loaded class. If two or more LabelProvider adopters are found for one server type, to avoid conflict the LabelProvider will be the one default pre-loaded class provided by WTP and a warning will be printed in the log. This ensure that there is always a meaningful label provided for the different states of a server for all types of servers.

The adopter of this extension point is responsible for fast performance to still provide a reasonable UI response of the ServersView.

* What is the risk associated with this fix? 
none to minimal, as this is a new extension point. 

The testing with no providers will guarantee that there is no impact for adopters who do not implement this new extension point. The testing with an extension point will guarantee that the function works correctly, and minimize the bugs, if any.
Comment 3 Kaloyan Raev CLA 2010-08-25 11:15:34 EDT
Sounds like one that I would approve. 
But it is fair to have a patch with the change attached to this bug.
Comment 4 Angel Vera CLA 2010-08-25 12:12:36 EDT
Created attachment 177438 [details]
v1.0 - for 3.2.2 (multi-project patch)

Sorry for the delay on adding the patch. I was doing some final adjustment to the code adding javadocs and jUnit. 

The attached is a multi-project patch that contains all the changes for:
 org.eclipse.wst.server.ui 
 org.eclipse.wst.server.ui.tests
Comment 5 Angel Vera CLA 2010-08-25 12:14:05 EDT
Created attachment 177439 [details]
sample extension point adopter
Comment 6 Angel Vera CLA 2010-08-25 16:10:26 EDT
Changes committed to 32M
Comment 7 Angel Vera CLA 2010-08-25 16:12:27 EDT
changes released to 32M
Comment 8 Angel Vera CLA 2010-08-25 16:23:39 EDT
changes committed to HEAD (3.3)
Comment 9 Angel Vera CLA 2010-08-25 16:25:17 EDT
changes released to HEAD(3.3)
Comment 10 Eclipse Genie CLA 2017-10-11 16:34:33 EDT
New Gerrit change created: https://git.eclipse.org/r/108986
Comment 11 Eclipse Genie CLA 2017-10-11 16:34:36 EDT
New Gerrit change created: https://git.eclipse.org/r/108987
Comment 12 Eclipse Genie CLA 2017-10-11 16:53:51 EDT
New Gerrit change created: https://git.eclipse.org/r/109833