Package com.basho.riak.client.bucket

Examples of com.basho.riak.client.bucket.Bucket


        return statistics;
  }

  @Override
  public void deleteTreeMenu(String guiPath, String accountName) {
    Bucket myBucket = null;
        try {
            myBucket = riakClient.fetchBucket("Statistics;" + accountName).execute();
            myBucket.delete(guiPath).execute();
        } catch (RiakRetryFailedException rrfe) {
            rrfe.printStackTrace();
        } catch (RiakException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here


        throws EntityStoreException
    {
        try
        {

            Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
            IRiakObject entity = bucket.fetch( entityReference.identity() ).execute();
            if( entity == null )
            {
                throw new EntityNotFoundException( entityReference );
            }
            String jsonState = entity.getValueAsString();
View Full Code Here

    public void applyChanges( MapChanges changes )
        throws IOException
    {
        try
        {
            final Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();

            changes.visitMap( new MapChanger()
            {

                @Override
                public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
                    throws IOException
                {
                    return new StringWriter( 1000 )
                    {

                        @Override
                        public void close()
                            throws IOException
                        {
                            try
                            {
                                super.close();
                                bucket.store( ref.identity(), toString() ).execute();
                            }
                            catch( RiakException ex )
                            {
                                throw new EntityStoreException( "Unable to apply entity change: newEntity", ex );
                            }
                        }

                    };
                }

                @Override
                public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
                    throws IOException
                {
                    return new StringWriter( 1000 )
                    {

                        @Override
                        public void close()
                            throws IOException
                        {
                            try
                            {
                                super.close();
                                IRiakObject entity = bucket.fetch( ref.identity() ).execute();
                                if( entity == null )
                                {
                                    throw new EntityNotFoundException( ref );
                                }
                                bucket.store( ref.identity(), toString() ).execute();
                            }
                            catch( RiakException ex )
                            {
                                throw new EntityStoreException( "Unable to apply entity change: updateEntity", ex );
                            }
                        }

                    };
                }

                @Override
                public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
                    throws EntityNotFoundException
                {
                    try
                    {
                        IRiakObject entity = bucket.fetch( ref.identity() ).execute();
                        if( entity == null )
                        {
                            throw new EntityNotFoundException( ref );
                        }
                        bucket.delete( ref.identity() ).execute();
                    }
                    catch( RiakException ex )
                    {
                        throw new EntityStoreException( "Unable to apply entity change: removeEntity", ex );
                    }
View Full Code Here

                    public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super Reader, ReceiverThrowableType> receiver )
                        throws ReceiverThrowableType, IOException
                    {
                        try
                        {
                            final Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
                            for( String key : bucket.keys() )
                            {
                                String jsonState = bucket.fetch( key ).execute().getValueAsString();
                                receiver.receive( new StringReader( jsonState ) );
                            }
                        }
                        catch( RiakException ex )
                        {
View Full Code Here

    @Override
    public void tearDown()
        throws Exception
    {
        // Riak don't expose bucket deletion in its API so we empty the Qi4j Entities bucket.
        Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
        for( String key : bucket.keys() )
        {
            bucket.delete( key ).execute();
        }
        super.tearDown();
    }
View Full Code Here

    @Override
    public void tearDown()
        throws Exception
    {
        // Riak don't expose bucket deletion in its API so we empty the Qi4j Entities bucket.
        Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
        for( String key : bucket.keys() )
        {
            bucket.delete( key ).execute();
        }
        super.tearDown();
    }
View Full Code Here

        if (bucket == null || bucket.trim().equals(EMPTY)) {
            throw new IllegalStateException("bucket cannot be null or empty");
        }

        List<BucketKey> keys = new ArrayList<BucketKey>();
        Bucket b = client.fetchBucket(bucket).execute();

        for (String key : b.keys()) {
            keys.add(new BucketKey(bucket, key));

        }
        return keys;
    }
View Full Code Here

TOP

Related Classes of com.basho.riak.client.bucket.Bucket

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.