Issue #437 - Add debug output to support roster development

Former-commit-id: 14b193ad6f [formerly b502e55a4b95dc0483e5502154ba61f04e9132cc]
Former-commit-id: 826105c621
This commit is contained in:
James Korman 2012-04-11 16:23:04 -05:00
parent b23bd53519
commit 4a22bdb915
2 changed files with 34 additions and 15 deletions

View file

@ -24,6 +24,7 @@ import java.util.Collection;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterEventSubscriber;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
@ -44,7 +45,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
* @version 1.0
*/
public class RosterEventHandler {
public class RosterEventHandler implements IRosterEventSubscriber {
@Subscribe

View file

@ -91,7 +91,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
* <li><strong>IConnectionStatusEvent</strong> : This event is posted when the
* state of the underlying connection changes, reconnecting, connecting,
* disconnected, for example.</li>
* <li><strong>IRosterChangeEvent</strong> : This event is posted when roster changes have occurred.</li>
* <li><strong>IRosterChangeEvent</strong> : This event is posted when roster
* changes have occurred.</li>
* <li><strong>---------------</strong> : ---------------.</li>
* </ul>
* </ul>
@ -150,7 +151,9 @@ public class SessionManager implements IEventPublisher {
private IRosterEventSubscriber rosterEventSubscriber = null;
RosterEventHandler rosterEventHandler = null;
// Debug -- event viewer ----------------
private IRosterEventSubscriber rosterEventHandler = null;
// Debug -- event viewer ----------------
/**
* @throws CollaborationException
@ -177,6 +180,7 @@ public class SessionManager implements IEventPublisher {
IPresence initialPresence) throws Exception {
this(account, password, (IRosterEventSubscriber) null);
if (accountManager != null) {
userPresence = initialPresence;
accountManager.sendPresence(initialPresence);
}
}
@ -202,6 +206,13 @@ public class SessionManager implements IEventPublisher {
this.rosterEventSubscriber = rosterEventSubscriber;
eventBus.register(rosterEventSubscriber);
}
// Debug -- event viewer ----------------
rosterEventHandler = new RosterEventHandler();
eventBus.register(rosterEventHandler);
// Debug -- event viewer ----------------
sessions = new HashMap<String, ISession>();
try {
container = ContainerFactory.getDefault().createContainer(PROVIDER);
@ -220,6 +231,7 @@ public class SessionManager implements IEventPublisher {
}
} catch (ContainerCreateException cce) {
closeInternals();
throw new CollaborationException(String.format(
"Could not create container for provider [%s]", PROVIDER));
}
@ -228,9 +240,7 @@ public class SessionManager implements IEventPublisher {
try {
connectToContainer();
} catch (ContainerConnectException e) {
if (container != null) {
container.dispose();
}
closeInternals();
throw new CollaborationException(
"Login failed. Invalid username or password", e);
}
@ -244,8 +254,6 @@ public class SessionManager implements IEventPublisher {
setupAccountManager();
sessions = new HashMap<String, ISession>();
setupInternalConnectionListeners();
setupInternalVenueInvitationListener();
setupP2PComm(presenceAdapter);
@ -364,14 +372,26 @@ public class SessionManager implements IEventPublisher {
return ((container != null) && (container.getConnectedID() != null));
}
private void closeInternals() {
if (rosterEventSubscriber != null) {
eventBus.unregister(rosterEventSubscriber);
}
if(container != null) {
chatInstance = null;
// Get rid of the account and roster managers
container.dispose();
container = null;
}
}
/**
*
*/
public void closeManager() {
if (container != null) {
if (rosterEventSubscriber != null) {
eventBus.unregister(rosterEventSubscriber);
}
// Close any created sessions.
for (ISession session : sessions.values()) {
if ((chatInstance != null) && chatInstance.equals(session)) {
@ -382,10 +402,8 @@ public class SessionManager implements IEventPublisher {
}
}
chatInstance = null;
// Get rid of the account and roster managers
container.dispose();
container = null;
}
closeInternals();
}
/**