BZ 971556 async avail checking for all resources

Squashed commit of the following:

commit 9b165c2dff93a62aac2b71ea427926fc457e1ef0
Merge: 8452615 c954eda
Author: John Mazzitelli <mazz@redhat.com>
Date:   Tue Dec 3 16:58:48 2013 -0500

    Merge remote-tracking branch 'origin/master' into jay-avail

commit 845261576ac892a029eac88b66ad7fd44d37d4f5
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Tue Dec 3 11:36:48 2013 -0500

    Changes to AvailabilityProxy
    - support test code tweaking the various configurable values.
    - save 3 bytes per proxy by making the sync timeout limit a byte type
    - add some commented out dev logging, to be removed later as desired
    Work on AvailabilityProxyTest
    - add testing for the new async timeout stuff
    - add testing for the sync disable/enable

commit d816b80f5b9352d2b006d8fa386d513b905a415d
Merge: 2935dec 7fe7f7e
Author: John Mazzitelli <mazz@redhat.com>
Date:   Mon Dec 2 07:48:01 2013 -0500

    Merge branch 'jay-avail' of ssh://git.fedorahosted.org/git/rhq/rhq into jay-avail

commit 2935dec7f2e19de84573342634c91865f49fe358
Author: John Mazzitelli <mazz@redhat.com>
Date:   Wed Nov 27 12:44:18 2013 -0500

    get avail proxy test to pass. we no longer assume that we need to abort if the first time we check if the future is done and it is not.
    instead, we check the time when the future was submitted. if its been under a certain time (1m by default), then
    we just return the last avail known to have been returned. otherwise, we timeout.

commit b3c22b2c2ff738e18b790e6bcec3cdf95bcee54d
Author: John Mazzitelli <mazz@redhat.com>
Date:   Wed Nov 27 10:28:09 2013 -0500

    fix up the test - this is still failing, but took out some unnecessary things

commit d8a53868d780dab5deb1a02d2e425948f2380b3f
Author: John Mazzitelli <mazz@redhat.com>
Date:   Wed Nov 27 10:27:02 2013 -0500

    To reduce the memory footprint of the proxy, make logger static.
    We don't want one logger instance per proxy.

commit 329596096f3a947acb16e322aa456bc394bf971e
Author: John Mazzitelli <mazz@redhat.com>
Date:   Tue Nov 26 18:05:38 2013 -0500

    unit test that illustrates failure that is talked about in BZ 971556, comments #8 and 9.
    this test is disabled for now, since it will fail.

commit ed30ced013679a8c5ba7c6840edae0245258fa66
Author: John Mazzitelli <mazz@redhat.com>
Date:   Tue Nov 26 15:15:00 2013 -0500

    fix logging so its not too noisy

commit 60252bc3f5ccffcb0ab87ab026dd18e36ac985e0
Author: John Mazzitelli <mazz@redhat.com>
Date:   Mon Nov 25 17:34:07 2013 -0500

    part of BZ 971556 - this adds avail scan threadpool setting to agent prefs

commit b9a7d25a955f5f0929e92a353b9ef4c3270c8529
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 15:20:07 2013 -0500

    Fix jdoc for new avail thread pool

commit c30b41059d9dce8db855ada70947ea3b2a653eae
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 15:10:58 2013 -0500

    Quiet the Tomcat plugin by switching some INFO logging to DEBUG

commit 1d0c8f48d4537afc01a02e8103eb8b8d3d398785
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 15:10:27 2013 -0500

    Quiet the JMX plugin by:
    - suffocating INFO messages generated by EMS's ConnectionFactory
    - protecting against an NPE in JMXServerComponent.start when
      connections couldn't be made
    - dumping stack traces in in JMXServerComponent.star in debug only

commit 751857e881856349e47601b22598c36a57f9afcf
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 15:06:55 2013 -0500

    calls to a component's getAvailbility() impl should return UP or DOWN. In
    the case of a timeout on the initial getAvail call to the proxy, it will
    convert an UNKNOWN to DOWN.

commit 621f5d0506167997018a701b4b5f15a92159857f
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 10:58:38 2013 -0500

    Add logging for "enable on change to UP avail"

commit 76274cc629757ac8bfe6a913152570fba3a5f580
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 10:51:37 2013 -0500

    change the prop names such that we use a consistent prefix but so that
    an existing value for rhq.agent.plugins.availability-scan.timeout is not
    used, because the past semantics are different.  We don't want an accidental
    override in an upgrade scenario.

commit df3e5f9327157908a173e0b28e15e8768eaafa6a
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 10:22:17 2013 -0500

    Change the property names to re-purpose existing prop and have others conform
    to the naming.

commit 2924ccaaac56e6994d075c049fea286f867b4a0c
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Fri Nov 22 17:29:54 2013 -0500

    [971556] Better design for availability checking
    Applying Elias's patch and updating with some additional
    logic:
    - use a fixed thread pool to limit thread creation exposure
    - make things configurable
    - allow newly UP resources to use sync avail
    - add some logging and comments

commit 7fe7f7efb4d5754d8a0ebdccaa4604a450f3e0db
Author: John Mazzitelli <mazz@redhat.com>
Date:   Wed Nov 27 12:44:18 2013 -0500

    get avail proxy test to pass. we no longer assume that we need to abort if the first time we check if the future is done and it is not.
    instead, we check the time when the future was submitted. if its been under a certain time (1m by default), then
    we just return the last avail known to have been returned. otherwise, we timeout.

commit ebba986c1b5beb93b16d6a96d0fa9048275d748c
Author: John Mazzitelli <mazz@redhat.com>
Date:   Wed Nov 27 10:28:09 2013 -0500

    fix up the test - this is still failing, but took out some unnecessary things

commit bd327772cdf65afeed256c154fe4b10c7f6e62cb
Author: John Mazzitelli <mazz@redhat.com>
Date:   Wed Nov 27 10:27:02 2013 -0500

    To reduce the memory footprint of the proxy, make logger static.
    We don't want one logger instance per proxy.

commit b2539ee14e487ed58dbf1f041f13420db14965f7
Author: John Mazzitelli <mazz@redhat.com>
Date:   Tue Nov 26 18:05:38 2013 -0500

    unit test that illustrates failure that is talked about in BZ 971556, comments #8 and 9.
    this test is disabled for now, since it will fail.

commit 61bf3197f0d32f2c53e855eb074da662b2e23d1c
Author: John Mazzitelli <mazz@redhat.com>
Date:   Tue Nov 26 15:15:00 2013 -0500

    fix logging so its not too noisy

commit ac1cfd0bf919df79b64848d651f7df31cf214019
Author: John Mazzitelli <mazz@redhat.com>
Date:   Mon Nov 25 17:34:07 2013 -0500

    part of BZ 971556 - this adds avail scan threadpool setting to agent prefs

commit f387ddc361cd525680a0253ab84618dac2d34700
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 15:20:07 2013 -0500

    Fix jdoc for new avail thread pool

commit 8e7f97567327ba25c4a7023e99afd491ee4ec55b
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 15:10:58 2013 -0500

    Quiet the Tomcat plugin by switching some INFO logging to DEBUG

commit 5389dbbfe4b927a603fb2d2369ac87edcc734679
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 15:10:27 2013 -0500

    Quiet the JMX plugin by:
    - suffocating INFO messages generated by EMS's ConnectionFactory
    - protecting against an NPE in JMXServerComponent.start when
      connections couldn't be made
    - dumping stack traces in in JMXServerComponent.star in debug only

commit 61ba50c44f9a5fad9d9d12db9931e6f7a0c2fcb9
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 15:06:55 2013 -0500

    calls to a component's getAvailbility() impl should return UP or DOWN. In
    the case of a timeout on the initial getAvail call to the proxy, it will
    convert an UNKNOWN to DOWN.

commit 602e706c1149637600b221b9fba3f29d6598a72d
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 10:58:38 2013 -0500

    Add logging for "enable on change to UP avail"

commit 9ec2a048c48b7e156b6e4d067f7505f3ef750be3
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 10:51:37 2013 -0500

    change the prop names such that we use a consistent prefix but so that
    an existing value for rhq.agent.plugins.availability-scan.timeout is not
    used, because the past semantics are different.  We don't want an accidental
    override in an upgrade scenario.

commit ac7a01f0376fbe873ede5b2750caa56b89bae1f3
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Mon Nov 25 10:22:17 2013 -0500

    Change the property names to re-purpose existing prop and have others conform
    to the naming.

commit 5f24fca42da6633287ad82c19f2dc4ea4296b8fc
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Fri Nov 22 17:29:54 2013 -0500

    [971556] Better design for availability checking
    Applying Elias's patch and updating with some additional
    logic:
    - use a fixed thread pool to limit thread creation exposure
    - make things configurable
    - allow newly UP resources to use sync avail
    - add some logging and comments
[BZ 1037860] Too many Dashboard tabs disappear off screen. Provide a way to easy navigate many tabs by both scrolling tabs and jumping directly to a dashboard tab.
BZ 997670 - Do not go linearly through the list of resources to find by id, but use a map.

Using a TroveIntObjectMap saves ~1MB heap for an inventory of 40k resources opposed to a standard HashMap
eclipse classpath addition - new trove dep that the plugin container now uses
[BZ 1036681] - Starting page listening on :7080 freezes if the server turns off itself during installation - adding logic that handles the case if the server went down during the installation (or normal startup process). Also externalizing the JavaScript to its own file and linking it to the HTML page.
[BZ 1035501] - Remove Add Graph to Monitor View Menu Item in Resource Tree - Removing the option leading to the old portal war page from the context menu.
[BZ 1038067] - Resource Summary/Activity shows summary of disabled metrics - adding a check that finds out whether the resource has those metrics scheduled. This is done in parallel using the countdown latch pattern.
[BZ 1038270] - NPE when accessing the storage node view immediately after the install - NPE check added
[BZ 1035443] Chart legend not matching the same significant digits as summary metric portlet.
[BZ 1038600] - Back To All Bundles button is not working in Japanese locale - changing getTitle() -> getName(), because it is passed to URL and there are issues with some "non-ASCII" characters.
[1037616] Pull calls to find current availability out of the processing loop
Optimization work based on BZ-supplied patch. For a batch of Availabilities
being processed, pull latest availabilities for the resources  in one DB
round trip as opposed to once for each resource.  Still beiong careful to
repair issues when no, or multiple, latest entries are found.
[1038256] Windows 2008 - Invalid agent service after upgrade (on remote agent machine)
This problem resulted from the work in Bug 1016609, when we introduced
the use of RHQ_JAVA_EXE_FILE_PATH and deprecated the use of
RHQ_AGENT_JAVA_EXE_FILE_PATH (among several simplifications of our
env properties).  The issue with that change was the fact that existing
windows agent services (remote agents, not handled by rhqctl) included
set.RHQ_AGENT_JAVA_EXE_FILE_PATH in the service "path to executable", for
use by the service wrapper.  But the new rhq-agent-wrapper.conf expected
RHQ_JAVA_EXE_FILE_PATH to be set when formulating its command string.

This was only an issue for existing agents that would be auto-upgraded. Agent
auto-upgrade does not update the existing service, it only restarts it after
the agent update. So, the "path to executable" remains unchanged and therefore
passes only the legacy property.  Note that auto-upgrade does the right thing,
it should *not* replace the service in order to update its definition. Doing
this could lose the RUN_AS password, which may have been set interactively
when the agent was initially installed.

The solution should be good, the rhq-agent-wrapper.conf has been reverted to
use RHQ_AGENT_JAVA_EXE_FILE_PATH.  We still completely support the
new RHQ env properties, like RHQ_JAVA_EXE_FILE_PATH, but will supply
the legacy property at service install time.  That gives up backward
compatibility while keeping the use of  RHQ_AGENT_JAVA_EXE_FILE_PATH
internal.
[1037616] Pull calls to find current availability out of the processing loop
Part 2 - batch the pull of ResourceAvailability records that need to
be updated due to changed availability. Pull only the necessary records.
[BZ 1038067] - Resource Summary/Activity shows summary of disabled
metrics - fixing the issue for resource groups (Autogroups and
compatible ones).

Also doing some refactoring, because the same code was in the portlet
for resource and for group, so I moved the common functionality to the
group portled and resource portlet overrides the different parts. What
would be even better is to introduce a common abstract class in the new
package
org.rhq.coregui.client.dashboard.portlets.common (the same way it is
done in the org.rhq.coregui.client.inventory.common package). However,
all the portlets follow this pattern (ResourcePortlet extends
GroupPortles), so it would be inconsistent.

After the refactoring, the code is more flat because the callback hell is
not so evil when using own methods for each callback. The toll for it is
the number of arguments that has to be passed to those methods
representing the state that is needed inside the method.
Bug 1030063 - Clean up plugin update to work synchronously

Make a pause between plugin update attempts
Comment out Query Cache resource type (perf issue)

For the RHQ Server resource only, 2000+ Query cache resources are inventoried.

The resource type will be commented out until we find a proper solution.
[1037616] Pull calls to find current availability out of the processing loop
A fix in the new impl to handle multiple  updates for the same resource in
the same report.  In general an avail report should only have one update for
one resource, but the potential for building up reports looms in the
future, and we do have this scenario in test code.
irc-bot: fixing the !support command
Intern the strings in the KeyType, as they tend to contain the same things over and over again.
Add some more aliases for Jean-Frederic