public register()

in lib/host.ts [98:129]


    public register(
        appModulePath: string, 
        appInstanceNames: string[], 
        zone?: napa.zone.Zone): void {

        if (zone != null) {
            throw new Error("LeafHost doesn't support register on a remote Zone.");
        }

        // Load application.
        let appConfigPath = require.resolve(appModulePath + '/app.json');
        let app = new Application(
                this._objectContext,
                ApplicationConfig.fromConfig(
                this._settings,
                appConfigPath));

        // If any instance name has already been registered, fail the whole register operation.
        for (let instanceName of appInstanceNames) {
            let lowerCaseName = instanceName.toLowerCase();
            if (this._applications.has(lowerCaseName)) {
                throw new Error(`Already registered with application name: '${instanceName}'.`);
            }
        }

        // Put application in registry.
        for (let instanceName of appInstanceNames) {
            let lowerCaseName = instanceName.toLowerCase();
            this._applications.set(lowerCaseName, app);
            this._applicationInstanceNames.push(instanceName);
        }
    }