123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- import { Observable } from "rxjs";
- import { MessageLog } from "../../interfaces/general.interface";
- abstract class RemoteSR {
- remoteSrId: string | undefined
- msgLogger: MessageLogger
- msgErrorLogger: MessageErrorLogger
- Transporter: Transporter
- constructor(remoteSrId: string, msgLogger: MessageLogger, msgErrorLogger: MessageErrorLogger, transporter: Transporter) {
- this.remoteSrId = remoteSrId
- this.msgLogger = msgLogger
- this.msgErrorLogger = msgErrorLogger
- this.Transporter = transporter
- }
- }
- abstract class RemoteSRClient extends RemoteSR {
- abstract RemoteSR
- constructor(remoteSrId: string, msgLogger: MessageLogger, msgErrorLogger: MessageErrorLogger, transporter: Transporter) {
- super(remoteSrId, msgLogger, msgErrorLogger, transporter)
- }
- abstract send(msg: any): Observable<any>
- abstract emit(msg: any)
- }
- abstract class RemoteRSClient {
- resObs: Observable<any>
- constructor(resObs: Observable<any>) {
- this.resObs = resObs;
- }
- }
- class RemoteSender extends RemoteSR {
- constructor(remoteSrId: string, msgLogger: MessageLogger, msgErrorLogger: MessageErrorLogger, transporter: Transporter) {
- super(remoteSrId, msgLogger, msgErrorLogger, transporter)
- }
- }
- class RemoteReceiver extends RemoteSR {
- receivableObs: Observable<any>
- constructor(remoteSrId: string, msgLogger: MessageLogger, msgErrorLogger: MessageErrorLogger, transporter: Transporter) {
- super(remoteSrId, msgLogger, msgErrorLogger, transporter)
- this.receivableObs = transporter.transporter // Assuming this is where it returns an observable
- }
- }
- class MessageLogger extends RemoteSR {
- msgId: string
- msg: MessageLog
- constructor(msgId: string, msg: MessageLog, remoteSrId: string, msgLogger: MessageLogger, msgErrorLogger: MessageErrorLogger, transporter: Transporter) {
- super(remoteSrId, msgLogger, msgErrorLogger, transporter)
- this.msgId = msgId
- this.msg = msg
- }
- }
- class MessageErrorLogger extends RemoteSR {
- msgId: string
- constructor(msgId: string, remoteSrId: string, msgLogger: MessageLogger, msgErrorLogger: MessageErrorLogger, transporter: Transporter) {
- super(remoteSrId, msgLogger, msgErrorLogger, transporter)
- this.msgId = msgId
- }
- }
- class Transporter extends RemoteSR {
- transporter: any
- constructor(remoteSrId: string, msgLogger: MessageLogger, msgErrorLogger: MessageErrorLogger, transporter: Transporter) {
- super(remoteSrId, msgLogger, msgErrorLogger, transporter)
- this.transporter = transporter
- }
- }
- class RemoteReceiverClient extends RemoteSRClient {
- RemoteSR: any;
- constructor(remoteSrId: string, msgLogger: MessageLogger, msgErrorLogger: MessageErrorLogger, transporter: Transporter) {
- super(remoteSrId, msgLogger, msgErrorLogger, transporter)
- }
- send(msg: any): Observable<any> {
- let newObservable: Observable<any> = new Observable()
- return newObservable
- }
- emit(msg: any) {
- }
- }
- class RemoteSenderClient extends RemoteSRClient {
- RemoteSR: any;
- constructor(remoteSrId: string, msgLogger: MessageLogger, msgErrorLogger: MessageErrorLogger, transporter: Transporter) {
- super(remoteSrId, msgLogger, msgErrorLogger, transporter)
- }
- send(msg: any): Observable<any> {
- let newObservable: Observable<any> = new Observable()
- return newObservable
- }
- emit(msg: any) {
- }
- }
- class RemoteRSReceiverClient extends RemoteRSClient {
- observables: Observable<any>[]
- constructor(resObs: Observable<any>, observables: Observable<any>[]) {
- super(resObs)
- this.observables = observables
- }
- addObs(obs: Observable<any>) { }
- }
- class RemoteRSSenderClient extends RemoteRSClient {
- receiver: any
- constructor(resObs: Observable<any>, receiver: any) {
- super(resObs)
- this.receiver = receiver
- }
- }
|