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