@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
63 lines • 2.43 kB
JavaScript
"use strict";
/*
* Copyright © 2019 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.HandlerRegistrationManagerSupport = void 0;
const handlerRegistrations_1 = require("./handlerRegistrations");
/**
* Concrete implementation of CommandRegistrationManager and
* HandlerRegistrationManager
*/
class HandlerRegistrationManagerSupport {
constructor(sdm) {
this.sdm = sdm;
this.commandHandlers = [];
this.eventHandlers = [];
this.ingesters = [];
}
addCommand(cmd) {
const command = handlerRegistrations_1.commandHandlerRegistrationToCommand(this.sdm, cmd);
this.commandHandlers.push(command);
return this;
}
addGeneratorCommand(gen) {
const command = handlerRegistrations_1.generatorRegistrationToCommand(this.sdm, gen);
this.commandHandlers.push(command);
return this;
}
addCodeTransformCommand(ed) {
const commands = [handlerRegistrations_1.codeTransformRegistrationToCommand(this.sdm, ed)];
this.commandHandlers = this.commandHandlers.concat(commands);
return this;
}
addCodeInspectionCommand(cir) {
const commands = [handlerRegistrations_1.codeInspectionRegistrationToCommand(this.sdm, cir)];
this.commandHandlers = this.commandHandlers.concat(commands);
return this;
}
addEvent(e) {
const events = [handlerRegistrations_1.eventHandlerRegistrationToEvent(this.sdm, e)];
this.eventHandlers = this.eventHandlers.concat(events);
return this;
}
addIngester(i) {
const ingesters = [i.ingester];
this.ingesters = this.ingesters.concat(ingesters);
return this;
}
}
exports.HandlerRegistrationManagerSupport = HandlerRegistrationManagerSupport;
//# sourceMappingURL=HandlerRegistrationManagerSupport.js.map