示例#1
0
  private void restoreState() {
    if (memento == null) return;
    IMemento m = memento.getChild(ID);

    String date = m.getString("date");
    int objHash = CastUtil.cint(m.getInteger("objHash"));
    String objName = m.getString("objName");
    String counter = m.getString("counter");
    String objType = m.getString("objType");
    int serverId = CastUtil.cint(m.getInteger("serverId"));
    try {
      setInput(date, startTime, endTime, objHash, objName, objType, counter, serverId);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 public void init(IViewSite site) throws PartInitException {
   super.init(site);
   String secId = site.getSecondaryId();
   String[] ids = StringUtil.split(secId, "&");
   this.serverId = CastUtil.cint(ids[0]);
   this.objType = ids[1];
   this.counter = ids[2];
   this.mode = CounterUtil.getTotalMode(objType, counter);
 }
 private void restoreState() {
   if (memento == null) return;
   IMemento m = memento.getChild(ID);
   String objType = m.getString("objType");
   String counter = m.getString("counter");
   String sDate = CastUtil.cString(m.getString("sDate"));
   String eDate = CastUtil.cString(m.getString("eDate"));
   int serverId = CastUtil.cint(m.getInteger("serverId"));
   try {
     setInput(sDate, eDate, objType, counter, serverId);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 public void init(IViewSite site) throws PartInitException {
   super.init(site);
   String secId = site.getSecondaryId();
   serverId = CastUtil.cint(secId);
 }
示例#5
0
 // This should be called background thread.
 public static List<String> loadTagString(
     int serverId, String date, List<Value> vList, String tagName) {
   List<String> resultList = new ArrayList<String>();
   if (vList.size() == 0) return resultList;
   Value sample = vList.get(0);
   switch (sample.getValueType()) {
     case ValueEnum.TEXT_HASH:
       ListValue lv = new ListValue();
       for (Value v : vList) {
         lv.add(CastUtil.cint(v.toJavaObject()));
       }
       if (tagName.equals(TagConstants.NAME_OBJECT)) {
         TextProxy.object.load(date, lv, serverId);
         for (int i = 0; i < lv.size(); i++) {
           resultList.add(TextProxy.object.getText(lv.getInt(i)));
         }
       } else if (tagName.equals(TagConstants.NAME_SERVICE)
           || tagName.equals(TagConstants.NAME_SERVICE_ELAPSED)
           || tagName.equals(TagConstants.NAME_SERVICE_BYTES)
           || tagName.equals(TagConstants.NAME_SERVICE_ERRORS)) {
         TextProxy.service.load(date, lv, serverId);
         for (int i = 0; i < lv.size(); i++) {
           resultList.add(TextProxy.service.getText(lv.getInt(i)));
         }
       } else if (tagName.equals(TagConstants.NAME_USER_AGENT)) {
         TextProxy.userAgent.load(date, lv, serverId);
         for (int i = 0; i < lv.size(); i++) {
           resultList.add(TextProxy.userAgent.getText(lv.getInt(i)));
         }
       } else if (tagName.equals(TagConstants.NAME_GROUP)) {
         TextProxy.group.load(date, lv, serverId);
         for (int i = 0; i < lv.size(); i++) {
           resultList.add(TextProxy.group.getText(lv.getInt(i)));
         }
       } else if (tagName.equals(TagConstants.NAME_CITY)) {
         TextProxy.city.load(date, lv, serverId);
         for (int i = 0; i < lv.size(); i++) {
           resultList.add(TextProxy.city.getText(lv.getInt(i)));
         }
       } else if (tagName.equals(TagConstants.NAME_REFERER)) {
         TextProxy.referer.load(date, lv, serverId);
         for (int i = 0; i < lv.size(); i++) {
           resultList.add(TextProxy.referer.getText(lv.getInt(i)));
         }
       } else if (tagName.equals(TagConstants.NAME_ERROR)) {
         TextProxy.error.load(date, lv, serverId);
         for (int i = 0; i < lv.size(); i++) {
           resultList.add(TextProxy.error.getText(lv.getInt(i)));
         }
       }
       break;
     case ValueEnum.DECIMAL:
       if (tagName.equals(TagConstants.NAME_LEVEL)) {
         for (Value v : vList) {
           resultList.add(AlertLevel.getName((byte) ((DecimalValue) v).value));
         }
       } else {
         for (Value v : vList) {
           resultList.add(CastUtil.cString(v.toJavaObject()));
         }
       }
       break;
     case ValueEnum.IP4ADDR:
       for (Value v : vList) {
         resultList.add(v.toString());
       }
       break;
     case ValueEnum.TEXT:
       for (Value v : vList) {
         resultList.add(v.toString());
       }
       break;
     default:
       for (Value v : vList) {
         resultList.add(v.toString());
       }
       break;
   }
   return resultList;
 }