add ResourceManager for handling resources in inter plugin communication
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Fri, 7 Nov 2008 17:41:14 +0000 (18:41 +0100)
committerStefan <stefan@tuxboxls.(none)>
Tue, 16 Dec 2008 18:55:34 +0000 (19:55 +0100)
lib/python/Components/Makefile.am
lib/python/Components/ResourceManager.py [new file with mode: 0644]

index fda58bf..9c04701 100644 (file)
@@ -18,4 +18,4 @@ install_PYTHON = \
        MultiContent.py MediaPlayer.py TunerInfo.py VideoWindow.py ChoiceList.py \
        Element.py Playlist.py ParentalControl.py ParentalControlList.py \
        Ipkg.py SelectionList.py Scanner.py SystemInfo.py DreamInfoHandler.py \
        MultiContent.py MediaPlayer.py TunerInfo.py VideoWindow.py ChoiceList.py \
        Element.py Playlist.py ParentalControl.py ParentalControlList.py \
        Ipkg.py SelectionList.py Scanner.py SystemInfo.py DreamInfoHandler.py \
-       Task.py language_cache.py Console.py
+       Task.py language_cache.py Console.py ResourceManager.py
diff --git a/lib/python/Components/ResourceManager.py b/lib/python/Components/ResourceManager.py
new file mode 100644 (file)
index 0000000..fb6be4a
--- /dev/null
@@ -0,0 +1,23 @@
+class ResourceManager:
+       def __init__(self):
+               self.resourceList = {}
+               
+       def addResource(self, name, resource):
+               print "adding Resource", name
+               self.resourceList[name] = resource
+               print "resources:", self.resourceList
+               
+               
+       def getResource(self, name):
+               if not self.hasResource(name):
+                       return None
+               return self.resourceList[name]
+       
+       def hasResource(self, name):
+               return self.resourceList.has_key(name)
+       
+       def removeResource(self, name):
+               if self.hasResource(name):
+                       del self.resourceList[name]
+               
+resourcemanager = ResourceManager()
\ No newline at end of file