Package com.amazonaws.services.simpledb.model

Examples of com.amazonaws.services.simpledb.model.GetAttributesResult


   */
  @Override
  public void releaseAcquiredTrigger(SchedulingContext ctxt, Trigger trigger) {
    log.debug("Releasing Trigger: " + trigger.getFullName());
    String key = TriggerWrapper.getTriggerNameKey(trigger);
    GetAttributesResult result = amazonSimpleDb
        .getAttributes(new GetAttributesRequest(triggerDomain, key)
            .withConsistentRead(new Boolean(true)));
    TriggerWrapper tw = null;
    try {
      tw = triggerFromAttributes(result.getAttributes());
      if (tw.state == TriggerWrapper.STATE_ACQUIRED) {
        tw.state = TriggerWrapper.STATE_WAITING;
        updateState(tw);
      }
    } catch (Exception e) {
View Full Code Here


  public TriggerFiredBundle triggerFired(SchedulingContext ctxt,
      Trigger trigger) {

    log.debug("Fired Trigger: " + trigger.getFullName());
    String key = TriggerWrapper.getTriggerNameKey(trigger);
    GetAttributesResult result = amazonSimpleDb
        .getAttributes(new GetAttributesRequest(triggerDomain, key)
            .withConsistentRead(new Boolean(true)));
    TriggerWrapper tw = null;
    try {
      tw = triggerFromAttributes(result.getAttributes());
    } catch (Exception e) {
      log.error("Could not load Trigger: " + trigger.getFullName());
    }

    // was the trigger deleted since being acquired?
View Full Code Here

      JobDetail jobDetail, int triggerInstCode) {
    log.debug("Completing Job: " + trigger.getFullName());

    String jobKey = JobWrapper.getJobNameKey(jobDetail.getName(),
        jobDetail.getGroup());
    GetAttributesResult jobresult = amazonSimpleDb
        .getAttributes(new GetAttributesRequest(jobDomain, jobKey)
            .withConsistentRead(new Boolean(true)));
    JobDetail job = null;
    try {
      job = jobDetailFromAttributes(jobresult.getAttributes());
      if (job.isStateful()) {
        // TODO: Implement support for stateful jobs
      }
    } catch (Exception e) {
      log.error(
          "Could not complete job for Trigger: "
              + trigger.getFullName(), e);
    }

    String triggerKey = TriggerWrapper.getTriggerNameKey(trigger);
    GetAttributesResult result = amazonSimpleDb
        .getAttributes(new GetAttributesRequest(triggerDomain,
            triggerKey).withConsistentRead(new Boolean(true)));
    TriggerWrapper tw = null;

    try {
      tw = triggerFromAttributes(result.getAttributes());
    } catch (Exception e) {
      log.error("Could not find Trigger: " + trigger.getFullName(), e);
    }

    // It's possible that the job is null if:
View Full Code Here

    }

    private void putAndDelete(String domainName, String oldAttributeName, String newAttributeName, List<Item> items) throws AmazonClientException {
        AmazonSimpleDB db = factory.getSimpleDb();
        for (Item item : items) {
            GetAttributesResult getOldResults = db.getAttributes(new GetAttributesRequest().withDomainName(domainName).withConsistentRead(true).withItemName(
                    item.getName()).withAttributeNames(oldAttributeName));

            List<Attribute> oldAtts = getOldResults.getAttributes();
            if (oldAtts.size() > 0) {
                Attribute oldAtt = oldAtts.get(0);
                List<ReplaceableAttribute> atts = new ArrayList<ReplaceableAttribute>();
                atts.add(new ReplaceableAttribute(newAttributeName, oldAtt.getValue(), true));
View Full Code Here

            throw new IllegalArgumentException("Id cannot be null.");

        String              modelName = jsoda.getModelName(modelClass);
        String              table = jsoda.getModelTable(modelName);
        String              idValue = makeIdValue(modelName, id, rangeKey);
        GetAttributesResult result = sdbClient.getAttributes(new GetAttributesRequest(table, idValue));
        if (result.getAttributes().size() == 0)
            return null;        // not existed.
        return buildLoadObj(modelClass, modelName, idValue, result.getAttributes(), null);
       
    }
View Full Code Here

    }

    private void putAndDelete(String domainName, String oldAttributeName, String newAttributeName, List<Item> items) throws AmazonClientException {
        AmazonSimpleDB db = factory.getSimpleDb();
        for (Item item : items) {
            GetAttributesResult getOldResults = db.getAttributes(new GetAttributesRequest().withDomainName(domainName).withConsistentRead(true).withItemName(
                    item.getName()).withAttributeNames(oldAttributeName));

            List<Attribute> oldAtts = getOldResults.getAttributes();
            if (oldAtts.size() > 0) {
                Attribute oldAtt = oldAtts.get(0);
                List<ReplaceableAttribute> atts = new ArrayList<ReplaceableAttribute>();
                atts.add(new ReplaceableAttribute(newAttributeName, oldAtt.getValue(), true));
View Full Code Here

     * @return
     * @throws AmazonClientException
     */
    public static Item findItemById(AmazonSimpleDB db, String domainName, String itemName, boolean consistentRead) throws AmazonClientException {

        GetAttributesResult results = db.getAttributes(new GetAttributesRequest()
            .withConsistentRead(consistentRead)
            .withDomainName(domainName)
            .withItemName(itemName));
       
        if(results.getAttributes().size() == 0) {
            return null;
        }
       
        Item item = new Item(itemName, results.getAttributes());
        return item;       
   
View Full Code Here

    }

    private void putAndDelete(String domainName, String oldAttributeName, String newAttributeName, List<Item> items) throws AmazonClientException {
        AmazonSimpleDB db = factory.getSimpleDb();
        for (Item item : items) {
            GetAttributesResult getOldResults = db.getAttributes(new GetAttributesRequest().withDomainName(domainName).withConsistentRead(true).withItemName(
                    item.getName()).withAttributeNames(oldAttributeName));

            List<Attribute> oldAtts = getOldResults.getAttributes();
            if (oldAtts.size() > 0) {
                Attribute oldAtt = oldAtts.get(0);
                List<ReplaceableAttribute> atts = new ArrayList<ReplaceableAttribute>();
                atts.add(new ReplaceableAttribute(newAttributeName, oldAtt.getValue(), true));
View Full Code Here

  @Override
  public JobDetail retrieveJob(SchedulingContext ctxt, String jobName,
      String groupName) {
    logDebug("Retrieving Job: ", groupName, ".", jobName);
    String key = JobWrapper.getJobNameKey(jobName, groupName);
    GetAttributesResult result = amazonSimpleDb
        .getAttributes(new GetAttributesRequest(jobDomain, key)
            .withConsistentRead(new Boolean(true)));
    JobDetail job = null;
    try {
      job = jobDetailFromAttributes(result.getAttributes());
    } catch (Exception e) {
      log.error("Could not retrieve Job: " + groupName + "." + jobName, e);
    }
    return job;
  }
View Full Code Here

  @Override
  public Trigger retrieveTrigger(SchedulingContext ctxt, String triggerName,
      String groupName) {
    logDebug("Retrieving Trigger: ", triggerName, ".", groupName);
    String key = TriggerWrapper.getTriggerNameKey(triggerName, groupName);
    GetAttributesResult result = amazonSimpleDb
        .getAttributes(new GetAttributesRequest(triggerDomain, key)
            .withConsistentRead(new Boolean(true)));
    TriggerWrapper tw = null;
    try {
      tw = triggerFromAttributes(result.getAttributes());
      return tw.trigger;
    } catch (Exception e) {
      logDebug("Trigger not found: ", triggerName, ".", groupName);
    }
    return null;
View Full Code Here

TOP

Related Classes of com.amazonaws.services.simpledb.model.GetAttributesResult

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.