Search in sources :

Example 6 with DuplexRPCClientInputPort

use of inputport.rpc.duplex.DuplexRPCClientInputPort in project GIPC by pdewan.

the class ADelayingObjectGroupSessionPortLauncher method launchSessionPartipant.

public static void launchSessionPartipant(String anId, String aName, boolean addConnectListener, boolean addReplyingReceiveListener, boolean greetOnReadingInput) {
    // Tracer.showInfo(true);
    // GlobalState.setRelayedCommunicaton(true);
    RelayerClientAndServerSupport.setEfficientRelayedCommunicaton(true);
    DelayUtlity.setDelayClientBufferSends(true);
    // GlobalState.setCausalBroadcast(true);
    // GlobalState.setDelayAndCausal(true);
    DuplexRPCClientInputPort sessionManagerClientPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort("localhost", "" + ADelayingRelayingSessionsServerLauncher.SESSION_SERVER_PORT, ADelayingRelayingSessionsServerLauncher.SESSION_SERVER_NAME, aName);
    GroupSessionPort<Object> sessionPort = ObjectGroupSessionPortSelector.createObjectGroupSessionPort(sessionManagerClientPort, "Test Session", anId, aName, ParticipantChoice.MEMBER);
    ACausalGroupSessionPortLauncherSupport.doCausalBroadcast(sessionPort);
    // PrintingReplyingReceiveListener printingReplyingReceiveListener = new PrintingReplyingReceiveListener(sessionPort);
    if (addConnectListener) {
        ConnectionListener connectListener = new AnObjectGroupSendingConnectListener(sessionPort);
        // sessionPort.addConnectListener(printingReplyingReceiveListener);
        sessionPort.addConnectionListener(connectListener);
    }
    if (addReplyingReceiveListener)
        sessionPort.addReceiveListener(new AnObjectGroupSendingReceiveListener(sessionPort));
    else
        sessionPort.addReceiveListener(new AnEchoingObjectReceiveListener());
    // serverInputPort.addDisconnectListener(echoingReceiveListener);
    // sessionPort.addReceiveListener(printingReplyingReceiveListener);
    sessionPort.connect();
    System.out.println("-----------------------Connected to Session Port---------------------------------------");
    if (greetOnReadingInput) {
        Scanner in = new Scanner(System.in);
        String message = in.nextLine();
        sessionPort.sendAll(aName + " says hi to all");
        while (true) {
            in = new Scanner(System.in);
            message = in.nextLine();
            sessionPort.sendAll(message);
        }
    }
}
Also used : Scanner(java.util.Scanner) DuplexRPCClientInputPort(inputport.rpc.duplex.DuplexRPCClientInputPort) ConnectionListener(inputport.ConnectionListener) AnObjectGroupSendingConnectListener(sessionport.datacomm.group.object.example.AnObjectGroupSendingConnectListener)

Example 7 with DuplexRPCClientInputPort

use of inputport.rpc.duplex.DuplexRPCClientInputPort in project GIPC by pdewan.

the class AServerConnectingConnectionListener method connected.

@Override
public void connected(String aRemoteEndName, ConnectionType aConnectionType) {
    // super.connected(aRemoteEndName, aConnectionType);
    // no super call as this conected may be a dummy call
    DuplexRPCClientInputPort nextPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort(nextServerPortDescription.getHost(), nextServerPortDescription.getID(), nextServerPortDescription.getName(), clientName);
    nextConnectionListener.initInputPort(nextPort);
    nextPort.addConnectionListener(nextConnectionListener);
    nextPort.connect();
}
Also used : DuplexRPCClientInputPort(inputport.rpc.duplex.DuplexRPCClientInputPort)

Example 8 with DuplexRPCClientInputPort

use of inputport.rpc.duplex.DuplexRPCClientInputPort in project GIPC by pdewan.

the class AnMVCServerConnectionListener method initInputPort.

@Override
public void initInputPort(InputPort anInputPort) {
    inputPort = (DuplexRPCClientInputPort) anInputPort;
    // create and set proxies
    DuplexUpperCaser upperCaseProxy = (DuplexUpperCaser) DirectedRPCProxyGenerator.generateRPCProxy((DuplexRPCClientInputPort) inputPort, ADuplexRPCServerMVCLauncher.REGISTERED_DUPLEX_UPPER_CASER_CLASS);
    model.setUpperCaser(upperCaseProxy);
    // register remote object
    ((DuplexRPCClientInputPort) inputPort).register(model.getCounter());
}
Also used : DuplexUpperCaser(examples.mvc.local.duplex.DuplexUpperCaser) DuplexRPCClientInputPort(inputport.rpc.duplex.DuplexRPCClientInputPort)

Example 9 with DuplexRPCClientInputPort

use of inputport.rpc.duplex.DuplexRPCClientInputPort in project GIPC by pdewan.

the class ALatecomerAssymetricObjectGroupSessionPortLauncher method getPort.

protected InputPort getPort() {
    DuplexRPCClientInputPort sessionManagerClientPort = ReplicatedServerDuplexRPCClientPortSelector.createDuplexRPCPort(serversDescription, SESSION_SERVER_NAME, name, ParticipantChoice.SYMMETRIC_JOIN);
    // DuplexSingleResponseSetter.supportSingleResponse(sessionManagerClientPort);
    GroupSessionPort<Object> sessionPort = ObjectGroupSessionPortSelector.createObjectGroupSessionPort(sessionManagerClientPort, SESSION_NAME, id, name, ParticipantChoice.MEMBER);
    return sessionPort;
}
Also used : DuplexRPCClientInputPort(inputport.rpc.duplex.DuplexRPCClientInputPort)

Example 10 with DuplexRPCClientInputPort

use of inputport.rpc.duplex.DuplexRPCClientInputPort in project GIPC by pdewan.

the class ALatecomerAssymetricObjectGroupSessionPortLauncher method launchSessionPartipant.

public static void launchSessionPartipant(String anId, String aName, boolean addConnectListener, boolean addReplyingReceiveListener, boolean greetOnReadingInput) {
    PortMisc.displayConnections();
    // Tracer.showInfo(true);
    // Tracer.setKeyWordStatus(Tracer.ALL_KEYWORDS, false);
    // Tracer.setKeyWordStatus("socketip", true);
    // Tracer.setKeyWordStatus("socketdip", true);
    // Tracer.setKeyWordStatus("sesrelaylategrpobj", true);
    // Tracer.setKeyWordStatus("repsrvdupsingleresp", true);
    // Tracer.setKeyWordStatus("repsrvgrpsingleresp", true);
    // Tracer.setKeyWordStatus("sesrelay", true);
    ALatecomerRelayerAndSessionServerLauncherSupport.setLatecomerRelayedCommunicaton(true);
    // GlobalState.setAnyCast(true);
    DelayUtlity.setDelayClientBufferSends(true);
    // DuplexRPCClientInputPort sessionManagerClientPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort(
    // "localhost", "" +
    // ALatecomerSessionsServerLauncher.SESSION_SERVER_PORT,
    // ALatecomerSessionsServerLauncher.SESSION_SERVER_NAME,
    // aName);
    DuplexRPCClientInputPort sessionManagerClientPort = ReplicatedServerDuplexRPCClientPortSelector.createDuplexRPCPort(serversDescription, SESSION_SERVER_NAME, aName, ParticipantChoice.SYMMETRIC_JOIN);
    DuplexSingleResponseUtlity.supportSingleResponse(sessionManagerClientPort);
    GroupSessionPort<Object> sessionPort = ObjectGroupSessionPortSelector.createObjectGroupSessionPort(sessionManagerClientPort, SESSION_NAME, anId, aName, ParticipantChoice.MEMBER);
    // GlobalState.doCausalBroadcast(sessionPort);
    if (addConnectListener) {
        ConnectionListener connectListener = new AnObjectGroupSendingConnectListener(sessionPort);
        sessionPort.addConnectionListener(connectListener);
    }
    if (addReplyingReceiveListener)
        sessionPort.addReceiveListener(new AnObjectGroupSendingReceiveListener(sessionPort));
    else
        sessionPort.addReceiveListener(new AnEchoingObjectReceiveListener());
    sessionPort.connect();
    System.out.println("-----------------------Connected to Session Port---------------------------------------");
    if (greetOnReadingInput) {
        Scanner in = new Scanner(System.in);
        // sessionPort.sendAll(aName + " says hi to all");
        while (true) {
            System.out.println("Please enter  next input");
            // in = new Scanner(System.in);
            String message = in.nextLine();
            sessionPort.sendAll(message);
        }
    }
}
Also used : Scanner(java.util.Scanner) DuplexRPCClientInputPort(inputport.rpc.duplex.DuplexRPCClientInputPort) AnEchoingObjectReceiveListener(port.delay.example.AnEchoingObjectReceiveListener) ConnectionListener(inputport.ConnectionListener) AnObjectGroupSendingConnectListener(sessionport.datacomm.group.object.example.AnObjectGroupSendingConnectListener) AnObjectGroupSendingReceiveListener(port.delay.example.AnObjectGroupSendingReceiveListener)

Aggregations

DuplexRPCClientInputPort (inputport.rpc.duplex.DuplexRPCClientInputPort)17 ConnectionListener (inputport.ConnectionListener)4 Scanner (java.util.Scanner)4 AnObjectGroupSendingConnectListener (sessionport.datacomm.group.object.example.AnObjectGroupSendingConnectListener)4 AnEchoingObjectReceiveListener (port.delay.example.AnEchoingObjectReceiveListener)3 AnObjectGroupSendingReceiveListener (port.delay.example.AnObjectGroupSendingReceiveListener)3 AServerPortDescription (port.sessionserver.AServerPortDescription)3 ServerPortDescription (port.sessionserver.ServerPortDescription)3 Adder (sessionport.rpc.duplex.relayed.example.Adder)3 AnAdder (sessionport.rpc.duplex.relayed.example.AnAdder)3 ACounter (examples.mvc.local.duplex.ACounter)2 DuplexUpperCaser (examples.mvc.local.duplex.DuplexUpperCaser)2 GroupRPCServerInputPort (inputport.rpc.group.GroupRPCServerInputPort)2 RelayerSupportingSessionServer (port.sessionserver.relay.RelayerSupportingSessionServer)2 RPCProxyGenerator (inputport.rpc.RPCProxyGenerator)1 ADuplexRPCInputPortLauncherSupport (inputport.rpc.duplex.ADuplexRPCInputPortLauncherSupport)1 PrintingTypedReceiveListener (oldtypedip.PrintingTypedReceiveListener)1 PrintingTypedReceiveListener (port.old.PrintingTypedReceiveListener)1 ARelayer (port.relay.ARelayer)1 Relayer (port.relay.Relayer)1