Package fpdu

Examples of fpdu.WrongFPDUException


    if (connection.getState() != EnumState.connected) {
      System.out.println("CONNECTION WS Error: " +
          "Cannot release connection (connection " +
          "was not open in the first place)");
      // Raise exception
      throw new WrongFPDUException("CONNECTION WS Error: " +
          "Cannot release connection (connection " +
          "was not open in the first place)");
    }
    connection.setState(EnumState.waitfor_relconf);
    // Create FPDU relconf
View Full Code Here


          connection.getState() != EnumState.waitfor_acconnect) {   
          System.out.println("CONNECTION WS Error: " +
              "Cannot ack connect  ( " +
              "did not send connect in the first place)");
          // Raise exception
          throw new WrongFPDUException("CONNECTION WS Error: " +
              "Cannot ack connect  ( " +
              "did not receive connect in the first place)");
        }
        connection.setState(EnumState.connected);
        // A transfer is now ready to start
        break;
      case RCONNECT:
        connection = ConnectionPool.getOutConnections()
          .get(remoteBank);
        if (connection == null ||
          connection.getState() != EnumState.waitfor_acconnect) {   
          System.out.println("CONNECTION WS Error: " +
              "Cannot refuse connect  ( " +
              "did not receive connect in the first place)");
          // Raise exception
          throw new WrongFPDUException("CONNECTION WS Error: " +
              "Cannot refuse connect  ( " +
              "did not receive connect in the first place)");
        }
        connection.setState(EnumState.connection_refused);
        // A transfer is now ready to start
        break;
      case RELEASE:
        // Here the remote bank wants to close the connection
       
        // We have to check if the remote bank is the actual seeker
        // of the connection , otherwise it cannot ask for a release
       
        connection = ConnectionPool.getOutConnections()
          .get(remoteBank);
        if (connection == null ||
          connection.getState() != EnumState.connected) {
          System.out.println("CONNECTION WS Error: " +
              "Cannot release connection (connection " +
              "was not open in the first place)");
          // Raise exception
          throw new WrongFPDUException("CONNECTION WS Error: " +
              "Cannot release connection (connection " +
              "was not open in the first place)");
          // TODO: handle lost of release packets
        }
        connection.setState(EnumState.idle);
        // Release connection
        ConnectionPool.returnConnection(remoteBank, connection);

        // Create FPDU relconf
        parameter = new FPDUParameter("Local", remoteBank);
        date = new Date();
        parameter.setDate(date);
        parameter.setLocalConnectionId(connection.getIdConnection());
        parameter.setRemoteConnectionId(connection.getRemoteId());
        fpduResponse = new FPDU(EnumFPDU.RELCONF, parameter);
        respBool = true;
        break;
      case RELCONF:
        // The connection is closed
        connection = ConnectionPool.getOutConnections()
          .get(remoteBank);
        if (connection == null || connection.getState() !=
          EnumState.waitfor_relconf) {
          System.out.println("CONNECTION WS Error: " +
              "Received relconf but was not waiting for" +
              " one");
          // Raise exception
          throw new WrongFPDUException("CONNECTION WS Error: " +
              "Received relconf but was not waiting for one");
        }
        connection.setState(EnumState.idle);
        ConnectionPool.returnConnection(remoteBank, connection);
        break;
View Full Code Here

TOP

Related Classes of fpdu.WrongFPDUException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.