Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.helix.model.builder;
  
  /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
 
 import java.util.Map;
 
IdealState builder for CUSTOMIZED mode
 
 public class CustomModeISBuilder extends IdealStateBuilder {
  
Start building a CUSTOMIZED IdealState

Parameters:
resourceName the resource
 
   public CustomModeISBuilder(String resourceName) {
     super(resourceName);
   }

  
Start building a SEMI_AUTO IdealState

Parameters:
resourceId the resource
 
   public CustomModeISBuilder(ResourceId resourceId) {
     this(resourceId.stringify());
   }

  
Add a sub-resource

Parameters:
partitionName partition to add
Returns:
CustomModeISBuilder
 
   public CustomModeISBuilder add(String partitionName) {
     if (.getMapField(partitionName) == null) {
       .setMapField(partitionNamenew TreeMap<StringString>());
     }
     return this;
   }

  
Add a sub-resource

Parameters:
partitionId partition to add
Returns:
CustomModeISBuilder
 
   public CustomModeISBuilder add(PartitionId partitionId) {
     if (partitionId != null) {
       add(partitionId.stringify());
     }
     return this;
   }

  
add an instance->state assignment

Parameters:
partitionName partition to update
instanceName participant name
state state the replica should be in
Returns:
CustomModeISBuilder
 
   public CustomModeISBuilder assignInstanceAndState(String partitionNameString instanceName,
       String state) {
     add(partitionName);
     Map<StringStringpartitionToInstanceStateMapping = .getMapField(partitionName);
     partitionToInstanceStateMapping.put(instanceNamestate);
     return this;
   }

  
add an instance->state assignment

Parameters:
partitionId partition to update
participantId participant to assign to
state state the replica should be in
Returns:
CustomModeISBuilder
 
       ParticipantId participantIdState state) {
    if (partitionId != null && participantId != null && state != null) {
      assignInstanceAndState(partitionId.stringify(), participantId.stringify(), state.toString());
    }
    return this;
  }
New to GrepCode? Check out our FAQ X