Package com.dadfha.uid

Examples of com.dadfha.uid.ResUcdQuery


    // Read data from buffer
    byte[] buffer = Utils.byteBufferToByteArray(((ChannelBuffer) e.getMessage()).toByteBuffer());
   
    // Parse data in UCR Protocol:UrpQuery format
    ResUcdQuery queryPacket = (ResUcdQuery) protocol.parseQueryPacket(buffer);
   
    // Process query
    Object rawData = protocol.processQuery(queryPacket);
   
    if(rawData == null) {
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

   
    // Construct query packet
    //ResUcdQuery ruqPacket = new ResUcdQuery(QueryMode.UIDC_RSMODE_RESOLUTION, QueryAttribute.UIDC_ATTR_SS, code.getUcodeType());
   
    // ...Or construct the cascade resolution request
    ResUcdQuery ruqPacket = new ResUcdQuery(QueryMode.UIDC_RSMODE_CASCADE, QueryAttribute.UIDC_ATTR_SS, code.getUcodeType());
   
    ruqPacket.addQuery(code, mask);
   
    // Remotely resolve ucode
    protocol.setClient(client);
    protocol.resolveUcodeRemote(ruqPacket, "127.0.0.1");
   
View Full Code Here

TOP

Related Classes of com.dadfha.uid.ResUcdQuery

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.