Package com.basho.riak.client.core.operations

Examples of com.basho.riak.client.core.operations.StoreOperation$Response$Builder


  public void deleteAttachment(ERS3Attachment attachment)
      throws MalformedURLException, IOException {
    AWSAuthConnection conn = attachment.awsConnection();
    String bucket = attachment.bucket();
    String key = attachment.key();
    Response response = conn.delete(bucket, key, null);
    if (failed(response)) {
      throw new IOException("Failed to delete '" + bucket + "/" + key
          + "' to S3: Error " + response.connection.getResponseCode()
          + ": " + response.connection.getResponseMessage());
    }
View Full Code Here


          headers.put("Content-Disposition", Arrays
              .asList(new String[] { "attachment; filename="
                  + originalFileName }));
        }

        Response response = conn.putStream(bucket, key,
            attachmentStreamObject, headers);
        if (failed(response)) {
          throw new IOException("Failed to write '" + bucket + "/"
              + key + "' to S3: Error "
              + response.connection.getResponseCode() + ": "
View Full Code Here

    {
       
        RiakObject obj = new RiakObject().setValue(BinaryValue.create(value));
        Namespace ns = new Namespace(bucketType, bucketName.toString());
        Location location = new Location(ns, key);
        StoreOperation storeOp =
            new StoreOperation.Builder(location)
                .withContent(obj)
                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
       
        FetchOperation fetchOp =
                new FetchOperation.Builder(location).build();
               
        cluster.execute(fetchOp);
View Full Code Here

        op.get();
       
        RiakObject obj = new RiakObject().setValue(BinaryValue.create(value));
        Location location = new Location(ns, key);
      
        StoreOperation storeOp =
            new StoreOperation.Builder(location)
                .withContent(obj)
                .withReturnBody(true)
                .build();
       
        cluster.execute(storeOp);
        StoreOperation.Response response = storeOp.get();
        obj = response.getObjectList().get(0);
       
        assertNotNull(obj.getVClock());
       
        obj.setValue(BinaryValue.create("changed"));

        storeOp = new StoreOperation.Builder(location)
                .withContent(obj)
                .withReturnBody(true)
                .build();
       
        cluster.execute(storeOp);
        response = storeOp.get();
        obj = response.getObjectList().get(0);
       
        assertEquals(obj.getValue().toString(), "changed");
       
        resetAndEmptyBucket(ns);
View Full Code Here

    ArgumentCaptor<StoreOperation> captor =
      ArgumentCaptor.forClass(StoreOperation.class);
    verify(mockCluster).execute(captor.capture());

    StoreOperation operation = captor.getValue();
    RiakKvPB.RpbPutReq.Builder builder =
      (RiakKvPB.RpbPutReq.Builder) Whitebox.getInternalState(operation, "reqBuilder");

    assertTrue(builder.hasVclock());
    assertEquals(true, builder.getAsis());
View Full Code Here

        final BinaryValue key = BinaryValue.unsafeCreate("my_key".getBytes());
        final String value = "{\"value\":\"value\"}";
       
        RiakObject rObj = new RiakObject().setValue(BinaryValue.create(value));
        Location location = new Location(new Namespace(bucketType, bucketName.toString()), key);
        StoreOperation storeOp =
            new StoreOperation.Builder(location)
                .withContent(rObj)
                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
       
        ListBucketsOperation listOp = new ListBucketsOperation.Builder()
                                        .withBucketType(BinaryValue.createFromUtf8(bucketType))
                                        .build();
        cluster.execute(listOp);
View Full Code Here

        for (int i = 0; i < 1000; i++)
        {
            Namespace ns = new Namespace(bucketType, bucketName.toString() + i);
            RiakObject rObj = new RiakObject().setValue(BinaryValue.create(value));
            Location location = new Location(ns, key);
            StoreOperation storeOp =
                new StoreOperation.Builder(location)
                    .withContent(rObj)
                    .build();
            storeOp.addListener(listener);
            semaphore.acquire();
            cluster.execute(storeOp);
        }
       
        latch.await();
View Full Code Here

                    "it, 'and what is the use of a book,' thought Alice 'without pictures or " +
                    "conversation?'\"}"));

        Namespace namespace = new Namespace(searchBucketType, searchBucket);
        Location location = new Location(namespace, BinaryValue.unsafeCreate("p1".getBytes()));
        StoreOperation storeOp =
            new StoreOperation.Builder(location)
                .withContent(obj)
                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
       
        obj.setValue(BinaryValue.create("{ \"content_s\":\"So she was considering in her own mind (as well as she could, for the " +
                    "hot day made her feel very sleepy and stupid), whether the pleasure " +
                    "of making a daisy-chain would be worth the trouble of getting up and " +
                    "picking the daisies, when suddenly a White Rabbit with pink eyes ran " +
                    "close by her.\", \"multi_ss\":[\"this\",\"that\"]}"));
       
       
        location = new Location(namespace, BinaryValue.unsafeCreate("p2".getBytes()));
        storeOp =
            new StoreOperation.Builder(location)
                .withContent(obj)
                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
       
        obj.setValue(BinaryValue.create("{ \"content_s\":\"The rabbit-hole went straight on like a tunnel for some way, and then " +
                    "dipped suddenly down, so suddenly that Alice had not a moment to think " +
                    "about stopping herself before she found herself falling down a very deep " +
                    "well.\"}"));
       
        location = new Location(namespace, BinaryValue.unsafeCreate("p3".getBytes()));
        storeOp =
            new StoreOperation.Builder(location)
                .withContent(obj)
                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
    }
View Full Code Here

        {
            RiakObject obj = new RiakObject().setValue(BinaryValue.create(value));

            obj.getIndexes().getIndex(LongIntIndex.named(indexName)).add(5L);
            Location location = new Location(ns, BinaryValue.unsafeCreate((keyBase + i).getBytes()));
            StoreOperation storeOp =
                new StoreOperation.Builder(location)
                    .withContent(obj)
                    .build();

            cluster.execute(storeOp);
            storeOp.get();
        }
       
        SecondaryIndexQueryOperation.Query query =
            new SecondaryIndexQueryOperation.Query.Builder(ns, BinaryValue.unsafeCreate((indexName + "_int").getBytes()))
                .withIndexKey(BinaryValue.unsafeCreate(String.valueOf(5L).getBytes()))
View Full Code Here

            obj.getIndexes().getIndex(StringBinIndex.named(indexName)).add("foo" + String.format("%02d", i));

           
            Location location = new Location(ns, BinaryValue.unsafeCreate(Long.toString(i).getBytes()));
            StoreOperation storeOp =
                    new StoreOperation.Builder(location)
                            .withContent(obj)
                            .build();

            cluster.execute(storeOp);
            storeOp.get();
        }

       
        SecondaryIndexQueryOperation.Query query =
                new SecondaryIndexQueryOperation.Query.Builder(ns, BinaryValue.unsafeCreate((indexName + "_bin").getBytes()))
View Full Code Here

TOP

Related Classes of com.basho.riak.client.core.operations.StoreOperation$Response$Builder

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.