Examples of TupleOutput


Examples of com.sleepycat.bind.tuple.TupleOutput

                AMQShortString queueNameAMQ = new AMQShortString(queueName);
                QueueRecord record = new QueueRecord(queueNameAMQ, null, false, null);

                DatabaseEntry key = new DatabaseEntry();

                TupleOutput output = new TupleOutput();
                AMQShortStringEncoding.writeShortString(record.getNameShortString(), output);
                TupleBase.outputToEntry(output, key);

                DatabaseEntry newValue = new DatabaseEntry();
                binding.objectToEntry(record, newValue);
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleOutput

                        Object queueIdString = attributes.remove("queue");
                        if(queueIdString instanceof String)
                        {
                            UUID queueId = UUID.fromString(queueIdString.toString());
                            UUIDTupleBinding.getInstance().objectToEntry(queueId,hierarchyValue);
                            TupleOutput tupleOutput = new TupleOutput();
                            tupleOutput.writeLong(id.getMostSignificantBits());
                            tupleOutput.writeLong(id.getLeastSignificantBits());
                            tupleOutput.writeString("Queue");
                            TupleBinding.outputToEntry(tupleOutput, hierarchyKey);
                            hierarchyDb.put(txn, hierarchyKey, hierarchyValue);
                        }
                        Object exchangeIdString = attributes.remove("exchange");
                        if(exchangeIdString instanceof String)
                        {
                            UUID exchangeId = UUID.fromString(exchangeIdString.toString());
                            UUIDTupleBinding.getInstance().objectToEntry(exchangeId,hierarchyValue);
                            TupleOutput tupleOutput = new TupleOutput();
                            tupleOutput.writeLong(id.getMostSignificantBits());
                            tupleOutput.writeLong(id.getLeastSignificantBits());
                            tupleOutput.writeString("Exchange");
                            TupleBinding.outputToEntry(tupleOutput, hierarchyKey);
                            hierarchyDb.put(txn, hierarchyKey, hierarchyValue);
                        }
                        TupleOutput tupleOutput = new TupleOutput();
                        tupleOutput.writeString(type);
                        StringWriter writer = new StringWriter();
                        mapper.writeValue(writer,attributes);
                        tupleOutput.writeString(writer.getBuffer().toString());
                        TupleBinding.outputToEntry(tupleOutput, value);
                        objectsCursor.putCurrent(value);
                    }
                    catch (IOException e)
                    {
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleOutput

    void storeVirtualHostHierarchyRecord(Database hierarchyDb, Transaction txn, UUID id, UUID virtualHostId)
    {
        DatabaseEntry key = new DatabaseEntry();
        DatabaseEntry value = new DatabaseEntry();
        UUIDTupleBinding.getInstance().objectToEntry(virtualHostId, value);
        TupleOutput tupleOutput = new TupleOutput();
        tupleOutput.writeLong(id.getMostSignificantBits());
        tupleOutput.writeLong(id.getLeastSignificantBits());
        tupleOutput.writeString("VirtualHost");
        TupleBinding.outputToEntry(tupleOutput, key);
        hierarchyDb.put(txn, key, value);
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleOutput

                AMQShortString queueNameAMQ = new AMQShortString(queueName);
                QueueRecord record = new QueueRecord(queueNameAMQ, null, false, null);

                DatabaseEntry key = new DatabaseEntry();

                TupleOutput output = new TupleOutput();
                AMQShortStringEncoding.writeShortString(record.getNameShortString(), output);
                TupleBase.outputToEntry(output, key);

                DatabaseEntry newValue = new DatabaseEntry();
                binding.objectToEntry(record, newValue);
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleOutput

                DUMMY_ATTRIBUTES_MAP);
    }

    public void testObjectToEntryAndEntryToObject()
    {
        TupleOutput tupleOutput = new TupleOutput();

        _configuredObjectBinding.objectToEntry(_object, tupleOutput);

        byte[] entryAsBytes = tupleOutput.getBufferBytes();
        TupleInput tupleInput = new TupleInput(entryAsBytes);

        ConfiguredObjectRecord storedObject = _configuredObjectBinding.entryToObject(tupleInput);
        assertEquals("Unexpected attributes", DUMMY_ATTRIBUTES_MAP, storedObject.getAttributes());
        assertEquals("Unexpected type", DUMMY_TYPE_STRING, storedObject.getType());
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleOutput

     * @param object the object being serialized
     * @return the hex string containing the serialized hex form of the object
     */
    static <T> String objectToHex(TupleBinding<T> binding, T object) {
        StringBuffer buffer = new StringBuffer();
        TupleOutput tuple = new TupleOutput(new byte[100]);
        binding.objectToEntry(object, tuple);
        byte[] bytes = tuple.getBufferBytes();
        int size = tuple.getBufferLength();

        for (int i=0; i < size; i++) {
            int lowNibble = (bytes[i] & 0xf);
            int highNibble = ((bytes[i]>>4) & 0xf);
            buffer.append(Character.forDigit(lowNibble,16));
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleOutput

     *
     * @return the serailized byte array
     */
    static public byte[] serializeBytes(RepNodeImpl node) {
        final NodeBinding binding = new NodeBinding();
        TupleOutput tuple = new TupleOutput(new byte[100]);
        binding.objectToEntry(node, tuple);
        return tuple.getBufferBytes();
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleOutput

    public boolean createSecondaryKey(SecondaryDatabase secDb, DatabaseEntry keyEntry, DatabaseEntry valueEntry,
            DatabaseEntry resultEntry) throws DatabaseException {
        KeyValue kv = KeyValue.class.cast(keyBinding.entryToObject(keyEntry));
        long timestamp = kv.getTimestamp();
       
        TupleOutput to = new TupleOutput();
        to.writeLong(timestamp);
        resultEntry.setData(to.getBufferBytes());
        return true;
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleOutput

    public boolean createSecondaryKey(SecondaryDatabase secDb, DatabaseEntry keyEntry, DatabaseEntry valueEntry,
            DatabaseEntry resultEntry) throws DatabaseException {
        KeyValue kv = KeyValue.class.cast(keyBinding.entryToObject(keyEntry));
        String feedID = kv.getFeedID();
       
        TupleOutput to = new TupleOutput();
        to.writeString(feedID);
        resultEntry.setData(to.getBufferBytes());
        return true;
    }
View Full Code Here

Examples of com.sleepycat.bind.tuple.TupleOutput

    * parts.
    */
   private DatabaseEntry makeKeyEntry(Fqn name, int nParts) {

      /* Write the sequence of name parts. */
      TupleOutput tupleOutput = new TupleOutput();
      for (int i = 0; i < nParts; i += 1) {
         tupleOutput.writeString(name.get(i).toString());
      }

      /* Return the tuple as an entry. */
      DatabaseEntry entry = new DatabaseEntry();
      TupleBinding.outputToEntry(tupleOutput, entry);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.