Package com.basho.riak.client.bucket

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


            rrfe.printStackTrace();
        }
  }
 
  public static <E> void deleteObjectInBucket(IRiakClient riakClient, String bucketName, String key)  {
    Bucket bucket = null;
    try {
      bucket = riakClient.fetchBucket(bucketName).execute();
      bucket.delete(key).execute();
    } catch (RiakException re) {
      re.printStackTrace();
    }
  }
View Full Code Here


        this.riakClient = riakClient;
    }

    @Override
    public void persistAlert(Alert alert) {
        Bucket myBucket = null;
        try {
            myBucket = riakClient.fetchBucket("Alert;" + alert.getAccountName()).execute();
            myBucket.store(alert.getAlertName(), alert).execute();
        } catch (RiakRetryFailedException rrfe) {
            rrfe.printStackTrace();
        }
    }
View Full Code Here

    @Override
    public Alert getAlert(String alertName, String accountName) {
        BasicAlert alert = null;

        Bucket myBucket = null;
        try {
            myBucket = riakClient.fetchBucket("Alert;" + accountName).execute();
            alert = myBucket.fetch(alertName, BasicAlert.class).execute();
        } catch (RiakRetryFailedException rrfe) {
            rrfe.printStackTrace();
        }

        return alert;
View Full Code Here

    @Override
    public List<Alert> getAlerts(String accountName) {
        List<Alert> alertList = new ArrayList<Alert>();

        Bucket myBucket = null;
        try {
            myBucket = riakClient.fetchBucket("Alert;" + accountName).execute();

            for (String key : myBucket.fetchIndex(BucketIndex.index).withValue("$key").execute()) {
                alertList.add(myBucket.fetch(key, BasicAlert.class).execute());
            }
        } catch (RiakRetryFailedException rrfe) {
            rrfe.printStackTrace();
        } catch (RiakException e) {
            e.printStackTrace();
View Full Code Here

        return alertList;
    }

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

    }
    }

    @Override
    public void persistTriggeredAlert(TriggeredAlert triggeredAlert) {
        Bucket myBucket = null;
        try {
            myBucket = riakClient.fetchBucket("Triggered_Alert;" + triggeredAlert.getAccountName()).execute();
            myBucket.store(triggeredAlert.getAlertName() + ";" + triggeredAlert.getTimeperiod(), triggeredAlert).execute();
        } catch (RiakRetryFailedException rrfe) {
            rrfe.printStackTrace();
        }
    }
View Full Code Here

 
  @Override
  public List<Account> getAccounts() {
    List<Account> accountList = new ArrayList<Account>();

        Bucket myBucket = null;
        try {
            myBucket = riakClient.fetchBucket("Account").execute();

            for (String key : myBucket.fetchIndex(BucketIndex.index).withValue("$key").execute()) {
              accountList.add(myBucket.fetch(key, BasicAccount.class).execute());
            }
        } catch (RiakRetryFailedException rrfe) {
            rrfe.printStackTrace();
        } catch (RiakException e) {
            e.printStackTrace();
View Full Code Here

  @Override
  public Account getAccount(String id) {
    Account account = null;
   
    Bucket myBucket = null;
        try {
            myBucket = riakClient.fetchBucket("Account").execute();
          account = myBucket.fetch(this.encodeUri(id), BasicAccount.class).execute();
        } catch (RiakRetryFailedException rrfe) {
            rrfe.printStackTrace();
        } catch (RiakException e) {
            e.printStackTrace();
        }
View Full Code Here

    return account;
  }

  @Override
  public void persistAccount(Account account) {
    Bucket myBucket = null;
        try {
            myBucket = riakClient.fetchBucket("Account").execute();
            myBucket.store(this.encodeUri(account.getId()), account).execute();
        } catch (RiakRetryFailedException rrfe) {
            rrfe.printStackTrace();
        }
  }
View Full Code Here

  @Override
  public User getUser(String username, String accountName) {
    BasicUser user = null;
   
    Bucket myBucket = null;
        try {
            myBucket = riakClient.fetchBucket("User;" + this.encodeUri(username)).execute();
            user = myBucket.fetch(this.encodeUri(accountName), BasicUser.class).execute();
        } catch (RiakRetryFailedException rrfe) {
            rrfe.printStackTrace();
        } catch (RiakException e) {
            e.printStackTrace();
        }
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.