Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsuen2008-12-13 09:24:16 -0500
committerrsuen2008-12-13 09:24:16 -0500
commit46c365467060f1fc381406a75365247a9534b8fc (patch)
treed5e7352f9a81f5073074e353bc2b77b1d037fec2 /examples/bundles/org.eclipse.ecf.example.collab
parenta8c5b53bc3fbbfc14d9169114e00a9b4dd17160b (diff)
downloadorg.eclipse.ecf-46c365467060f1fc381406a75365247a9534b8fc.tar.gz
org.eclipse.ecf-46c365467060f1fc381406a75365247a9534b8fc.tar.xz
org.eclipse.ecf-46c365467060f1fc381406a75365247a9534b8fc.zip
Register the container as a service.
Diffstat (limited to 'examples/bundles/org.eclipse.ecf.example.collab')
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java17
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/RosterManager.java12
2 files changed, 21 insertions, 8 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java
index 278d5b855..90b25c3c2 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java
@@ -11,13 +11,17 @@
package org.eclipse.ecf.internal.example.collab.presence;
import org.eclipse.ecf.core.IContainer;
+import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.AbstractPresenceContainer;
-import org.eclipse.ecf.presence.IIMMessageListener;
+import org.eclipse.ecf.core.util.ECFException;
+import org.eclipse.ecf.internal.example.collab.ClientPlugin;
+import org.eclipse.ecf.presence.*;
import org.eclipse.ecf.presence.im.IChatManager;
import org.eclipse.ecf.presence.roster.IRosterManager;
+import org.eclipse.ecf.presence.service.IPresenceService;
+import org.osgi.framework.BundleContext;
-public class PresenceContainer extends AbstractPresenceContainer {
+public class PresenceContainer extends AbstractPresenceContainer implements IPresenceSender, IPresenceService {
private final IContainer container;
private final IRosterManager manager;
@@ -25,6 +29,9 @@ public class PresenceContainer extends AbstractPresenceContainer {
public PresenceContainer(IContainer container, IUser user) {
this.container = container;
manager = new RosterManager(this, user);
+
+ BundleContext bundleContext = ClientPlugin.getDefault().getBundle().getBundleContext();
+ bundleContext.registerService(IPresenceService.class.getName(), this, null);
}
public IChatManager getChatManager() {
@@ -52,4 +59,8 @@ public class PresenceContainer extends AbstractPresenceContainer {
// unimplemented because messages do not currently go through the presence container
}
+ public void sendPresenceUpdate(ID targetId, IPresence presence) throws ECFException {
+ // unimplemented as we have no concept of presence support, either online or offline
+ }
+
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/RosterManager.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/RosterManager.java
index f6e31de74..dd48389d5 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/RosterManager.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/RosterManager.java
@@ -14,7 +14,6 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.ecf.core.user.IUser;
-import org.eclipse.ecf.presence.IPresenceContainerAdapter;
import org.eclipse.ecf.presence.IPresenceListener;
import org.eclipse.ecf.presence.IPresenceSender;
import org.eclipse.ecf.presence.roster.AbstractRosterManager;
@@ -27,10 +26,13 @@ public class RosterManager extends AbstractRosterManager {
private List presenceListeners = new LinkedList();
- public RosterManager(IPresenceContainerAdapter containerAdapter, IUser user) {
+ private PresenceContainer presenceContainer;
+
+ public RosterManager(PresenceContainer presenceContainer, IUser user) {
super();
+ this.presenceContainer = presenceContainer;
- roster = new Roster(containerAdapter, user) {
+ roster = new Roster(presenceContainer, user) {
public boolean addItem(IRosterItem item) {
if (super.addItem(item)) {
fireRosterAdd((IRosterEntry) item);
@@ -38,7 +40,7 @@ public class RosterManager extends AbstractRosterManager {
}
return false;
}
-
+
public boolean removeItem(IRosterItem item) {
if (super.removeItem(item)) {
fireRosterRemove((IRosterEntry) item);
@@ -50,7 +52,7 @@ public class RosterManager extends AbstractRosterManager {
}
public IPresenceSender getPresenceSender() {
- return null;
+ return presenceContainer;
}
public IRosterSubscriptionSender getRosterSubscriptionSender() {

Back to the top