Dependency inject service ID, so that it can be stamped on friends and
[hermes] / package / src / org / maemo / hermes / engine / service.py
index 0a04c09..85469b1 100644 (file)
@@ -7,15 +7,17 @@ class Service:
        Copyright (c) Andrew Flegg <andrew@bleb.org> 2010.
        Released under the Artistic Licence."""
        
-    def __init__(self):
+    def __init__(self, service_id):
         """Should make initial calls to the service and retrieve a list of friends."""
+        
+        self._service_id = service_id
 
 
     # -----------------------------------------------------------------------
-    def get_name(self):
-        """Should return the same name as the provider class - debugging only - REMOVE/FIXME"""
+    def get_id(self):
+        """Return the service ID, as given to the service at creation."""
         
-        return None
+        return self._service_id
 
     
     # -----------------------------------------------------------------------
@@ -51,6 +53,14 @@ class Service:
 
 
     # -----------------------------------------------------------------------
+    def create_contacts(self):
+        """Return a list of friends which should have contacts created. This
+           should expected by the user, and optional."""
+           
+        return []
+
+
+    # -----------------------------------------------------------------------
     def finalise(self, updated, overwrite = False):
         """Once all contacts have been processed, allows for any tidy-up/additional
            enrichment. If any contacts are updated at this stage, 'updated' should
@@ -60,7 +70,8 @@ class Service:
 
 
     # -----------------------------------------------------------------------
+    ###DEPRECATED
     def _create_friend(self, name):
         """Used to create a Friend object for a contact"""
         
-        return Friend(name)
+        return Friend(name, self._service_id)