View Javadoc

1   package org.apache.helix;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.HashMap;
23  import java.util.Map;
24  
25  public class NotificationContext
26  {
27  	// keys used for object map
28  	public enum MapKey {
29  		TASK_EXECUTOR,
30  		CURRENT_STATE_UPDATE,
31  		HELIX_TASK_RESULT
32  	}
33    
34    private Map<String, Object> _map;
35  
36    private HelixManager _manager;
37    private Type _type;
38    private String _pathChanged;
39    private String _eventName;
40  
41    public String getEventName()
42    {
43      return _eventName;
44    }
45  
46    public void setEventName(String eventName)
47    {
48      _eventName = eventName;
49    }
50  
51    public NotificationContext(HelixManager manager)
52    {
53      _manager = manager;
54      _map = new HashMap<String, Object>();
55    }
56  
57    public HelixManager getManager()
58    {
59      return _manager;
60    }
61  
62    public Map<String, Object> getMap()
63    {
64      return _map;
65    }
66  
67    public Type getType()
68    {
69      return _type;
70    }
71  
72    public void setManager(HelixManager manager)
73    {
74      this._manager = manager;
75    }
76  
77    public void add(String key, Object value)
78    {
79      _map.put(key, value);
80    }
81  
82    public void setMap(Map<String, Object> map)
83    {
84      this._map = map;
85    }
86  
87    public void setType(Type type)
88    {
89      this._type = type;
90    }
91  
92    public Object get(String key)
93    {
94      return _map.get(key);
95    }
96  
97    public enum Type
98    {
99      INIT, CALLBACK, FINALIZE
100   }
101 
102   public String getPathChanged()
103   {
104     return _pathChanged;
105   }
106 
107   public void setPathChanged(String pathChanged)
108   {
109     this._pathChanged = pathChanged;
110   }
111 }