Package java.util

Examples of java.util.UUID


  public void registerGlobal(Class cInterface, Object objImplementation) throws LipeRMIException {
    exportObject(cInterface, objImplementation, null);
  }
 
  public void exportObject(Class<?> cInterface, Object exportedObject) throws LipeRMIException {
    UUID objUUID = java.util.UUID.randomUUID();
    String instanceId = objUUID.toString();

    exportObject(cInterface, exportedObject, instanceId);
  }
View Full Code Here


   * @param peerId the peer's ID that will be converted into a UUID
   * @return a UUID or null if there's a ZK connection issue
   */
  public UUID getPeerUUID(String peerId) {
    ReplicationPeer peer = getPeerClusters().get(peerId);
    UUID peerUUID = null;
    try {
      peerUUID = getUUIDForCluster(peer.getZkw());
    } catch (KeeperException ke) {
      reconnectPeer(ke, peer);
    }
View Full Code Here

            // these are the serialized row mutations that I must apply.
            // check versions at every step along the way to make sure migrations are not applied out of order.
            Collection<Column> cols = MigrationManager.makeColumns(message);
            for (Column col : cols)
            {
                final UUID version = UUIDGen.getUUID(col.name());
                if (version.timestamp() > DatabaseDescriptor.getDefsVersion().timestamp())
                {
                    final Migration m = Migration.deserialize(col.value());
                    assert m.getVersion().equals(version);
                    StageManager.getStage(Stage.MIGRATION).submit(new WrappedRunnable()
                    {
                        @Override
                        protected void runMayThrow() throws Exception
                        {
                            // check to make sure the current version is before this one.
                            if (DatabaseDescriptor.getDefsVersion().timestamp() == version.timestamp())
                                logger.debug("Not appling (equal) " + version.toString());
                            else if (DatabaseDescriptor.getDefsVersion().timestamp() > version.timestamp())
                                logger.debug("Not applying (before)" + version.toString());
                            else
                            {
                                logger.debug("Applying {} from {}", m.getClass().getSimpleName(), message.getFrom());
                                try
                                {
View Full Code Here

        }
        if (bytes.remaining() != 16)
        {
            throw new MarshalException("UUIDs must be exactly 16 bytes");
        }
        UUID uuid = UUIDGen.getUUID(bytes);
        if (uuid.version() != 1)
        {
            throw new MarshalException("TimeUUID only makes sense with version 1 UUIDs");
        }
        return uuid.toString();
    }
View Full Code Here

        return uuid.toString();
    }

    public ByteBuffer fromString(String source)
    {
        UUID uuid = UUID.fromString(source);

        if (uuid.version() != 1)
            throw new IllegalArgumentException("TimeUUID supports only version 1 UUIDs");

        return decompose(uuid);
    }
View Full Code Here

        ks1.apply();
       
        assert DatabaseDescriptor.getTableDefinition("ks0") != null;
        assert DatabaseDescriptor.getTableDefinition("ks1") != null;
       
        DatabaseDescriptor.clearTableDefinition(DatabaseDescriptor.getTableDefinition("ks0"), new UUID(4096, 0));
        DatabaseDescriptor.clearTableDefinition(DatabaseDescriptor.getTableDefinition("ks1"), new UUID(4096, 0));
       
        assert DatabaseDescriptor.getTableDefinition("ks0") == null;
        assert DatabaseDescriptor.getTableDefinition("ks1") == null;
       
        DatabaseDescriptor.loadSchemas();
View Full Code Here

            } else if ("/uuid".equals(mb)) {
                matches = true;
                if (!pt.getScopes().getValue().isEmpty()) {
                    for (String ps : pt.getScopes().getValue()) {
                        boolean foundOne = false;
                        UUID psuuid = toUUID(ps);
                        for (String hts : ht.getScopes().getValue()) {
                            UUID htuuid = toUUID(hts);
                            if (!htuuid.equals(psuuid)) {
                                foundOne = true;
                            }
                        }
                        matches &= foundOne;
                    }
View Full Code Here

        mostSigBits |= 0x0000000000004000L//set version

        leastSigBits &= 0x3FFFFFFFFFFFFFFFL; //clear the variant
        leastSigBits |= 0x8000000000000000L; //set to IETF variant
       
        UUID result = new UUID(mostSigBits, leastSigBits);
       
        return "uuid:" + result.toString();
    }
View Full Code Here

   
    @Test
    public void testFromStringParameters() throws Exception {
        Class<?>[] argType = {UUID.class, CustomerGender.class, CustomerGender.class};
        Method m = Customer.class.getMethod("testFromStringParam", argType);
        UUID u = UUID.randomUUID();
        Message messageImpl = createMessage();
        messageImpl.put(Message.QUERY_STRING, "p1=" + u.toString() + "&p2=1&p3=2");
        List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m,
                                                               new ClassResourceInfo(Customer.class)),
                                                           null,
                                                           messageImpl);
        assertEquals(3, params.size());
        assertEquals("Query UUID Parameter was not matched correctly",
                     u.toString(), params.get(0).toString());
        assertSame(CustomerGender.FEMALE, params.get(1));
        assertSame(CustomerGender.MALE, params.get(2));
    }
View Full Code Here

    public String getJMSMessageID() throws JMSException
    {
        if (_messageID == null && _messageProps.getMessageId() != null)
        {
            UUID id = _messageProps.getMessageId();
            _messageID = "ID:" + id;
        }
        return _messageID;
    }
View Full Code Here

TOP

Related Classes of java.util.UUID

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.