use of port.sessionserver.ServerPortDescription in project GIPC by pdewan.
the class ASessionServerRelayerPortFactory method createRelayerPort.
public GroupRPCServerInputPort createRelayerPort(String aRelayerServerId, String aRelayerServerName, DuplexRPCClientInputPort aSessionServerClientPort, String aSessionName) {
GroupRPCServerInputPort retVal = createRelayerPort(aRelayerServerId, aRelayerServerName);
String myHostName = "localhost";
try {
myHostName = InetAddress.getLocalHost().getHostName();
} catch (Exception e) {
e.printStackTrace();
}
ServerPortDescription serverPortDescription = new AServerPortDescription(myHostName, aRelayerServerId, aRelayerServerName);
RelayerSupportingSessionServer sessionsServer = (RelayerSupportingSessionServer) DirectedRPCProxyGenerator.generateRPCProxy(aSessionServerClientPort, null, ARelayerSupportingSessionServer.class, aSessionServerClientPort.getLogicalRemoteEndPoint());
aSessionServerClientPort.addConnectionListener(new ASessionServerToRelayerConnectionListener(aSessionServerClientPort, sessionsServer, serverPortDescription, aSessionName));
aSessionServerClientPort.connect();
return retVal;
}
use of port.sessionserver.ServerPortDescription in project GIPC by pdewan.
the class ALatecomerRelayerAndSessionsServerCreator method createServer.
public static GroupRPCServerInputPort createServer(String aSessionsServerName, String aSessionServerId) {
GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(aSessionServerId, aSessionsServerName);
SingleResponseReplicatedClientServerUtlity.supportSingleResponse(serverInputPort);
LocalLatecomerSessionsServer sessionsServer = new ALatecomerSessionServer(serverInputPort);
serverInputPort.register(LatecomerSessionServer.class, sessionsServer);
serverInputPort.register(aSessionsServerName, sessionsServer);
Tracer.info(sessionsServer, "Created and registered Latecomer session server object connected to server port " + serverInputPort + " for " + aSessionServerId);
GroupRPCServerInputPort relayPort = serverInputPort;
LatecomerRelayer relayer = new ALatecomerRelayer(relayPort, sessionsServer);
relayPort.register(LatecomerRelayer.class, relayer);
Tracer.info(sessionsServer, "Created and registered relayer object connected to server port " + serverInputPort);
// relayPort.register(aSessionsServerName, relayer);
ServerPortDescription relayerPortDescription = new AServerPortDescription("localhost", "" + aSessionServerId, aSessionsServerName);
Tracer.info(sessionsServer, "Registering relayer description " + relayerPortDescription + " with session server");
sessionsServer.setRelayerDescripton(relayerPortDescription);
serverInputPort.connect();
return serverInputPort;
}
use of port.sessionserver.ServerPortDescription in project GIPC by pdewan.
the class ALatecomerRelayerAndSessionsServerCreator method createLatecomerSessionsServerAndRelayer.
// no real difference between the two methods except the name of the relayers, what is going on
public static GroupRPCServerInputPort createLatecomerSessionsServerAndRelayer(String aSessionServerId, String aSessionsServerName, String aLogicalServerName) {
GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(aSessionServerId, aSessionsServerName);
LocalLatecomerSessionsServer sessionsServer = new ALatecomerSessionServer(serverInputPort);
serverInputPort.register(LatecomerSessionServer.class, sessionsServer);
serverInputPort.register(aLogicalServerName, sessionsServer);
Tracer.info("Created and registered Latecomer session server object connected to server port " + serverInputPort + " for " + aSessionServerId);
GroupRPCServerInputPort relayPort = serverInputPort;
LatecomerRelayer relayer = new ALatecomerRelayer(relayPort, sessionsServer);
relayPort.register(LatecomerRelayer.class, relayer);
relayPort.register(RELAYER_NAME, relayer);
Tracer.info("Created and registered relayer object connected to server port " + serverInputPort);
ServerPortDescription relayerPortDescription = new AServerPortDescription("localhost", "" + aSessionServerId, RELAYER_NAME);
sessionsServer.setRelayerDescripton(relayerPortDescription);
serverInputPort.connect();
return serverInputPort;
}
use of port.sessionserver.ServerPortDescription 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.ServerPortDescription in project GIPC by pdewan.
the class AnOldSessionClientLauncher method launch.
public static void launch(String myHost, String myID, String myName) {
GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(myID, myName);
Adder adder = new AnAdder();
serverInputPort.register(Adder.class, adder);
serverInputPort.connect();
// SessionObserver observer = new APrintingSessionObserver();
SessionObserver observer = new AJoinerConnectingSessionObserver(myName);
ServerPortDescription sessionClientDescription = new AServerPortDescription(myHost, myID, myName);
DuplexRPCClientInputPort clientInputPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort("localhost", "" + SESSION_SERVER_PORT, SESSION_SERVER_NAME, myName);
clientInputPort.connect();
try {
SessionServer sessionServerProxy = (SessionServer) DirectedRPCProxyGenerator.generateRPCProxy(clientInputPort, null, SessionServer.class, null);
Object retVal = sessionServerProxy.join("Test Session", sessionClientDescription, observer);
System.out.println(retVal);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations