use of port.sessionserver.JoinInfo in project GIPC by pdewan.
the class ASessionBasedFP2PBufferConnectionsManager method joinSessionsServer.
// public List<SessionParticipantDescription> getServers() {
// return servers;
// }
// public List<SessionParticipantDescription> getMembers() {
// return members;
// }
// public List<SessionParticipantDescription> getClients() {
// return clients;
// }
// public SessionParticipantDescription getServer(String aName) {
// return ASession.getParticipant(servers, aName);
// }
// public SessionParticipantDescription getClient(String aName) {
// return ASession.getParticipant(clients, aName);
// }
// public SessionParticipantDescription getMember(String aName) {
// return ASession.getParticipant(members, aName);
// }
// maybe there can be a flag that indicates if this port should itself join or not
public synchronized void joinSessionsServer(DuplexRPCClientInputPort aSessionServerClientPort, String aSessionName) {
sessionsServerInputPort = aSessionServerClientPort;
JoinInfo joinInfo = null;
try {
sessionName = aSessionName;
String sessionServerName = sessionsServerInputPort.getLogicalRemoteEndPoint();
sessionServerProxy = (SessionServer) DirectedRPCProxyGenerator.generateRPCProxy(sessionsServerInputPort, sessionServerName, ASessionServer.class, sessionServerName);
switch(joinChoice) {
case MEMBER:
case SYMMETRIC_JOIN:
{
joinInfo = sessionServerProxy.join(aSessionName, serverPortDescription, this);
break;
}
case SERVER_ONLY:
{
joinInfo = sessionServerProxy.joinAsServer(aSessionName, serverPortDescription, this);
// servers = joinInfo.getServers();
break;
}
case CLIENT_ONLY:
{
if (serverPortDescription != null)
// making your ID null regradless of whether you have one or not
serverPortDescription.setID(null);
joinInfo = sessionServerProxy.joinAsClient(aSessionName, null, this);
// currentMembers = AJoinInfo.getMembersClientsAndServers( sessionServerProxy.joinAsClient(aSessionName, null, this));
break;
}
}
servers = joinInfo.getServers();
clients = joinInfo.getClients();
members = joinInfo.getMembers();
participants = AJoinInfo.getMembersClientsAndServers(joinInfo);
// race condition with peer connect. let us store if joined or not
connected();
for (int i = 0; i < participants.size(); i++) joined(participants.get(i));
hasJoined = true;
} catch (Exception e) {
e.printStackTrace();
}
}
use of port.sessionserver.JoinInfo in project GIPC by pdewan.
the class AThreeIndepPortClientLauncher method createUI.
protected void createUI(InputPort anInputPort) {
JoinInfo joinInfo = sessionServerProxy.join(sessionName, new AServerPortDescription(null, null, clientName), new APrintingSessionObserver());
processInitialSessionMembers(joinInfo);
super.createUI(anInputPort);
}
use of port.sessionserver.JoinInfo in project GIPC by pdewan.
the class ARelayingDuplexConnectionsManager method joinSessionServer.
protected void joinSessionServer() {
List<SessionParticipantDescription> currentMembers = null;
JoinInfo joinInfo = null;
switch(joinChoice) {
case MEMBER:
case SYMMETRIC_JOIN:
{
joinInfo = logicalSessionsServerProxy.join(sessionName, sessionClientDescription, this);
// .join(sessionName, sessionClientDescription, this));
break;
}
case SERVER_ONLY:
{
joinInfo = logicalSessionsServerProxy.joinAsServer(sessionName, sessionClientDescription, this);
// sessionClientDescription, this));
break;
}
case CLIENT_ONLY:
{
// note needed as no ports are registered
// sessionClientDescription.setID(null);
joinInfo = logicalSessionsServerProxy.joinAsClient(sessionName, sessionClientDescription, this);
// sessionClientDescription, this));
break;
}
default:
{
System.out.println("Code should not reach here");
}
}
currentMembers = AJoinInfo.getMembersClientsAndServers(joinInfo);
servers = joinInfo.getServers();
clients = joinInfo.getClients();
members = joinInfo.getMembers();
Tracer.info(this, "Current members:" + members);
duplexObjectSessionPort.notifyConnect(duplexObjectSessionPort.getLocalName(), // null));
ARelayingDuplexConnectionsManager.toPeerConnectionType(duplexObjectSessionPort.getParticipantChoice()));
// if (joinChoice == ParticipantChoice.JOIN_AND_OBSERVE)
// currentMembers = logicalSessionsServerProxy.join(sessionName,
// sessionClientDescription, this);
// else if (joinChoice == ParticipantChoice.OBSERVE_ONLY)
// currentMembers = logicalSessionsServerProxy.observe (sessionName,
// this);
// List<ServerPortDescription> currentMembers =
// logicalSessionsServerProxy.join(sessionName,
// sessionClientDescription, this);
processCurrentMembers(currentMembers);
}
use of port.sessionserver.JoinInfo in project GIPC by pdewan.
the class AThreeDepPortClientPseudoLauncher method doPostConnectsAsyncOperations.
@Override
protected void doPostConnectsAsyncOperations() {
ServerPortDescription relayerPortDescription = sessionServerProxy.getRelayerDescripton(sessionName);
JoinInfo joinInfo = joinSessionServer();
ServerPortDescription mvcServerPortDescription = null;
List<SessionParticipantDescription> servers = joinInfo.getServers();
if (servers.size() > 0) {
mvcServerPortDescription = servers.get(0);
} else {
mvcServerHasNotJoined();
}
processMemberJoinInfo(joinInfo);
chainConnectListeners(relayerPortDescription, mvcServerPortDescription);
}
use of port.sessionserver.JoinInfo in project GIPC by pdewan.
the class AThreeDepPortClientLauncher method communicateWithSessionServer.
protected void communicateWithSessionServer() {
ServerPortDescription relayerPortDescription = sessionServerProxy.getRelayerDescripton(sessionName);
JoinInfo joinInfo = joinSessionServer();
ServerPortDescription mvcServerPortDescription = null;
List<SessionParticipantDescription> servers = joinInfo.getServers();
if (servers.size() > 0) {
mvcServerPortDescription = servers.get(0);
} else {
mvcServerHasNotJoined();
}
processMemberJoinInfo(joinInfo);
chainConnectListeners(relayerPortDescription, mvcServerPortDescription);
}
Aggregations