View Javadoc

1   package org.apache.helix.model;
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.Map;
23  
24  import org.apache.helix.HelixProperty;
25  import org.apache.helix.ZNRecord;
26  
27  
28  public class Alerts extends HelixProperty
29  {
30  
31    // private final ZNRecord _record;
32  
33    public final static String nodeName = "Alerts";
34  
35    public enum AlertsProperty
36    {
37      SESSION_ID, FIELDS
38    }
39  
40    // private final ZNRecord _record;
41  
42    public Alerts(String id)
43    {
44      super(id);
45    }
46  
47    public Alerts(ZNRecord record)
48    {
49      // _record = record;
50      super(record);
51  
52    }
53  
54    /*
55     * public Alerts(ZNRecord record, Stat stat) { super(record, stat); }
56     */
57  
58    public void setSessionId(String sessionId)
59    {
60      _record.setSimpleField(AlertsProperty.SESSION_ID.toString(), sessionId);
61    }
62  
63    public String getSessionId()
64    {
65      return _record.getSimpleField(AlertsProperty.SESSION_ID.toString());
66    }
67  
68    public String getInstanceName()
69    {
70      return _record.getId();
71    }
72  
73    /*
74     * public String getVersion() { return
75     * _record.getSimpleField(AlertsProperty.CLUSTER_MANAGER_VERSION.toString());
76     * }
77     */
78  
79    public Map<String, Map<String, String>> getMapFields()
80    {
81      return _record.getMapFields();
82    }
83  
84    public Map<String, String> getStatFields(String statName)
85    {
86      return _record.getMapField(statName);
87    }
88  
89    @Override
90    public boolean isValid()
91    {
92      // TODO Auto-generated method stub
93      return true;
94    }
95  }