Package com.dadfha.uid

Examples of com.dadfha.uid.ResUcdRecieve


    if(rawData == null) {
      server.queryProcessFailed();
      return;
    } else
      // Return resolved data packet
      ResUcdRecieve returnPacket = (ResUcdRecieve) rawData;
      ChannelBuffer returnBuffer = ChannelBuffers.wrappedBuffer(returnPacket.pack()); // Wrap return packet byte array
      e.getChannel().write(returnBuffer);         
    }
   
    // ??? close connection here?
   
View Full Code Here


     
        // Extract the packet, hand it to UC client       
      byte[] buffer = Utils.byteBufferToByteArray(((ChannelBuffer) e.getMessage()).toByteBuffer());      
     
      // Parse received packet
        ResUcdRecieve returnPacket = (ResUcdRecieve) protocol.parseRecievePacket(buffer);
        ResUcdQuery queryPacket = null;
       
        // Process returned packet in comparison with sent query packet
        if(!(sendingPacket instanceof UrpQuery)) throw new RuntimeException("The sending packet is not of type UrpQuery.");
        else {         
          // Cast based on command type of the query packet
          UrpQuery uq = (UrpQuery) sendingPacket;
          switch(uq.getCommandId()) {
            case RES_UCD:
              queryPacket = (ResUcdQuery) sendingPacket;
              break;
            default:
              break;
          }         
        }
       
        Object rawData = null;
       
    try {
      rawData = protocol.processRecieve(returnPacket, queryPacket);
    } catch (Exception ex) {
      client.resolveFailed();
    }

    // If the rawData is null after processRecieve() just ignore the packet
        if(rawData == null) {
          return;
        } else { // If it is not null hands the whole packet to client
          ResUcdRecieve finalPacket = (ResUcdRecieve) rawData;
          client.processReturnData(finalPacket);         
          // Check if this is cascade requested packet that need to be forwarded back
          if(protocol.forwardPacketMap.containsKey(queryPacket.getQueryUcode())) {
              assert(protocol.forwardPacketMap.remove(queryPacket.getQueryUcode()) + 1 == finalPacket.getSerialNumber());
              protocol.returnCascadePacket(finalPacket);       
          }

         
        }       
View Full Code Here

TOP

Related Classes of com.dadfha.uid.ResUcdRecieve

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.