       tokens = $wait @tokens.get {user_id: id}
       if tokens.length
         @tokens.remove (token.id for token in tokens)
-
-    # Collections of XAPI objects mapped to XO API.
-    @_xobjs = new $MappedCollection()
-    (require './spec').call @_xobjs
 
     # When objects enter or exists, sends a notification to all
     # connected clients.


    # Exports the map from UUIDs to keys.
    {$UUIDsToKeys: @_UUIDsToKeys} = (@_xobjs.get 'xo')

    # XAPI connections.
    @_xapis = Object.create null

    # This function asynchronously connects to a server, retrieves
    # all its objects and monitors events.

#=====================================================================

class $XO extends $EventEmitter

  constructor: ->
    # These will be initialized in start().
    @servers = @tokens = @users =  @_UUIDsToKeys = null

    # Connections to Xen servers/pools.
    @_xapis = Object.create null

    # Connections to users.
    @connections = Object.create null
    @_nextConId = 0

    # Collections of XAPI objects mapped to XO API.
    @_xobjs = new $MappedCollection()
    $spec.call @_xobjs

  start: (config) ->
    # Connects to Redis.
