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.
  */
 
 
IdealState builder for SEMI_AUTO mode
 
 public class AutoModeISBuilder extends IdealStateBuilder {
  
Start building a SEMI_AUTO IdealState

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

  
Start building a SEMI_AUTO IdealState

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

  
Add a partition; Helix will assign replicas of the partition according to preference lists

Parameters:
partitionName the name of the new partition
Returns:
AutoModeISBuilder
 
   public AutoModeISBuilder add(String partitionName) {
     if (.getListField(partitionName) == null) {
       .setListField(partitionNamenew ArrayList<String>());
     }
     return this;
   }

  
Add a partition; Helix will assign replicas of the partition according to preference lists

Parameters:
partitionId the id of the new partition
Returns:
AutoModeISBuilder
 
   public AutoModeISBuilder add(PartitionId partitionId) {
     if (partitionId != null) {
       add(partitionId.stringify());
     }
     return this;
   }

  
Define where replicas of a partition should live

Parameters:
partitionName the partition
instanceNames ordered list of participant names
Returns:
AutoModeISBuilder
 
   public AutoModeISBuilder assignPreferenceList(String partitionNameString... instanceNames) {
     add(partitionName);
     .getListField(partitionName).addAll(Arrays.asList(instanceNames));
     return this;
   }

  
Define where replicas of a partition should live

Parameters:
partitionId the partition
participantIds ordered list of participant ids
Returns:
AutoModeISBuilder
 
       ParticipantId... participantIds) {
     if (partitionId != null) {
       String[] participantNames = new String[participantIds.length];
       for (int i = 0; i < participantIds.lengthi++) {
         participantNames[i] = participantIds[i].stringify();
       }
      assignPreferenceList(partitionId.stringify(), participantNames);
    }
    return this;
  }
New to GrepCode? Check out our FAQ X