aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/services/XmppConnectionService.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-25 19:33:12 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-25 19:33:12 +0100
commit665ef7511f5dcccb349228baa2aa6f02281d3c07 (patch)
tree461ffa268dc16b299c68e764a3ae55ad912075c4 /src/de/gultsch/chat/services/XmppConnectionService.java
parentdf9dcb1060d44a719e2892446b62cde884a880cf (diff)
all access to the persistance layer is now done via the new xmppservice
Diffstat (limited to '')
-rw-r--r--src/de/gultsch/chat/services/XmppConnectionService.java38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/de/gultsch/chat/services/XmppConnectionService.java b/src/de/gultsch/chat/services/XmppConnectionService.java
index 4477513d..67e3901e 100644
--- a/src/de/gultsch/chat/services/XmppConnectionService.java
+++ b/src/de/gultsch/chat/services/XmppConnectionService.java
@@ -1,29 +1,49 @@
package de.gultsch.chat.services;
+import java.util.List;
+
+import de.gultsch.chat.entities.Conversation;
+import de.gultsch.chat.entities.Message;
+import de.gultsch.chat.persistance.DatabaseBackend;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
+import android.util.Log;
public class XmppConnectionService extends Service {
+
+ protected static final String LOGTAG = "xmppConnection";
+ protected DatabaseBackend databaseBackend;
- // Binder given to clients
private final IBinder mBinder = new XmppConnectionBinder();
- /**
- * Class used for the client Binder. Because we know this service always
- * runs in the same process as its clients, we don't need to deal with IPC.
- */
public class XmppConnectionBinder extends Binder {
- XmppConnectionService getService() {
- // Return this instance of LocalService so clients can call public methods
- return XmppConnectionService.this;
+ public XmppConnectionService getService() {
+ return XmppConnectionService.this;
}
}
-
+
+ @Override
+ public void onCreate() {
+ databaseBackend = DatabaseBackend.getInstance(getApplicationContext());
+ }
+
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
+
+ public void sendMessage(Message message) {
+ Log.d(LOGTAG,"sending message");
+ }
+
+ public void addConversation(Conversation conversation) {
+ databaseBackend.addConversation(conversation);
+ }
+
+ public List<Conversation> getConversations(int status) {
+ return databaseBackend.getConversations(status);
+ }
}