Call this function to initialize the domain.
@param {Function} callback the function that will be called when this action has finished [optional]
`function(err, warnings){}`
976121
function (callback) {

    var self = this;

    var warnings = null;


    async.series([
      // load domain files...
      function (callback) {
        debug('load domain files..');
        self.structureLoader(self.options.domainPath, self.validatorExtension, self.options.useLoaderExtensions, function (err, tree, warns) {
          if (err) {
            return callback(err);
          }
          warnings = warns;

          if (!tree || _.isEmpty(tree)) return callback(new Error('No structure loaded for ' + self.options.domainPath + '!'));

          self.tree = attachLookupFunctions(tree);
          callback(null);
        });
      },

      // prepare infrastructure...
      function (callback) {
        debug('prepare infrastructure...');
        async.parallel([

          // prepare eventStore...
          function (callback) {
            debug('prepare eventStore...');

            self.eventStore.on('connect', function () {
              self.emit('connect');
            });

            self.eventStore.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.eventStore.init(callback);
          },

          // prepare aggregateLock...
          function (callback) {
            debug('prepare aggregateLock...');

            self.aggregateLock.on('connect', function () {
              self.emit('connect');
            });

            self.aggregateLock.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.aggregateLock.connect(callback);
          },

          // prepare commandBumper...
          function (callback) {
            if (!self.commandBumper) {
              return callback(null);
            }
            debug('prepare commandBumper...');

            self.commandBumper.on('connect', function () {
              self.emit('connect');
            });

            self.commandBumper.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.commandBumper.connect(callback);
          }
        ], callback);
      },

      // inject all needed dependencies...
      function (callback) {
        debug('inject all needed dependencies...');

        self.commandDispatcher = new CommandDispatcher(self.tree, self.definitions.command, self.commandBumper);
        self.tree.defineOptions({
            retryOnConcurrencyTimeout: self.options.retryOnConcurrencyTimeout,
            snapshotThreshold: self.options.snapshotThreshold,
            snapshotThresholdMs: self.options.snapshotThresholdMs
          })
          .defineCommand(self.definitions.command)
          .defineEvent(self.definitions.event)
          .idGenerator(self.getNewId)
          .useEventStore(self.eventStore)
          .useAggregateLock(self.aggregateLock);

        if (self.getNewAggregateId) {
          self.tree.aggregateIdGenerator(self.getNewAggregateId);
        }

        callback(null);
      }
    ], function (err) {
      if (err) {
        debug(err);
      } else {
        debug('domain inited');
      }
      if (callback) callback(err, warnings);
    });
  }
838071
def register(self, callback, name):
        ''
        server.CALLBACKS[name] = callback
        self.run('''
            window.skink.%s = function(args=[]) {
                window.skink.call("%s", args);
            }''' % (name, name))
158351
function initialize() {
    switch (this.type) {
      case 'ga':
        ga('create', this.key, this.domain);
        ga('send', 'pageview');
      break;

      case 'segment':
      default:
        window.analytics.load(this.key);
        window.analytics.page();
      break;
    }
  }
241274
function start(callback) {
        var serverDeferred = Q.defer();

        if (typeof callback !== 'function') {
            callback = function () {
            };
        }

        if (self.isRunning) {
            // FIXME: should this be an error?
            callback();
            return;
        }

        sockets = {};

        __httpServer = Http.createServer(__app);

        if (gmeConfig.server.timeout > -1) {
            __httpServer.timeout = gmeConfig.server.timeout;
        }

        function handleNewConnection(socket) {
            var socketId = socket.remoteAddress + ':' + socket.remotePort;

            if (socket.encrypted) { // https://nodejs.org/api/tls.html#tls_tlssocket_encrypted
                socketId += ':encrypted';
            }

            sockets[socketId] = socket;
            logger.debug('socket connected (added to list) ' + socketId);

            socket.on('close', function () {
                if (sockets.hasOwnProperty(socketId)) {
                    logger.debug('socket closed (removed from list) ' + socketId);
                    delete sockets[socketId];
                }
            });
        }

        __httpServer.on('connection', handleNewConnection);
        __httpServer.on('secureConnection', handleNewConnection);

        __httpServer.on('clientError', function (err/*, socket*/) {
            logger.debug('clientError', err);
        });

        __httpServer.on('error', function (err) {
            if (err.code === 'EADDRINUSE') {
                logger.error('Failed to start server', {metadata: {port: gmeConfig.server.port, error: err}});
                serverDeferred.reject(err);
            } else {
                logger.error('Server raised an error', {metadata: {port: gmeConfig.server.port, error: err}});
            }
        });

        logger.debug('starting server');

        __gmeAuth.connect()
            .then(function (db) {
                var promises = [];

                logger.debug('gmeAuth connected');

                promises.push(Q.ninvoke(__workerManager, 'start'));
                promises.push(__storage.openDatabase());

                if (__executorServer) {
                    promises.push(__executorServer.start({mongoClient: db}));
                }

                return Q.all(promises);
            })
            .then(function () {
                var promises = [];
                __webSocket.start(__httpServer);

                promises.push(apiReady);

                routeComponents.forEach(function (component) {
                    promises.push(Q.ninvoke(component, 'start'));
                });

                return Q.all(promises);
            })
            .then(function () {
                // Finally start listening to the server port.
                __httpServer.listen(gmeConfig.server.handle || gmeConfig.server.port, function () {
                    logger.info('Server is listening ...');
                    serverDeferred.resolve();
                });

                return serverDeferred.promise;
            })
            .then(function () {
                return webgmeUtils.createStartUpProjects(gmeConfig, __gmeAuth, __storage, logger, getUrl());
            })
            .nodeify(function (err) {
                self.isRunning = true;
                if (err) {
                    logger.error('Error at server start', err);
                }

                callback(err);
            });
    }
771900
function init(ctx) {
        var domainMap = getDomainMap();

        // for each request we need to set the proper context
        ctx.server.ext('onRequest', function (req, reply) {
            setLanguage(req);
            setAppInfo(req, domainMap);

            var appName = req.app.name;
            var lang = req.app.lang;
            if (req.app.isLegacyMobile || appName === 'www' || req.app.domain === 'contact') {
                appName = appName === 'www' ? 'contact' : appName;
                reply.redirect(routeHelper.getBaseUrl(appName, lang) + req.url.path).permanent(true);
                return;
            }

            setContext(req);
            reply.continue();
        });

        return new Q(ctx);
    }
525613
function init(domainManager) {
    _domainManager = domainManager;
    if (!domainManager.hasDomain("webSocketTransport")) {
        domainManager.registerDomain("webSocketTransport", {major: 0, minor: 1});
    }
    
    domainManager.registerEvent(
        "webSocketTransport",
        "message",
        [
            {
                name: "msg",
                type: "string",
                description: "JSON message from client page"
            }
        ]
    );
    
    domainManager.registerCommand(
        "webSocketTransport",       // domain name
        "start",                    // command name
        _cmdStart,                  // command handler function
        false,                      // this command is synchronous in Node
        "Creates the WS server",
        [
            {
                name: "port",
                type: "number",
                description: "Port on which server needs to listen"
            }
        ],
        []
    );
    
    domainManager.registerCommand(
        "webSocketTransport",       // domain name
        "close",                    // command name
        _cmdClose,                  // command handler function
        false,                      // this command is synchronous in Node
        "Kills the websocket server",
        []
    );
}
686600
function init(ctx) {
        var server = ctx.server;
        var deferred = Q.defer();

        server.register({register: require('bell')}, function (err) {

            if (err) {
                deferred.reject(err);
                return;
            }

            _.each(config.security.social, function (providerConfig, providerName) {
                var opts = _.extend({}, config.security.cookie, {
                    'cookie': 'bell-' + providerName,
                    'clientId': providerConfig.appId,
                    'clientSecret': providerConfig.appSecret,
                    'isSecure': config.useSSL,
                    'forceHttps': config.useSSL,
                    'provider': getProvider(providerName, providerConfig)
                });

                server.auth.strategy(providerName, 'bell', opts);
            });

            deferred.resolve();
        });

        return deferred.promise.then(function () {
            return Q.when(ctx);
        });
    }
993565
function init(domainManager) {
    if (!domainManager.hasDomain("FindInFiles")) {
        domainManager.registerDomain("FindInFiles", {major: 0, minor: 1});
    }
    _domainManager = domainManager;
    domainManager.registerCommand(
        "FindInFiles",       // domain name
        "doSearch",    // command name
        doSearch,   // command handler function
        false,          // this command is synchronous in Node
        "Searches in project files and returns matches",
        [{name: "searchObject", // parameters
            type: "object",
            description: "Object containing search data"}],
        [{name: "searchResults", // return values
            type: "object",
            description: "Object containing results of the search"}]
    );
    domainManager.registerCommand(
        "FindInFiles",       // domain name
        "nextPage",    // command name
        getNextPage,   // command handler function
        false,          // this command is synchronous in Node
        "get the next page of reults",
        [],
        [{name: "searchResults", // return values
            type: "object",
            description: "Object containing results of the search"}]
    );
    domainManager.registerCommand(
        "FindInFiles",       // domain name
        "getAllResults",    // command name
        getAllResults,   // command handler function
        false,          // this command is synchronous in Node
        "get the next page of reults",
        [],
        [{name: "searchResults", // return values
            type: "object",
            description: "Object containing all results of the search"}]
    );
    domainManager.registerCommand(
        "FindInFiles",       // domain name
        "collapseResults",    // command name
        setCollapseResults,   // command handler function
        false,          // this command is synchronous in Node
        "get the next page of reults",
        [{name: "collapse", // return values
            type: "boolean",
            description: "true to collapse"}],
        []
    );
    domainManager.registerCommand(
        "FindInFiles",       // domain name
        "filesChanged",    // command name
        addFilesToCache,   // command handler function
        false,          // this command is synchronous in Node
        "files in the project has been changed, update cache",
        [{name: "updateObject", // parameters
            type: "object",
            description: "Object containing list of changed files"}],
        []
    );
    domainManager.registerCommand(
        "FindInFiles",       // domain name
        "documentChanged",    // command name
        documentChanged,   // command handler function
        false,          // this command is synchronous in Node
        "informs that the document changed and updates the cache",
        [{name: "updateObject", // parameters
            type: "object",
            description: "update with the contents of the object"}],
        []
    );
    domainManager.registerCommand(
        "FindInFiles",       // domain name
        "filesRemoved",    // command name
        removeFilesFromCache,   // command handler function
        false,          // this command is synchronous in Node
        "Searches in project files and returns matches",
        [{name: "updateObject", // parameters
            type: "object",
            description: "Object containing list of removed files"}],
        []
    );
    domainManager.registerCommand(
        "FindInFiles",       // domain name
        "initCache",    // command name
        initCache,   // command handler function
        false,          // this command is synchronous in Node
        "Caches the project for find in files in node",
        [{name: "fileList", // parameters
            type: "Array",
            description: "List of all project files - Path only"}],
        []
    );
    domainManager.registerEvent(
        "FindInFiles",     // domain name
        "crawlComplete",   // event name
        [
            {
                name: "numFiles",
                type: "number",
                description: "number of files cached"
            },
            {
                name: "cacheSize",
                type: "number",
                description: "The size of the file cache epressesd as string length of files"
            }
        ]
    );
    setTimeout(fileCrawler, 5000);
}
1057325
public void init( String baseUrl, XRPCBatchRequestSender callback )
	{
		this.url = baseUrl + "&locale=" + LocaleInfo.getCurrentLocale().getLocaleName();
		this.callback = callback;
	}
1312583
function start(options, callback) {
  const args = utils.getArgs(options, [config], callback);

  app.set("config", args.options);
  server.listen(args.options.port, args.options.ip, function() {
    return args.callback(null);
  }).on("error", function(err) {
    if (err.code === "EADDRINUSE") {
      return args.callback(err);
    }
    console.error(err);
  });
}
997153
function callback (start, end, props) {
        if (props === undefined) {
            props = {};
        }
        key = blockKey + KEY_SEPARATOR + decorationId;
        decorated[blockKey][decorationId] = props;
        decorateRange(decorations, start, end, key);
        decorationId++;
    }
260802
function init(domainManager) {
    _domainManager = domainManager;
    if (!domainManager.hasDomain("launcher")) {
        domainManager.registerDomain("launcher", {major: 0, minor: 1});
    }
    domainManager.registerCommand(
        "launcher",      // domain name
        "launch",       // command name
        _cmdLaunch,     // command handler function
        false,          // this command is synchronous in Node
        "Launches a given HTML file in the browser for live development",
        [
            { name: "url", type: "string", description: "file:// url to the HTML file" },
            { name: "browser", type: "string", description: "browser name"}
        ],
        []
    );
}
212314
function nodeDomainInitialized(reset) {
        initState()
            .done(function () {
                var inProgress = updateJsonHandler.get(updateProgressKey);
                if (inProgress && reset) {
                    setUpdateStateInJSON(updateProgressKey, !reset)
                        .always(checkUpdateStatus);
                 } else if (!inProgress) {
                    checkUpdateStatus();
                }
            });
    }
1110398
public function after(Closure $callback = null)
    {
        if ($callback && $this->booted()) {
            $this->container->call($callback);
        }

        $this->eventDispatcher->listen(BootedAll::class, $callback);
        $this->eventDispatcher->listen('antares.extension: booted', $callback);
        $this->eventDispatcher->listen(ComponentsBooted::class, $callback);
    }
3243
function init(domainManager) {
    if (!domainManager.hasDomain("fileWatcher")) {
        domainManager.registerDomain("fileWatcher", {major: 0, minor: 1});
    }

    domainManager.registerCommand(
        "fileWatcher",
        "watchPath",
        watcherManager.watchPath,
        false,
        "Start watching a file or directory",
        [{
            name: "path",
            type: "string",
            description: "absolute filesystem path of the file or directory to watch"
        }, {
            name: "ignored",
            type: "array",
            description: "list of path to ignore"
        }]
    );
    domainManager.registerCommand(
        "fileWatcher",
        "unwatchPath",
        watcherManager.unwatchPath,
        false,
        "Stop watching a single file or a directory and it's descendants",
        [{
            name: "path",
            type: "string",
            description: "absolute filesystem path of the file or directory to unwatch"
        }]
    );
    domainManager.registerCommand(
        "fileWatcher",
        "unwatchAll",
        watcherManager.unwatchAll,
        false,
        "Stop watching all files and directories"
    );
    domainManager.registerEvent(
        "fileWatcher",
        "change",
        [
            {name: "event", type: "string"},
            {name: "parentDirPath", type: "string"},
            {name: "entryName", type: "string"},
            {name: "statsObj", type: "object"}
        ]
    );

    watcherManager.setDomainManager(domainManager);
    watcherManager.setWatcherImpl(watcherImpl);

}
343682
function(callback) {
			var t = this;
	
			t._interval(callback);

			t.timer = setInterval(function() {		
				t._interval(callback);
			}, this.interval);
		}
1316145
function init(config){
    var logger = new LogglyLogger(config);
    logger.validateConfig();

    logger.config = config;
    logger.client = loggly.createClient({
        token: config.token,
        subdomain: config.application,
        auth: config.auth,

        // TOOD: pushing more tags onto this array, or not using them, should be configurable
        tags: [
            config.domain,
            config.machine
        ]

        // Loggly docs say it uses json stringify if json:true
        // JSON stringify does not handle Errors or circulare references well
        // Logger.createEntry handles them well
    });
    return logger;
}