Delayed approval mechanism [FIXED JENKINS-11409]

This patch introduces the possibility for a delayed approval to be sent
back to Gerrit. This is a relatively advanced use case, so the setting
has been placed in the Advanced section for the Trigger settings.
When one selects "delayed approval", the completion of the build will
NOT send an approval back to Gerrit. Instead, the triggering event stays
open, and needs to be closed later on. This can be done by using the new
post-build action "Send a Gerrit delayed approval". At the moment, this
notifier expects to read the name of the job and build number from build
variables. If these point to an existing build which has a Gerrit event
as a trigger, which has not been submitted due to "delayed approval",
then that approval will be sent. In particular, this allows to modify
the status of that build through other job (e.g., using Groovy scripts),
and mark it UNSTABLE (e.g., if a subsequent build were to fail), which
is a way one can change the result of the Approval in Gerrit.

Amends: fixed broken style and broken unit tests
Placed proper copyright
Fix deserialization issue caused by ManualPatchsetCreated class move

xstream compatibility alias was defined when the class was moved from
the gerrit-event to the gerrit-trigger but TriggerContextConverter is
not using xstream mapper. Modify TriggerContextConverter to use xstream
mapper instead of java class forName method.

Change-Id: I3280257e1740f5c0612400de4ccd0e862ace1250
Fix provider url which was always empty

Modify GerritConnection to have the gerritFrontEndUrl so it can create
provider with a url instead of creating it with an empty url.

Change-Id: I58c82892668567afc77b78f2cf2d0c616124075f
Fix changeIdAnnotator when annotating a build configured with anyServer

ChangeIdAnnotator was using the serverName configured at the job level
to find the front end url of the gerrit server but it is failing when
job is configured with "Any Server" as server name.

Use the gerritCause of the build instead to find the url of the gerrit
server.

Change-Id: I08332e788c5f23417425599d2ab60fb41fde0f92
Added unit-test, general cleanup

- Added a unit-test to lock the delayed approval mechanism in the
  "normal" scenario
- Added some output in the build console for the delayed approval
- i18n of the user facing delayed approver texts
- Did some minor code refactoring
Merge pull request #122 from yannack/delayedApprove

Delayed approval mechanism [FIXED JENKINS-11409]
Merge pull request #129 from hugares/deserialization-fix

Fix deserialization issue caused by ManualPatchsetCreated class move
Merge pull request #130 from hugares/change-id-annotator-fix

Fix ChangeIdAnnotator for "Any Server" option
Prevent to update project list for pseudo servers

In pseudo mode, gerrit server does not have valid parameter values for
ssh connection. So project list updater cannot run.

This patch disables updater if gerrit server is pseudo mode.

We would need to enable this when updater will become to use REST API.
Avoid errors and warnings in pseudo mode

In pseudo mode, errors and warnings produced by AdministrativeMonitor
should be disabled.
Merge pull request #131 from rinrinne/admin-monitor

Fix pseudo mode
Add receivedOn time stamp to GerritTriggeredEvent.

Gerrit events can be processed by more than one thread so there is no
garantee that events listeners will get notified for each event in the
same order they were received. Add receivedOn time stamp so listeners
have a way to know if an event came in before/after another one.

Change-Id: I566b6ee2263729e6df2409ebe1dc62110053b9e1
Add RepositoryModifiedEvent interface

RepositoryModifiedEvent represents any event raised by a ref created/changed in
the git repository (PatchsetCreated, DraftCreated and RefUpdated).

An example of usage is the gerrit-trigger: to implement wait for
replication feature, when a GerritEvent is interesting, it must wait
for replication to be complete before starting the build but only for
events that created/changed a ref in the git repository.

Change-Id: Icaec80452e4753ee80b38084978953578b488514
Ugrade Jenkins to 1.509.3

There is an issue with dynamically filled drop down that depends on
another field in the form. If the drop down is nested in the form,
we are supposed to use @RelativePath in addition to the @QueryParameter
but this is not working in 1.480.

Change-Id: Ide59afe293d3dae8171ecd86f75cd38c25583387
Add data structure and UI Support for replication.

The admin can enable replication in server configurations,
add Gerrit slaves, and enable slave selection in jobs.
If the latter is enabled, the user will see a dropdown
containing a list of Gerrit slaves configured with the
Gerrit server that has been selected, and can choose one
slave after which the job will wait for replication events.

Change-Id: Id08852619442290b3b5c8e2f179d10989e98b1af
Implement feature to block build until replication is completed.

Add ReplicationQueueTaskDispatcher that will prevent builds from
leaving the queue until the replication is completed, if replication
is supported and configured for that server. If wait for replication
event times out or if the replication failed, build will be failed.

Add a global configuration parameter to allow configuration of
replication cache expiration time. Replication feature requires a
cache for replication events until we can complile against Jenkins
1.520 which introduce a QueueListener extension point.

Change-Id: I58782c2278c1ef68cae405495178c1ea89e279b8
Merge pull request #133 from hugares/replication

Add feature to wait for replication to gerrit Slave