Package java.util

Examples of java.util.UUID$Holder


        long msb = new BigInteger(randomBytes).longValue();
        random.nextBytes(randomBytes);
        randomBytes[0&= 0x3f/* clear variant        */
        randomBytes[0|= 0x80/* set to IETF variant  */
        long lsb = new BigInteger(randomBytes).longValue();
        record.setUUID("mmuid:"+new UUID(msb, lsb)); //$NON-NLS-1$
  }
View Full Code Here


     * @param a the first UUID
     * @param b the second UUID
     * @return a xor b
     */
    public static UUID xorUUID(UUID a, UUID b) {
        return new UUID(a.getMostSignificantBits() ^ b.getMostSignificantBits(),
                a.getLeastSignificantBits() ^ b.getLeastSignificantBits());
    }
View Full Code Here

    }

    private void testUUID(Connection conn) throws SQLException {
        Statement stat = conn.createStatement();
        stat.execute("create table test_uuid(id uuid primary key)");
        UUID uuid = new UUID(-2, -1);
        PreparedStatement prep = conn.prepareStatement("insert into test_uuid values(?)");
        prep.setObject(1, uuid);
        prep.execute();
        ResultSet rs = stat.executeQuery("select * from test_uuid");
        rs.next();
View Full Code Here

            if (x instanceof SimpleResultSet) {
                return ValueResultSet.get((ResultSet) x);
            }
            return ValueResultSet.getCopy((ResultSet) x, Integer.MAX_VALUE);
        } else if (x instanceof UUID) {
            UUID u = (UUID) x;
            return ValueUuid.get(u.getMostSignificantBits(), u.getLeastSignificantBits());
        } else if (x instanceof Object[]) {
            // (a.getClass().isArray());
            // (a.getClass().getComponentType().isPrimitive());
            Object[] o = (Object[]) x;
            int len = o.length;
View Full Code Here

    }
  }

  @Override
  public Object javaToSqlArg(FieldType fieldType, Object obj) {
    UUID uuid = (UUID) obj;
    return uuid.toString();
  }
View Full Code Here

    public boolean equals(Object other) {
        return other instanceof ValueUuid && compareSecure((Value) other, null) == 0;
    }

    public Object getObject() {
        return new UUID(high, low);
    }
View Full Code Here

      throw new NullPointerException("User is null. user=" + user);
    }
    TokenTicket ticket = openTickets.get(user.getUsername());
    if(ticket != null && token != null && token.length() > 0){
      if(ticket.getUsername().equals(user.getUsername())){
        UUID tokenUUID = UUID.fromString(token);
        UUID checkUUID = UUID.fromString(ticket.getToken());
        return checkUUID.equals(tokenUUID);
      }
    }
    return false;
  }
View Full Code Here

        return readXbmImage(result.xbmHeader, result.cParser);
    }

    private String randomName()
    {
        UUID uuid = UUID.randomUUID();
        StringBuilder stringBuilder = new StringBuilder("a");
        long bits = uuid.getMostSignificantBits();
        // Long.toHexString() breaks for very big numbers
        for (int i = 64 - 8; i >= 0; i -= 8)
            stringBuilder.append(Integer.toHexString((int)((bits >> i) & 0xff)));
        bits = uuid.getLeastSignificantBits();
        for (int i = 64 - 8; i >= 0; i -= 8)
            stringBuilder.append(Integer.toHexString((int)((bits >> i) & 0xff)));
        return stringBuilder.toString();
    }
View Full Code Here

        return readXpmImage(result.xpmHeader, result.cParser);
    }

    private String randomName()
    {
        UUID uuid = UUID.randomUUID();
        StringBuilder stringBuilder = new StringBuilder("a");
        long bits = uuid.getMostSignificantBits();
        // Long.toHexString() breaks for very big numbers
        for (int i = 64 - 8; i >= 0; i -= 8)
            stringBuilder.append(Integer.toHexString((int)((bits >> i) & 0xff)));
        bits = uuid.getLeastSignificantBits();
        for (int i = 64 - 8; i >= 0; i -= 8)
            stringBuilder.append(Integer.toHexString((int)((bits >> i) & 0xff)));
        return stringBuilder.toString();
    }
View Full Code Here

    *
    * @return a <code>String</code> representing the generated identifier.
    */
   private String generateSessionId()
   {
      UUID uid = UUID.randomUUID();
      String higherBits = Long.toHexString(uid.getMostSignificantBits());
      String lowerBits = Long.toHexString(uid.getLeastSignificantBits());

      return (higherBits + lowerBits).toUpperCase();
   }
View Full Code Here

TOP

Related Classes of java.util.UUID$Holder

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.