summaryrefslogtreecommitdiffstats
path: root/Monitoring/src/main/python/DataProcessing/AggregatorManager.py.old
diff options
context:
space:
mode:
authorpikusa <pikusa@man.poznan.pl>2013-04-03 13:18:17 (GMT)
committer pikusa <pikusa@man.poznan.pl>2013-04-03 13:18:17 (GMT)
commit2f2a3a129c91de540e66c3bfbe30b0df1942cd4b (patch)
tree2d313cdf0068af368d4de6067d676be16f6a6464 /Monitoring/src/main/python/DataProcessing/AggregatorManager.py.old
parentff8aa232b071a9b54dff833714a870fd0aec0b30 (diff)
downloadnovi-public-2f2a3a129c91de540e66c3bfbe30b0df1942cd4b.zip
novi-public-2f2a3a129c91de540e66c3bfbe30b0df1942cd4b.tar.gz
novi-public-2f2a3a129c91de540e66c3bfbe30b0df1942cd4b.tar.bz2
project commit and dir tree change
Diffstat (limited to 'Monitoring/src/main/python/DataProcessing/AggregatorManager.py.old')
-rw-r--r--Monitoring/src/main/python/DataProcessing/AggregatorManager.py.old39
1 files changed, 39 insertions, 0 deletions
diff --git a/Monitoring/src/main/python/DataProcessing/AggregatorManager.py.old b/Monitoring/src/main/python/DataProcessing/AggregatorManager.py.old
new file mode 100644
index 0000000..786959c
--- /dev/null
+++ b/Monitoring/src/main/python/DataProcessing/AggregatorManager.py.old
@@ -0,0 +1,39 @@
+'''
+Created on Dec 10, 2012
+
+@author: steger
+'''
+from DataProcessing.Aggregator import AggregatorError, Aggregator
+from DataProcessing.Sampler import Sampler
+
+class AggregatorManager(object):
+ def __init__(self):
+ self._id = 0;
+ self._aggregators = {}
+
+ def newAggregator(self, dataSource, cellrequest, commandflow):
+ for c, ca in commandflow:
+ if issubclass(c, Aggregator):
+ dataSource = c(dataSource, cellrequest)
+ for k, v in ca.iteritems():
+ dataSource.__setattr__(k, v)
+ elif issubclass(c, Sampler):
+ dataSource = c(dataSource)
+ for k, v in ca.iteritems():
+ dataSource.__setattr__(k, v)
+ self._id += 1
+ self._aggregators[ self._id ] = dataSource
+ return self._id
+
+ def __getitem__(self, aggregatorid):
+ try:
+ return self._aggregators[ aggregatorid ]
+ except:
+ raise AggregatorError("Aggregator with id %s not found" % aggregatorid)
+
+ def pop(self, aggregatorid):
+ try:
+ self._aggregators.pop( aggregatorid )
+ except KeyError:
+ print "WW: Aggregator with id %s not found" % aggregatorid
+ \ No newline at end of file