Package com.amazonaws.services.simpledb.model

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


  }
 
  public static ReplaceableItem createItem(Object obj) {
    Class<?> clazz = obj.getClass();
   
    ReplaceableItem item = new ReplaceableItem(getItemName(clazz, obj));
   
    for (Field field : ClassInfo.getClassInfo(clazz).updateFields) {
      try {
        String value = objectFieldToString(obj, field);
        if(value != null){
          ReplaceableAttribute attr = new ReplaceableAttribute(getAttributeName(field), value, true);
          item.withAttributes(attr);
        }else {
          if (ClassInfo.isEmbeddedNative(field)){
            SdbNativeSerializer.embed(item, ClassInfo.getSingleColumnName(field), value);           
          }
        }
View Full Code Here


   
    Constants.getSDB().createDomain(new
        CreateDomainRequest(Constants.DOMAINSDB));
   
    List<ReplaceableItem> erros=new ArrayList<ReplaceableItem>(null);
    erros.add(new ReplaceableItem("LOG:").withAttributes(
        new ReplaceableAttribute("ID", getLastOccurrence()+"", true),
        new ReplaceableAttribute("LEVEL", level.getName(), true),
        new ReplaceableAttribute("MESSAGE", message, true),
        new ReplaceableAttribute("DATE", Calendar.getInstance().
            getTime().toString(), true)
View Full Code Here

    }
   
    @Test
    public void batchPutAttributes() {
        final List<ReplaceableItem> replaceableItems = Arrays.asList(new ReplaceableItem[] {
            new ReplaceableItem("ITEM1")});
       
        template.send("direct:start-sdb", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchPutAttributes);
                exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
View Full Code Here

    }
   
    @Test
    public void batchPutAttributes() {
        final List<ReplaceableItem> replaceableItems = Arrays.asList(new ReplaceableItem[] {
            new ReplaceableItem("ITEM1")});
       
        template.send("direct:start", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchPutAttributes);
                exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
View Full Code Here

    }
   
    @Test
    public void batchPutAttributes() {
        final List<ReplaceableItem> replaceableItems = Arrays.asList(new ReplaceableItem[] {
            new ReplaceableItem("ITEM1")});
       
        template.send("direct:start", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchPutAttributes);
                exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
View Full Code Here

    }
   
    @Test
    public void batchPutAttributes() {
        final List<ReplaceableItem> replaceableItems = Arrays.asList(new ReplaceableItem[] {
            new ReplaceableItem("ITEM1")});
       
        template.send("direct:start", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.BatchPutAttributes);
                exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
View Full Code Here

    }

    @Test
    public void execute() {
        List<ReplaceableItem> replaceableItems = new ArrayList<ReplaceableItem>();
        replaceableItems.add(new ReplaceableItem("ITEM1"));
        exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
       
        command.execute();
       
        assertEquals("DOMAIN1", sdbClient.batchPutAttributesRequest.getDomainName());
View Full Code Here

    @Test
    public void determineReplaceableItems() {
        assertNull(this.command.determineReplaceableItems());
       
        List<ReplaceableItem> replaceableItems = new ArrayList<ReplaceableItem>();
        replaceableItems.add(new ReplaceableItem("ITEM1"));
        exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ITEMS, replaceableItems);
       
        assertEquals(replaceableItems, this.command.determineReplaceableItems());
    }
View Full Code Here

  @Override
  public void storeJob(SchedulingContext ctxt, JobDetail newJob,
      boolean replaceExisting) throws ObjectAlreadyExistsException {

    log.debug("Storing Job: " + newJob.getFullName());
    ReplaceableItem item = null;
    try {
      List<ReplaceableAttribute> attributes = new ArrayList<ReplaceableAttribute>();
      attributes.add(new ReplaceableAttribute(JOB_NAME, newJob.getName(),
          true));
      attributes.add(new ReplaceableAttribute(JOB_GROUP, newJob
          .getGroup(), true));
      attributes.add(new ReplaceableAttribute(JOB_JOBCLASS, newJob
          .getJobClass().getName(), true));
      attributes.add(new ReplaceableAttribute(JOB_CLASS, newJob
          .getClass().getName(), true));
      if (newJob.getJobDataMap() != null) {
        attributes.add(new ReplaceableAttribute(JOB_DATA_MAP, mapper
            .writeValueAsString(newJob.getJobDataMap()), true));
      }
      item = new ReplaceableItem(JobWrapper.getJobNameKey(newJob),
          attributes);
      amazonSimpleDb.batchPutAttributes(new BatchPutAttributesRequest(
          jobDomain, Collections.singletonList(item)));
    } catch (Exception e) {
      log.error("Could not store Job: " + newJob.getFullName(), e);
View Full Code Here

  @Override
  public void storeTrigger(SchedulingContext ctxt, Trigger newTrigger,
      boolean replaceExisting) throws JobPersistenceException {

    log.debug("Storing Trigger: " + newTrigger.getFullName());
    ReplaceableItem item = null;
    try {

      List<ReplaceableAttribute> attributes = new ArrayList<ReplaceableAttribute>();
      attributes.add(new ReplaceableAttribute(TRIGGER_CLASS, newTrigger
          .getClass().getName(), true));
      attributes.add(new ReplaceableAttribute(TRIGGER_NAME, newTrigger
          .getName(), true));
      if (newTrigger.getCalendarName() != null) {
        attributes.add(new ReplaceableAttribute(TRIGGER_CALENDAR_NAME,
            newTrigger.getCalendarName(), true));
      }
      attributes.add(new ReplaceableAttribute(TRIGGER_GROUP, newTrigger
          .getGroup(), true));
      attributes.add(new ReplaceableAttribute(TRIGGER_JOB_GROUP,
          newTrigger.getJobGroup(), true));
      attributes.add(new ReplaceableAttribute(TRIGGER_JOB_NAME,
          newTrigger.getJobName(), true));
      attributes.add(new ReplaceableAttribute(TRIGGER_PRIORITY, String
          .valueOf(newTrigger.getPriority()), true));
      if (newTrigger.getEndTime() != null) {
        attributes.add(new ReplaceableAttribute(TRIGGER_END_TIME,
            dateFormat.format(newTrigger.getEndTime()), true));
      }
      if (newTrigger.getStartTime() != null) {
        attributes.add(new ReplaceableAttribute(TRIGGER_START_TIME,
            dateFormat.format(newTrigger.getStartTime()), true));
      }
      if (newTrigger.getNextFireTime() != null) {
        attributes.add(new ReplaceableAttribute(TRIGGER_NEXT_FIRE_TIME,
            dateFormat.format(newTrigger.getNextFireTime()), true));
      }
      item = new ReplaceableItem(
          TriggerWrapper.getTriggerNameKey(newTrigger), attributes);
      String json = mapper.writeValueAsString(newTrigger);
      attributes.add(new ReplaceableAttribute(TRIGGER_JSON_LENGTH, String
          .valueOf(json.length()), true));
View Full Code Here

TOP

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

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.