/** * 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(); }
/** * Set the user configuration * * @param userConfig user-specified properties * @return Delta */ public Delta setUserConfig(UserConfig userConfig) { _builder.userConfig(userConfig); _updateFields.add(Fields.USER_CONFIG); return this; }