Example #1
0
 /**
  * Create a ResourceConfig that is the combination of an existing ResourceConfig and this delta
  *
  * @param orig the original ResourceConfig
  * @return updated ResourceConfig
  */
 public ResourceConfig mergeInto(ResourceConfig orig) {
   ResourceConfig deltaConfig = _builder.build();
   ResourceConfigBuilder builder =
       ResourceConfigBuilder.newInstance()
           .with(orig.getId())
           .rebalancerConfig(orig.getRebalancerConfig())
           .schedulerTaskConfig(orig.getSchedulerTaskConfig())
           .userConfig(orig.getUserConfig())
           .bucketSize(orig.getBucketSize())
           .batchMessageMode(orig.getBatchMessageMode());
   for (Fields field : _updateFields) {
     switch (field) {
       case REBALANCER_CONFIG:
         builder.rebalancerConfig(deltaConfig.getRebalancerConfig());
         break;
       case USER_CONFIG:
         builder.userConfig(deltaConfig.getUserConfig());
         break;
       case BUCKET_SIZE:
         builder.bucketSize(deltaConfig.getBucketSize());
         break;
       case BATCH_MESSAGE_MODE:
         builder.batchMessageMode(deltaConfig.getBatchMessageMode());
         break;
     }
   }
   return builder.build();
 }
Example #2
0
 /**
  * Instantiate the delta for a resource config
  *
  * @param resourceId the resource to update
  */
 public Delta(ResourceId resourceId) {
   _builder = ResourceConfigBuilder.newInstance().with(resourceId);
   _updateFields = Sets.newHashSet();
 }