summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-09 02:28:40 (EDT)
committerEike Stepper2007-10-09 02:28:40 (EDT)
commit16b12d5befb2aafd4788e27a2bbefe73ef7501d1 (patch)
tree6fe705e228e3509e87c7959a81bac114859bbfbb
parent6c2384b3618e92f2ea68feb8dd24e3bd6865fd78 (diff)
downloadcdo-16b12d5befb2aafd4788e27a2bbefe73ef7501d1.zip
cdo-16b12d5befb2aafd4788e27a2bbefe73ef7501d1.tar.gz
cdo-16b12d5befb2aafd4788e27a2bbefe73ef7501d1.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java6
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerBuddy.java1
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java2
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientBuddy.java7
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java7
5 files changed, 11 insertions, 12 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
index 7fb80f7..1a39db0 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
@@ -85,10 +85,12 @@ public class BuddyAdmin extends Lifecycle implements IBuddyAdmin, IListener
ServerSession session = new ServerSession(channel, buddy);
((IProtocol)channel.getReceiveHandler()).setInfraStructure(session);
-
- sessions.put(userID, session);
session.addListener(this);
+ buddy.setSession(session);
+ LifecycleUtil.activate(session);
+
if (TRACER.isEnabled()) TRACER.trace("Opened session: " + userID);
+ sessions.put(userID, session);
return session;
}
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerBuddy.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerBuddy.java
index 22f70b3..04b0cf8 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerBuddy.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerBuddy.java
@@ -22,6 +22,7 @@ public class ServerBuddy extends Buddy
public ServerBuddy(IAccount account)
{
+ super(null);
this.account = account;
}
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
index 0716c4b..d5ae6bf 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
@@ -17,7 +17,6 @@ import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
@@ -35,7 +34,6 @@ public class ServerSession extends Lifecycle implements ISession, IListener
{
this.channel = channel;
this.self = self;
- LifecycleUtil.activate(this);
}
public IChannel getChannel()
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientBuddy.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientBuddy.java
index 5d13acb..e618120 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientBuddy.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientBuddy.java
@@ -18,21 +18,20 @@ import org.eclipse.net4j.buddies.protocol.IAccount;
*/
public class ClientBuddy extends Buddy
{
- private ClientSession session;
-
private String userID;
private IAccount account;
public ClientBuddy(ClientSession session, String userID)
{
- this.session = session;
+ super(session);
this.userID = userID;
}
+ @Override
public ClientSession getSession()
{
- return session;
+ return (ClientSession)super.getSession();
}
public String getUserID()
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java
index 7769b38..a9038403 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java
@@ -18,19 +18,18 @@ import org.eclipse.net4j.buddies.protocol.IAccount;
*/
public class Self extends Buddy
{
- private ClientSession session;
-
private IAccount account;
protected Self(ClientSession session, IAccount account)
{
- this.session = session;
+ super(session);
this.account = account;
}
+ @Override
public ClientSession getSession()
{
- return session;
+ return (ClientSession)super.getSession();
}
public String getUserID()