Issue #427 minor fixes

Change-Id: I9788992b2de751f75ab2cc5112f2cf0492c214ad

Former-commit-id: 1952d1fbfe [formerly ab63accc61] [formerly fa8b5b3400] [formerly 0f25c8ffa6 [formerly fa8b5b3400 [formerly 40e9906f41f0fa2ae4c87d3c2a2acb2406fd4e25]]]
Former-commit-id: 0f25c8ffa6
Former-commit-id: ae7a75e9886a4da3c8fde7c46fdf504fd79b25c1 [formerly a692caba1c]
Former-commit-id: f1c0104885
This commit is contained in:
Nate Jensen 2012-03-27 09:56:46 -05:00
parent 3320d18ed5
commit 316ee943cd
2 changed files with 92 additions and 77 deletions

View file

@ -27,11 +27,8 @@ import java.util.Map;
import org.eclipse.ecf.core.IContainer; import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDCreateException;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.identity.Namespace; import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.core.util.ECFException; import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.presence.IPresenceContainerAdapter;
import org.eclipse.ecf.presence.im.IChatMessage; import org.eclipse.ecf.presence.im.IChatMessage;
import org.eclipse.ecf.presence.im.IChatMessageSender; import org.eclipse.ecf.presence.im.IChatMessageSender;
@ -65,7 +62,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Errors;
* @version 1.0 * @version 1.0
*/ */
public class PeerToPeerChat extends BaseSession implements IPeerToPeer, IEventPublisher { public class PeerToPeerChat extends BaseSession implements IPeerToPeer,
IEventPublisher {
/** /**
* *
@ -108,7 +106,8 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer, IEventPu
* @param listener * @param listener
* @param filter * @param filter
*/ */
public InternalListener(IPresenceListener listener, IMessageFilter filter) { public InternalListener(IPresenceListener listener,
IMessageFilter filter) {
presenceListener = listener; presenceListener = listener;
this.filter = filter; this.filter = filter;
} }
@ -151,8 +150,17 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer, IEventPu
* @param externalBus * @param externalBus
* @param manager * @param manager
*/ */
PeerToPeerChat(IContainer container, EventBus externalBus, SessionManager manager) { PeerToPeerChat(IContainer container, EventBus externalBus,
SessionManager manager) {
super(container, externalBus, manager); super(container, externalBus, manager);
try {
setup();
} catch (ECFException e) {
// TODO
e.printStackTrace();
}
chatSender = getConnectionPresenceAdapter().getChatManager()
.getChatMessageSender();
} }
@ -176,7 +184,8 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer, IEventPu
} }
} }
try { try {
chatSender.sendChatMessage(toID, null, IChatMessage.Type.CHAT, subject, body, props); chatSender.sendChatMessage(toID, null, IChatMessage.Type.CHAT,
subject, body, props);
} catch (ECFException e) { } catch (ECFException e) {
System.out.println("Error sending message"); System.out.println("Error sending message");
e.printStackTrace(); e.printStackTrace();
@ -187,8 +196,11 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer, IEventPu
/** /**
* Send a message to the named recipient. * Send a message to the named recipient.
* @param to The recipient of the message. *
* @param message The body of the message to send. * @param to
* The recipient of the message.
* @param message
* The body of the message to send.
*/ */
@Override @Override
public int sendPeerToPeer(String to, String message) { public int sendPeerToPeer(String to, String message) {
@ -209,8 +221,10 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer, IEventPu
* *
*/ */
@Override @Override
public IMessageListener addMessageListener(IMessageListener listener, IMessageFilter filter) { public IMessageListener addMessageListener(IMessageListener listener,
InternalListener messageListener = new InternalListener(listener, filter); IMessageFilter filter) {
InternalListener messageListener = new InternalListener(listener,
filter);
messageListeners.add(messageListener); messageListeners.add(messageListener);
return listener; return listener;
} }
@ -241,5 +255,4 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer, IEventPu
return removed; return removed;
} }
} }

View file

@ -44,7 +44,6 @@ import org.eclipse.ecf.presence.chatroom.IChatRoomParticipantListener;
import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID; import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
@ -251,7 +250,8 @@ public class VenueSession extends BaseSession implements IVenueSession,
// if(renderable instanceof TestJAXBObject) { // if(renderable instanceof TestJAXBObject) {
// TestJAXBObject j = (TestJAXBObject) renderable; // TestJAXBObject j = (TestJAXBObject) renderable;
// if(j.getValue() < 100) { // if(j.getValue() < 100) {
// System.out.println(String.format("%s %d Renderable", j.getItem_1(), j.getValue())); // System.out.println(String.format("%s %d Renderable", j.getItem_1(),
// j.getValue()));
// j.setValue(j.getValue() + 200); // j.setValue(j.getValue() + 200);
// j.setItem_1("Now for the return trip"); // j.setItem_1("Now for the return trip");
// try { // try {
@ -260,7 +260,8 @@ public class VenueSession extends BaseSession implements IVenueSession,
// System.out.println("Error sending RenderableObject"); // System.out.println("Error sending RenderableObject");
// } // }
// } else { // } else {
// System.out.println(String.format("%s %d Renderable", j.getItem_1(), j.getValue())); // System.out.println(String.format("%s %d Renderable", j.getItem_1(),
// j.getValue()));
// } // }
// } // }
// } // }
@ -617,7 +618,8 @@ public class VenueSession extends BaseSession implements IVenueSession,
* @param participant * @param participant
* @param initData * @param initData
* @throws CollaborationException * @throws CollaborationException
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#sendInitData(com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID, com.raytheon.uf.viz.collaboration.comm.identity.event.IInitData) * @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#sendInitData(com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID,
* com.raytheon.uf.viz.collaboration.comm.identity.event.IInitData)
*/ */
@Override @Override
public void sendInitData( public void sendInitData(
@ -629,7 +631,7 @@ public class VenueSession extends BaseSession implements IVenueSession,
if (session != null) { if (session != null) {
String message = Tools.marshallData(initData); String message = Tools.marshallData(initData);
if (message != null) { if (message != null) {
session.sendPeerToPeer(participant.getFQName(), message); session.sendPeerToPeer(participant.getName(), message);
} }
} }
} }