Search in sources :

Example 1 with GroupRPCServerInputPort

use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.

the class ALatecomerRelayerAndSessionServerFactory method createLatecomerSessionsServerAndRelayer.

// @Override
// public GroupRPCServerInputPort createLatecomerSessionsServerAndRelayer(
// String aSessionServerId, String aSessionsServerName,
// String aLogicalServerName) {
// 
// 
// 
// 
// GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(
// aSessionServerId, aSessionsServerName);
// //		GroupSingleResponseSetter.supportSingleResponse(serverInputPort);
// LocalLatecomerSessionsServer sessionsServer = new ALatecomerSessionsServer(serverInputPort);
// serverInputPort.register(sessionsServer);
// //		serverInputPort.register(LatecomerSessionsServer.class, sessionsServer);
// serverInputPort.register(aSessionsServerName, sessionsServer);
// Tracer.info(this, "Created and registered Latecomer session server object connected to server port " + serverInputPort + " for " + aSessionServerId );
// GroupRPCServerInputPort relayPort = serverInputPort; // this causes confusion as multiple client input ports may be opened to same server port
// // those that will use the description should get a separate port, those who do not will simply connect to the same port
// LatecomerRelayer relayer =  LatecomerRelayerObjectSelector.createRelayer(relayPort, sessionsServer);
// relayPort.register(relayer);
// 
// //		relayPort.register(LatecomerRelayer.class, relayer);
// Tracer.info(this, "Created and registered relayer  object connected to server port " + serverInputPort);
// //		relayPort.register(aSessionsServerName, relayer);
// ServerPortDescription relayerPortDescription = new AServerPortDescription("localhost", "" + aSessionServerId, aSessionsServerName);
// Tracer.info(this, "Registering relayer description " + relayerPortDescription + " with session server");
// sessionsServer.setRelayerDescripton(relayerPortDescription);
// 
// //		serverInputPort.connect();
// return serverInputPort;
// }
@Override
public GroupRPCServerInputPort createLatecomerSessionsServerAndRelayer(String aSessionServerId, String aSessionsServerName, String aLogicalServerName) {
    GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(aSessionServerId, // group so that it can be integrated with the relayer to avoid extra port creation and message cost
    aSessionsServerName);
    // GroupSingleResponseSetter.supportSingleResponse(serverInputPort);
    LocalLatecomerSessionsServer sessionsServer = new ALatecomerSessionServer(serverInputPort);
    serverInputPort.register(sessionsServer);
    // serverInputPort.register(LatecomerSessionsServer.class, sessionsServer);
    serverInputPort.register(aSessionsServerName, sessionsServer);
    serverInputPort.register(aLogicalServerName, sessionsServer);
    Tracer.info(this, "Created and registered Latecomer session server object connected to server port " + serverInputPort + " for " + aSessionServerId);
    // this causes confusion as multiple client input ports may be opened to same server port
    // however, registering under a different port means an additional port must be chosen and used
    // best to let the client be aware that the session server is also the relayer
    // by sending null fields in the server port description
    GroupRPCServerInputPort relayPort = serverInputPort;
    // ServerPortDescription relayerPortDescription = new AServerPortDescription("localhost", "" + aSessionServerId, aSessionsServerName);
    // ServerPortDescription relayerPortDescription = new AServerPortDescription(null, null, null);
    // for some reason I put null here instead of a server port description
    ServerPortDescription relayerPortDescription = null;
    // GroupRPCServerInputPort relayPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(
    // relayerPortDescription.getID(), relayerPortDescription.getName());
    // those that will use the description should get a separate port, those who do not will simply connect to the same port
    LatecomerRelayer relayer = LatecomerRelayerObjectSelector.createRelayer(relayPort, sessionsServer);
    relayPort.register(relayer);
    // relayPort.register(LatecomerRelayer.class, relayer);
    Tracer.info(this, "Created and registered relayer  object connected to server port " + serverInputPort);
    // relayPort.register(aSessionsServerName, relayer);
    // regster after creating the relayer
    sessionsServer.setRelayerDescripton(relayerPortDescription);
    Tracer.info(this, "Registered relayer description " + relayerPortDescription + " with session server");
    // serverInputPort.connect();
    return serverInputPort;
}
Also used : ServerPortDescription(port.sessionserver.ServerPortDescription) GroupRPCServerInputPort(inputport.rpc.group.GroupRPCServerInputPort)

Example 2 with GroupRPCServerInputPort

use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.

the class AGroupRPCServerLauncher method launchGroupServer.

public static void launchGroupServer(String anId, String aName) {
    Tracer.showInfo(true);
    RelayerClientAndServerSupport.setRelayedCommunicaton(false);
    GroupRPCServerInputPort serverPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(anId, aName);
    // ConnectListener connectListener = new AGroupCallingConnectListener(serverPort);
    // serverPort.addConnectListener(connectListener);
    Adder adder = new AnAdder();
    serverPort.register(Adder.class, adder);
    serverPort.connect();
}
Also used : AnAdder(sessionport.rpc.duplex.relayed.example.AnAdder) Adder(sessionport.rpc.duplex.relayed.example.Adder) AnAdder(sessionport.rpc.duplex.relayed.example.AnAdder) GroupRPCServerInputPort(inputport.rpc.group.GroupRPCServerInputPort)

Example 3 with GroupRPCServerInputPort

use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.

the class AGroupRPCServerInputPortLauncher method registerRemoteObjects.

@Override
protected void registerRemoteObjects() {
    GroupRPCServerInputPort aGroupServerInputPort = (GroupRPCServerInputPort) mainPort;
    DuplexCounterAndSenderAwareSummer adder = new AGroupCounterAndSenderAwareSumPrinter(aGroupServerInputPort);
    aGroupServerInputPort.register(adder);
}
Also used : DuplexCounterAndSenderAwareSummer(inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer) GroupRPCServerInputPort(inputport.rpc.group.GroupRPCServerInputPort)

Example 4 with GroupRPCServerInputPort

use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.

the class ARelayerPortFactory method createRelayerPort.

// public  GroupRPCServerInputPort createRelayerPort(
// String aRelayerServerId, String aRelayerServerName,
// String sessionsServerHost, String sessionsServerId, String sessionsServerName, String aSessionName) {
// DuplexRPCClientInputPort aSessionServerClientPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort(
// sessionsServerHost, sessionsServerId,
// sessionsServerName, aRelayerServerName);
// return createRelayerPort(aRelayerServerId, aRelayerServerName, aSessionServerClientPort, aSessionName);
// //		sessionsServer.setRelayerDescripton(serverPortDescription);
// 
// 
// }
// 
// public   GroupRPCServerInputPort createRelayerPort(
// String aRelayerServerId, String aRelayerServerName,
// DuplexRPCClientInputPort aSessionServerClientPort, String aSessionName) {
// 
// GroupRPCServerInputPort retVal = createRelayerPort (aRelayerServerId, aRelayerServerName);
// ServerPortDescription serverPortDescription = new AServerPortDescription("localhost", aRelayerServerId, aRelayerServerName);
// RelayerSupportingSessionServer sessionsServer =  (RelayerSupportingSessionServer) DirectedRPCProxyGenerator.generateRPCProxy(aSessionServerClientPort, null, RelayerSupportingSessionServer.class, aSessionServerClientPort.getLogicalRemoteEndPoint());
// aSessionServerClientPort.addConnectionListener(new ASessionServerToRelayerConnectionListener(sessionsServer, serverPortDescription, aSessionName));
// aSessionServerClientPort.connect();
// return retVal;
// 
// 
// }
public GroupRPCServerInputPort createRelayerPort(String relayerId, String relayerName) {
    GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(relayerId, relayerName);
    Relayer relayer = RelayerObjectSelector.createRelayer(serverInputPort);
    // serverInputPort.register(ARelayer.class, relayer);
    serverInputPort.register(relayer);
    serverInputPort.register(relayerName, relayer);
    return serverInputPort;
}
Also used : GroupRPCServerInputPort(inputport.rpc.group.GroupRPCServerInputPort)

Example 5 with GroupRPCServerInputPort

use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.

the class AGroupRPCServerInputPortLauncher method main.

public static void main(String[] args) {
    Tracer.showInfo(true);
    GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort("9090", "test server");
    serverInputPort.connect();
    PrintingReplyingObjectReceiver messageReceiver = new PrintingReplyingObjectReceiver(serverInputPort);
    serverInputPort.addConnectionListener(messageReceiver);
    Adder adder = new AnAdder();
    serverInputPort.register(Adder.class, adder);
    AGroupAdder groupAdder = new AGroupAdder(serverInputPort);
    serverInputPort.register(GroupAdder.class, groupAdder);
    serverInputPort.addSendListener(messageReceiver);
}
Also used : PrintingReplyingObjectReceiver(port.old.PrintingReplyingObjectReceiver) AnAdder(sessionport.rpc.duplex.relayed.example.AnAdder) Adder(sessionport.rpc.duplex.relayed.example.Adder) AnAdder(sessionport.rpc.duplex.relayed.example.AnAdder) GroupRPCServerInputPort(inputport.rpc.group.GroupRPCServerInputPort)

Aggregations

GroupRPCServerInputPort (inputport.rpc.group.GroupRPCServerInputPort)18 ServerPortDescription (port.sessionserver.ServerPortDescription)7 AServerPortDescription (port.sessionserver.AServerPortDescription)6 Adder (sessionport.rpc.duplex.relayed.example.Adder)5 AnAdder (sessionport.rpc.duplex.relayed.example.AnAdder)5 DuplexCounterAndSenderAwareSummer (inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer)3 DuplexRPCClientInputPort (inputport.rpc.duplex.DuplexRPCClientInputPort)2 AGroupCounterAndSenderAwareSumPrinter (inputport.rpc.group.example.AGroupCounterAndSenderAwareSumPrinter)2 ARelayer (port.relay.ARelayer)2 Relayer (port.relay.Relayer)2 RelayerSupportingSessionServer (port.sessionserver.relay.RelayerSupportingSessionServer)2 ConnectionListener (inputport.ConnectionListener)1 DuplexRPCServerInputPort (inputport.rpc.duplex.DuplexRPCServerInputPort)1 Scanner (java.util.Scanner)1 PrintingReplyingObjectReceiver (port.old.PrintingReplyingObjectReceiver)1 SessionObserver (port.sessionserver.SessionObserver)1 SessionServer (port.sessionserver.SessionServer)1 ARelayerSupportingSessionServer (port.sessionserver.relay.ARelayerSupportingSessionServer)1 AnOldGroupCallingConnectListener (sessionport.rpc.group.AnOldGroupCallingConnectListener)1