This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 202587 - Profile project action not context sensitive
Summary: Profile project action not context sensitive
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 7.1
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2011-09-23 20:24 UTC by Vince Kraemer
Modified: 2013-08-23 02:40 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
the patch (44.57 KB, patch)
2013-08-15 12:37 UTC, Petr Hejl
Details | Diff
the patch (44.56 KB, patch)
2013-08-15 12:41 UTC, Petr Hejl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vince Kraemer 2011-09-23 20:24:18 UTC
GF clusters and stand-alone instances do not support being started in profile mode.

The 'Start in Profile Mode' action is disabled on the instance node in the servers explorer.

The Profile action is enabled in the right-click menu on a web app project.

The GF plugin implements supportsStartProfiling (Hk2StartServer.supportsStartProfiling(Target)).

It looks like this method is not called before the call to Hk2StartServer.startProfiling(Target,ProfilerServerSettings).

There is a similar problem (context insensitivity) for the Debug item on a webapp's right-click menu.
Comment 1 David Konecny 2011-09-25 22:25:33 UTC
Profile action on project nodes is provided by Profiler module.
Comment 2 J Bachorik 2011-09-26 10:38:14 UTC
There is no API to access to this kind of information from outside of the implementation modules. The "Profile Project" action has no way of knowing the server details.
The only way to implement this functionality without exposing additional data through API is to call Hk2StartServer.supportsStartProfiling(Target) method from Hk2StartServer.startProfiling(Target,ProfilerServerSettings) directly. The action would not be enabled/disabled in UI accordingly to the server type but it would fail lazily when trying to profile a project.
Comment 3 Vince Kraemer 2011-09-26 13:06:40 UTC
It seems supportsStartProfiling(Target) is an exposed SPI that projects should be able to access.

http://bits.netbeans.org/download/trunk/javadoc/org-netbeans-modules-j2eeserver/org/netbeans/modules/j2ee/deployment/plugins/spi/StartServer.html

What else do you need?
Comment 4 J Bachorik 2011-09-26 13:12:21 UTC
Is there a how-to for getting reference to a StartServer instance using SPI/API only? So far I have been only able to get hold of http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-j2eeserver/org/netbeans/modules/j2ee/deployment/devmodules/api/ServerInstance.html and it does not provide access to its StartServer implementation.

Any hints are really appreciated.
Comment 5 J Bachorik 2011-09-26 13:18:48 UTC
There is org.netbeans.modules.j2ee.deployment.impl.ServerInstance class providing getStartServer() method. Unfortunately, this class is not a part of API and there seem to be no other getter for a StartServer instance.
Comment 6 Vince Kraemer 2011-09-26 13:36:45 UTC
Petr: this seems like an api problem in the project<->j2eeserver layer of j2eeserver.
Comment 7 J Bachorik 2011-09-26 13:43:44 UTC
API problem -> reassigning
Comment 8 Petr Hejl 2013-08-14 13:02:59 UTC
This would also allow us to disable profiling in JBoss7 - see issue #228881. I'm working on it.
Comment 9 Petr Hejl 2013-08-15 12:37:31 UTC
Created attachment 138733 [details]
the patch
Comment 10 Petr Hejl 2013-08-15 12:38:15 UTC
Please review.
Comment 11 Petr Hejl 2013-08-15 12:41:37 UTC
Created attachment 138734 [details]
the patch

Minor typo in a bundle fixed.
Comment 12 Petr Hejl 2013-08-21 09:26:02 UTC
Thanks for the review. I'll integrate the change tomorrow.
Comment 13 Petr Hejl 2013-08-22 08:33:59 UTC
Fixed in web-main f93d8c129b4f.
Comment 14 Quality Engineering 2013-08-23 02:40:21 UTC
Integrated into 'main-silver', will be available in build *201308222300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f93d8c129b4f
User: Petr Hejl <phejl@netbeans.org>
Log: #202587 - Profile project action not context sensitive