Move purge settings to a new "Advanced Purge Settings" group (hidden by default)
Bug 1145776 - RHQ_PARTITION_EVENT data not purged automatically

Added partition event and partition event details purge
It's disabled by default and configurable through System Settings.

Added partition event test in DataPurgeJobTest

Also, refactoring DataPurgeJob and DataPurgeJobTest
Bug 1139433 - Deadlock in deletion of RHQ_RESOURCE_ERROR, possibly in resource upgrade?

When saving a resource error, we first delete existing errors if the error type is one of:
* INVALID_PLUGIN_CONFIGURATION
* AVAILABILITY_CHECK
* UPGRADE
I'm not sure why we don't if the error type is DISABLED_TYPE.

The goal is to keep only one copy of these error types.

Here's my analysis of the deadlock report attached to the BZ.

Due to the type of locks (row locks) and the queries involved, it looks like the deadlock is the consequence of concurrent calls to ResourceManagerBean#clearResourceConfigErrorByType with the same parameters. Such concurrent calls would not necessarily lead to a deadlock. It would happen only if the row locking order is different. My knowledge of Oracle is limited but I'd say this is possible if the two queries get a different execution plan. I tried to figure out why the same query could lead to a different execution plan and one possible reason would be that one is using the index on resourceId and the other one is not.

This commit addresses the issue by changing the way previous errors are deleted. Now before delete we select an ordered list of primary keys. Then we delete the rows by primary key. Consequently, two competing sessions will never lock rows in different orders.

There's another issue due to the way resource errors are implemented. Two competing sessions will delete previous errors but both will insert a row. A DataPurgeJob task has been added to remove such duplicates, if any.
Bug 1139433 - Deadlock in deletion of RHQ_RESOURCE_ERROR, possibly in resource upgrade?

I checked Git history. From the looks of it, DISABLED_TYPE was added later in the game.
To me there's no reason why we let more than DISABLED_TYPE error per resource be persisted.
Bug 1145778 - Purge RHQ_RESOURCE_ERROR table as well

The fix for "Bug 1139433 - Deadlock in deletion of RHQ_RESOURCE_ERROR, possibly in resource upgrade?" enforces "only single error of a type for a given resource".

This change is to clear stale AVAILABILITY_CHECK errors (if a resource AVAIL is up, then there's no need to keep the resource error)

* INVALID_PLUGIN_CONFIGURATION -> auto cleaned when the agent starts the resource container.
* UPGRADE -> we need to keep it to inform the user
* DISABLED_TYPE -> we need to keep it to inform the user
Bug 1131726 - Data from RHQ_CONFIG_UPDATE never purged

Remove old resource config and group resource config updates from the
database.

The configuration and configuration properties entities get removed as
well.

An old config update may stay in the database if it is the last successful one.

An old group config update may stay in the database if one of the
children config update is the last succesful one for the target resource.
Bug 1139189 - If a server is in 'MAINTENANCE' mode, should be indicated to
user on login

Now we display sticky warning in case mainenance mode is detected after
login. This does not add a check for server mode to every request, just the
first request after login - this is when we build CoreGui
[BZ 1003211] Adds automatic recovery information to the alerts if there's a recovery alert fired.

[BZ 1003211] Add hovering support, and also add naming filter to the reports & REST interface
[BZ 1070262] Adding one missed property to the list of @RESTRICTED properties for the agent configuration file.
Adding stellar.yaml (config for database snapshot tool) to the .gitignore
[BZ 1160265] - Cannot select/unselect permissions while creating roles on Firefox 29
I18N work
- backport near-complete German l10n
- backport near-complete Japanese l10n
- remove the far from complete Russian l10n
- remove a couple of redundancies
- comment out some untranslated properties (as per convention)
[1160682] Upgrade from JON3.1.2 to JON 3.3 CR01 with run-data-migrator option shows AuthenticationExceptio
This happened because the storage cluster schema is not yet created.  It
won't exist until 'rhqctl upgrade --storage-schema' is executed, after all
RHQ Servers have been upgraded and standalone SNs have been installed.

Removed the rhqctl upgrade '--run-data-migrator' option.  This option really
should never have existed, as for anything other than a basic topology it
would have failed, even in the past.  The data migration must be performed
after the full upgrade has completed, including the --storage-schema option,
using the command line tool: 'bin/rhq-data-migration.sh|bat <options>'

Also updated the upgrade/list-versions report to better instruct users
performing pre-storage-cluster upgrades (e.g. jon 3.1.2)
Include rhqapi.js as CLI module
[1160669] Failed upgrade of standalone storage node is not correctly rolled back
This was true of any storage node upgrade failure, not just the new
db properties issue reported.  But the new properties is the most likely
new reason for a failure.  Changes to fail the overall upgrade on any
non-OK status returned from the storage upgrade.  This shouldbe safer, and
prevents the server from trying to upgrade if the storage upgrade has an
issue.

Also:
- added a specific error exit code for version stamp failure
- enhanced some undo task log messages
BZ 1160851 - add the ability to wait for N seconds while testing for the server to come up. Default is 60s, but there is now a backdoor sysprop you can set if you want it to be longer or shorter.
Bug 1133590 - Unable to login in to 'Red Hat Access' in IE

After investigation with chindley, the issue is fixed on JON side, just by
adding IE=10; to X-UA-Compatible meta. IE9 won't work anyway, because it
does not support CORS
[1092707] If re-install is attempted using a different storage node host name, install fails
During install, contact the storage cluster using the DB defined storage
nodes if they are already managed (at least one is linked to a resource),
otherwise defer to the rhq.storage.nodes property value and redefine the
persisted storage nodes with the [potentially] updated addresses.
[BZ 1161806] Fix the slice being wrongly computed after a DST transition. If the duration of the time slice is more than one hour, account for the timezone offset and adjust the time slice start time. This will address the issue where the query for time slice data was not returning data due to the a skewed start time.
Ensure that the server and agent scripts propagate SIGTERM in foreground mode

Supervisord requires that programs (1) don't daemonize themselves and
(2) respond to SIGTERM by properly shutting down. Requirement (1) is satisfied
provided one uses the following commands:
- rhq-server/rhq-storage/bin/cassandra -f
- rhq-server/bin/internal/rhq-server.sh console
- rhq-agent/bin/rhq-agent.sh -d
This patch modifies rhq-server.sh and rhq-agent.sh so that they also satisfy
requirement (2). Note that Cassandra already satisfies that requirement because
the script uses exec to launch the JVM.

With this change, RHQ can be properly configured to run under Supervisord, e.g.
in a Docker container.