Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.helix;
  
  /*
   * 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;

Metadata associated with a notification event and the current state of the cluster
 
 public class NotificationContext {
  
keys used for object map
 
   public enum MapKey {
     TASK_EXECUTOR,
     CURRENT_STATE_UPDATE,
     HELIX_TASK_RESULT
   }
 
   private Map<StringObject_map;
 
   private HelixManager _manager;
   private Type _type;
   private String _pathChanged;
   private String _eventName;

  
Get the name associated with the event

Returns:
event name
 
   public String getEventName() {
     return ;
   }

  
Set the name associated with the event

Parameters:
eventName the event name
 
   public void setEventName(String eventName) {
      = eventName;
   }

  
Instantiate with a HelixManager

Parameters:
manager HelixManager object
 
   public NotificationContext(HelixManager manager) {
      = manager;
      = new HashMap<StringObject>();
   }

  
Get the HelixManager associated with this notification

Returns:
HelixManager object
 
   public HelixManager getManager() {
     return ;
   }

  
Get a map describing the update (keyed on NotificationContext.MapKey)

Returns:
the object map describing the update
 
   public Map<StringObjectgetMap() {
     return ;
   }

  
Get the type of the notification

Returns:
the notification type
 
   public Type getType() {
     return ;
   }

  
Set the HelixManager associated with this notification

Parameters:
manager HelixManager object
 
   public void setManager(HelixManager manager) {
     this. = manager;
  }

  
Add notification metadata

Parameters:
key String value of a NotificationContext.MapKey
value
  public void add(String keyObject value) {
    .put(keyvalue);
  }

  
Set the notification map

Parameters:
map
  public void setMap(Map<StringObjectmap) {
    this. = map;
  }

  
Set the notification type

Parameters:
<code>NotificationContext.Type object
  public void setType(Type type) {
    this. = type;
  }

  
Get a notification attribute

Parameters:
key String from a NotificationContext.MapKey
Returns:
  public Object get(String key) {
    return .get(key);
  }

  
Valid types of notifications
  public enum Type {
    INIT,
    CALLBACK,
    FINALIZE
  }

  
Get the path changed status

Returns:
String corresponding to the path change
  public String getPathChanged() {
    return ;
  }

  
Set the path changed status

Parameters:
pathChanged
  public void setPathChanged(String pathChanged) {
    this. = pathChanged;
  }
New to GrepCode? Check out our FAQ X