Fix ApplicationResourceIntegrationTest

- can get back json or plain string from
  client().resource(stateSensor).get(String.class);
  accept either
Fix MemoryUsageTrackerTest

- was non-deterministic (asserting memory usage immediately, before
  listener had been called by GC)
Fix yaml use of SshCommandSensor

- Was causing failure of VanillaBashNetcatYamlTest
- SshCommandSensor constructor expects ConfigBag, rather than Map.
- Change BrooklynYamlTypeInstantiator.newInstance to look for a
  <init>(ConfigBag) constructor as well.
- Fix `Class AddSensor.getType("String")` so it tries prepending
  "java.lang." as well
- set poll period to 100ms in yaml (instead of default 5 minutes)
Fix SshCommandIntegrationTest

- Change sensor period to 100ms, from default 5 mins.
  Otherwise if first poll happens before serviceUp=true, it will
  timeout in 30 seconds without a second poll.
Fix HttpRequestSensorTest.testHttpSensor

- Change sensor period to 100ms, from default 5 mins.
  Otherwise if first poll happens before serviceUp=true, it will
  timeout in 30 seconds without a second poll.
BROOKLYN-83: fix SensorResourceTest

- On getting a sensor, if no "Accepts" header is given, then we don't
  control whether json or plain text comes back.
  It is dependent on the method order, which is compiler-specific.
- Therefore delete the test that gave no Accepts and then asserted
  it was json.
BROOKLYN-85: fix FixedListMachineProvisioningLocationTest
This closes #326
make heartbeat timeout (to trigger failover) and poll period configurable from brooklyn.properties
clean up copyPersistedState code

move shared code to new `BrooklynPersistenceUtils`,
make a new `LocationWithPersistenceStore.newPersistenceObjectStore` interface,
and add documentation for `copy-state` command
support for exporting persistent state
more persistence, mainly tidying code to treat all BrooklynObject instances the same
Create backup of persistent stores at key times

Created on master promotion (technically just before persistence starts) by reading from the store,
and on demotion by HA subsystem by reading from local in-memory model.

Includes new BrooklynServerPaths cleaning up logic from BrooklynServerConfig, and some cleanups to the utils in BrooklynPersistenceUtils.
Relevant config keys are the *PERSISTENCE*BACKUP* options in BrooklynServerConfig.

Logging now looks like this:

     2014-11-11 13:46:06,153 INFO  Rebinding from /Users/alex/.brooklyn/brooklyn-persisted-state/data...
     2014-11-11 13:46:06,409 INFO  Rebind VanillaSoftwareProcessImpl{id=wGwL3QXG} connecting to pre-running service
     2014-11-11 13:46:06,606 INFO  Rebind complete (MASTER) in 669ms: 1 app, 2 entities, 14 locations, 0 policies, 9 enrichers, 0 feeds, 0 catalog items
    *2014-11-11 13:46:06,697 INFO  Back-up of persisted state created on promotion, in /Users/alex/.brooklyn/brooklyn-persisted-state/data/backups/2014-11-11-1346-oZyOou3V-promotion-s5kE
     2014-11-11 13:46:26,362 INFO  REST using security provider brooklyn.rest.security.provider.BrooklynUserWithRandomPasswordSecurityProvider
     2014-11-11 13:46:26,363 INFO  Allowing access to web console from localhost or with brooklyn:Ao3m5nZoe9
    *2014-11-11 13:46:46,825 INFO  Back-up of persisted state created on demotion, in /Users/alex/.brooklyn/brooklyn-persisted-state/data/backups/2014-11-11-1346-oZyOou3V-demotion-XYlN
     2014-11-11 13:46:47,045 WARN  Management node oZyOou3V detected master change, from  (?) to orZg7gai (1415713606000 / 1.05s ago) http://almacretin.local:8082/
     2014-11-11 13:46:47,059 INFO  Rebind complete (HOT_STANDBY, iteration 0) in 220ms: 1 app, 2 entities, 14 locations, 0 policies, 9 enrichers, 0 feeds, 0 catalog items

In future it would be nice to have periodic backups and some automatic clean-out support ... but for another day!
Use a linear range QuorumCheck to fail if there are too many dangling references.

This introduces QuorumChecks.newLinearRange which allows specifying points in a place
to define a set of line segments defining the quorum.
This can be TypeCoerced from a string, e.g. `[[5,5],[10,10],[100,70],[200,140]]`
(with things like `all` and `atLeastOne` also supported).

Such a range is then used to cause rebind to fail if there are a lot of dangling references.
The precise number is allowing 2 for small values, scaling to 5% at big values,
but this can be tweaked using RebindManagerImpl.DANGLING_REFERENCES_MIN_REQUIRED_HEALTHY
aka rebind.failureMode.danglingRefs.minRequiredHealthy .  (e.g. set this to all in
brooklyn.properties to cause rebind to fail if there are any dangling references;
but note this can occasionally fail if something is deleted as different items are
not persisted simultaneously).

Also:
* There are also some tidies to how `RebindContext` is used, since many of the
  dangling references weren't being caught
* We are stricter about persisting proxies, since that doesn't work (type written as `$Proxy16`)
* We tolerate remote timestamps in persisted objects (since these can occur in backups, currently);
  we don't *use* those timestamps for anything (except in tests when they can be `prefer`red),
  but there is no harm in having them, if someone copied across backup persistence files
Add a HOT_BACKUP mode where nodes are read-only copies but NOT willing to be master.
Make metrics on rebind, persistence, and HA available through REST API.

So that a management plane or human can determine server health and historic problems.
a few more goodies, coercing strings and maps to location and other fixes

where new Object() was used in persistence, it would not serialize nicely, and also it would not deserialize to the same (NONE instance) value; fix the logic for BasicParameterType defaults including null, and then when testing discovered problems if we passed Strings in, so fix that
code review to #314, use enum and create unmanaged location
specify a filename when people download service state
fail fast if invalid mode given via REST API