refactored metric sender into seperate package
fixes as suggested from reviews
fixed json tags for better readability
Merge pull request #866 from mattyw/refactor-metric-send

refactored metric sender into seperate package

Functions that dealt with sending metrics have been removed from state into a new apiserver/metricsender package.
Admin.Login v2 API with v1 fallback.

Squashed commit of the following:

commit 0a1282dfe45047641e85c861bf0ef773371646c8
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Wed Oct 1 08:59:55 2014 -0500

    Improved comments, var name per menn0.

commit 9e6c90e08e0aebd8134b0d51a1c6a9fead1a708e
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Tue Sep 30 21:33:15 2014 -0500

    Pull out repetitive setup statements.

commit bfeb9a919463e21614d268a621b915bfe0b1ad4f
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Tue Sep 30 19:51:41 2014 -0500

    Restore admin.maintenanceInProgress, passthru default login error.

commit 4e8a7458d821a11c7e67a78315da97ebc336da56
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Tue Sep 30 19:30:06 2014 -0500

    Inline err.

commit a1342ee276ebaef0002ddfedee759c093a236e47
Merge: 3369a33 2c0ff10
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Tue Sep 30 16:26:42 2014 -0500

    Merge remote-tracking branch 'upstream/master' into id_loginv2

    Conflicts:
    	apiserver/admin.go
    	apiserver/admin_test.go
    	apiserver/root.go

commit 3369a33088f184a2195b8dd80c8cb7b1bcb66538
Merge: e583c26 4bd4749
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Thu Sep 25 14:23:37 2014 -0500

    Merge remote-tracking branch 'upstream/master' into id_loginv2

commit e583c2631873b4957e7ad7ff9a25fb94d05636e5
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Thu Sep 25 07:55:44 2014 -0500

    Comment fix, added TODOs & explanation of pre-facade login support.

commit 37f77f96d7fbc81842d5bffdb732eb21b15fa1e1
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Thu Sep 25 00:04:41 2014 -0500

    Fixed pre-facade login compatibility.

    Updated loginAncientSuite.TestAncientLoginDegrades to simulate client
    logging in to a pre-facade (1.18) server.

commit d38fe51a8d20e5494c18a63be8b230e7f9f5c8a8
Merge: 748442b e8b23a2
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Wed Sep 24 18:19:14 2014 -0500

    Merge remote-tracking branch 'upstream/master' into id_loginv2

commit 748442b76e41483b1c368522e26e91be660e1c54
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Wed Sep 24 11:22:49 2014 -0500

    Login v1 client backwards compatibility.

    Send a union of params.Creds and params.LoginRequest so that a Login v1
    capable client can log into an older server.

commit 3a8032b1e1bf49795107f296a3ef8f825183fd09
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Tue Sep 23 23:41:09 2014 -0500

    Fixed admin login tests to use new user tags.

commit 0e5dbaa5c2cd91746caddc07a32b9025a038bfbc
Merge: 7597636 658f823
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Tue Sep 23 18:06:47 2014 -0500

    Merge branch 'master' into id_loginv2

    Conflicts:
    	apiserver/params/params.go
    	apiserver/upgrading_root.go

commit 75976361d6cae791c478d99872bf9d97b1888817
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Wed Sep 10 16:02:02 2014 -0500

    Updated validators to use LoginRequest instead of Creds.

commit ad1faca504da97656d51ec879afe1106e1ea17c4
Merge: c217608 219f554
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Wed Sep 10 12:56:55 2014 -0500

    Merge remote-tracking branch 'upstream/master' into id_loginv2

    Conflicts:
    	apiserver/admin.go
    	apiserver/admin_test.go

commit c21760806bb183746d652e1427bdc6cc0806d2bd
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Mon Sep 8 21:12:27 2014 -0500

    Comment fix.

commit b3c6a0f5b3f3500151cfb2904a42dab6c5e339ce
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Mon Sep 8 21:10:27 2014 -0500

    Defensive err checking against nil-value error interface values.

commit 9a6a2c241ae826a28cdbdb0a827ecf1e8271be6e
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Mon Sep 8 21:05:15 2014 -0500

    Refactored login api client versions to reuse common state-setting code.

commit f42b763cb4aa13a719e1b19e964a2f2dd9d063c4
Author: Casey Marshall <cmars@cmarstech.com>
Date:   Tue Jul 22 11:51:14 2014 +1200

    Admin.Login v2 API with v1 fallback.

    Use fail return value for v1 admin Login.

    Use function type instead of interface/struct.

    WIP on admin api dispatch, using rpc server properly.

    More fixes from jam's review & misc.

    Move loggedIn mutex to admin object.
    s/APIHandler/apiHandler/
    Remove commented out srvRoot, no longer needed to test registry.

    Remove ApiFilter.

    Move UpgradingRoot to its own file.

    Further cleanup and fixes.

    Not exposing API types & constructors.
    Fix refactored roots to implement rpc.Killer.
    Simplify API handler setup in Server.

    Add Admin v2 API login request & result.

    Added login v2 API.

    Explicit JSON format annotations.

    LoginResultV2.UserInfo only set for users (not agents).

    Better description of login v2 types.

    API client using login v2 with v1 fallback.

    apiserver.Server defines admin API factories.

    Add test suite for admin API version scenarios.

    Added ValueOfVersion.

    More login v2 test coverage and fixes.

    Revert ping interval from some earlier debugging.

    Remove commented-out debugging sleep.

    upgradingRoot should not be exported.

    Decrement login API version numbers. Proper use of rpc ValueOf.

    Remove rpcreflect ValueOfVersion, checking anonRoot rootName is "Admin"

    Login v0 and v1 share common implementation.

    Underlying impl supports v1 login API. v0 wrapper maps the new response
    type onto the older API result.

    Added unit test coverage of v1 client failure mode on v0 server. Should
    fail even for <1.20 server, as the response type does not match.

    API client loginV1 errors if server doesn't support facades.

    This should take care of the <1.20 case.
    Remove unnecessary facade version sort.

    Pass through FindMethod errors when in upgrade.

    Add client login graceful degradation test case.

    failAdminApi is used to test that a login v1 client will degrade to a v0
    if it is communicating with a pre-1.20 server that does not know about
    API versioning and facades.

    Removed redundant comments from admin tests.

    Updated machine agent to use LoginRequest instead of Creds.

    Fix json struct tags, improve error handling, godoc.

    Moved new adminv1 source file per dfc's refactoring.

    Continued making changes wrt dfc's apiserver refactor.
Merge pull request #874 from cmars/id_loginv2_squashed

Admin.Login v2 API with v1 fallback.

This is a resubmit of pull request #392, to squash the patch & so that the buildbot can read the landing tag. Already LGTM'd.
Merge branch 'master' of https://github.com/juju/juju into networker-mode-based-on-agent-api