77 lines
2.4 KiB
C#
77 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Collections;
|
|
|
|
namespace BCG {
|
|
/*
|
|
* This class has been changed to be a thin pass-through shell around different subscriber core implementations.
|
|
* The specific implementation used is determined by the config.
|
|
*
|
|
*
|
|
* */
|
|
public class SubscriberCore : ISubscriberCore {
|
|
ISubscriberCore mySubscriberCore = null;
|
|
|
|
public SubscriberCore() {
|
|
// TODOds
|
|
mySubscriberCore = new StaticSubscriberCore();// PubSubComponentFactory.getSubscriberCore();
|
|
mySubscriberCore.onPubSubConnectionChange += myHandleConnectionChange;
|
|
}
|
|
|
|
public SubscriberCore(string siteName) {
|
|
mySubscriberCore = new StaticSubscriberCore(siteName);
|
|
mySubscriberCore.onPubSubConnectionChange += myHandleConnectionChange;
|
|
}
|
|
public SubscriberCore(IPubSubRouter theRouter) {
|
|
// TODOds
|
|
mySubscriberCore = new StaticSubscriberCore(theRouter);// PubSubComponentFactory.getSubscriberCore();
|
|
mySubscriberCore.onPubSubConnectionChange += myHandleConnectionChange;
|
|
}
|
|
|
|
public SubscriberCore(PubSubRoute[] routes) {
|
|
//this is always a static subscriber core
|
|
mySubscriberCore = new StaticSubscriberCore(routes);
|
|
mySubscriberCore.onPubSubConnectionChange += myHandleConnectionChange;
|
|
}
|
|
|
|
|
|
public IPubSubRouter getRouter() {
|
|
return mySubscriberCore.getRouter();
|
|
}
|
|
|
|
public ArrayList getUpdates() {
|
|
return mySubscriberCore.getUpdates(10);
|
|
}
|
|
|
|
public ArrayList getUpdates(TimeSpan timeout) {
|
|
return mySubscriberCore.getUpdates(Convert.ToInt32(timeout.TotalMilliseconds));
|
|
}
|
|
|
|
public ArrayList getUpdates(int timeout) {
|
|
return mySubscriberCore.getUpdates(timeout);
|
|
}
|
|
|
|
public void subscribe(params string[] tags) {
|
|
mySubscriberCore.subscribe(tags);
|
|
}
|
|
|
|
public void unsubscribe(params string[] tags) {
|
|
mySubscriberCore.unsubscribe(tags);
|
|
}
|
|
|
|
public void Dispose() {
|
|
mySubscriberCore.Dispose();
|
|
|
|
}
|
|
private void myHandleConnectionChange(bool isConnected, string connection) {
|
|
if (onPubSubConnectionChange != null)
|
|
onPubSubConnectionChange(isConnected, connection);
|
|
}
|
|
|
|
public event PubSubConnectionChange onPubSubConnectionChange;
|
|
|
|
}
|
|
}
|