Beispiel #1
0
 public static void readExtraItems(String s, ArrayList array) throws IOException {
   File file = new File(Platform.getRoot() + File.separator + "templates.view");
   if (!file.exists()) {
     return;
   }
   String as[] = file.list();
   if (as == null) {
     return;
   }
   for (int i = 0; i < as.length; i++) {
     File file1 = new File(file, as[i]);
     if (!file1.isDirectory()) {
       continue;
     }
     File file2 = new File(file1, s);
     if (!file2.exists()) {
       continue;
     }
     ArrayList array1 = FrameFile.readFromFile(file2.getAbsolutePath());
     for (int j = 0; j < array1.size(); j++) {
       HashMap hashmap = (HashMap) array1.get(j);
       String s1 = TextUtils.getValue(hashmap, "_id");
       s1 = file1.getName() + "-" + s1;
       hashmap.put("_id", s1);
       hashmap.put("_package", as[i]);
       array.add(hashmap);
     }
   }
 }
 public String saveAdditionalSchedulePrefs() {
   HashMap hashmap = new HashMap();
   StringBuffer stringbuffer = new StringBuffer();
   String s =
       COM.dragonflow.Properties.ScheduleProperty.requestToScheduleString(request, stringbuffer);
   if (s.length() > 0) {
     hashmap.put("_schedule", s);
   }
   String s1 = request.getValue("name");
   if (s1.length() == 0) {
     boolean flag = false;
     if (s.startsWith("*")) {
       flag = true;
       s1 = s.substring(1);
     } else {
       s1 = s;
     }
     String s2 =
         COM.dragonflow
             .Properties
             .ScheduleProperty
             .dayStrings[COM.dragonflow.Utils.TextUtils.dayLetterToNumber(s1.substring(0, 1))];
     s1 = s1.substring(1);
     if (flag) {
       s2 = s2 + " at ";
     } else {
       if (s1.startsWith("D")) {
         s2 = "Disable on " + s2;
       } else {
         s2 = "Enable on " + s2;
       }
       s2 = s2 + " from ";
       s1 = s1.substring(1);
     }
     int i = s1.indexOf(",");
     String s4;
     if (i != -1) {
       s4 = s1.substring(0, i);
     } else {
       s4 = s1;
     }
     if (flag) {
       s2 = s2 + s4.replace('/', ',');
     } else {
       s2 = s2 + s4;
     }
     if (i != -1) {
       s2 = s2 + "...";
     }
     s1 = s2;
   }
   hashmap.put("_name", s1);
   String s3 = saveAdditionalPrefs("Schedule", request.getValue("schedule_data"), hashmap);
   COM.dragonflow.SiteView.ScheduleManager schedulemanager =
       COM.dragonflow.SiteView.ScheduleManager.getInstance();
   schedulemanager.updateSchedule(s3, (String) hashmap.get("_schedule"));
   return s3;
 }
 public void addAlertTag(HashMap hashmap, String s, String s1) {
   hashmap.put(s, s1);
   if (!Action.isBaseEntry(s)) {
     String s2 = TextUtils.getValue(hashmap, "extraCount");
     if (s2.length() == 0) s2 = "0";
     s2 = TextUtils.increment(s2);
     hashmap.put("extra" + s2, s);
     hashmap.put("extraCount", s2);
   }
 }
 public String verify(
     StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) {
   if (stringproperty == getPropertyObject(PROPERTY_NAME_BROWSABLE)) {
     String s1 = getProperty(PROPERTY_NAME_COUNTER_ID + 1);
     if (s1.length() <= 0) {
       String s2 = httprequest.getValue("browseDataError");
       if (s2 != null && s2.length() > 0) {
         hashmap.put(stringproperty, s2);
       } else {
         hashmap.put(stringproperty, "No counters selected");
       }
     }
     return s;
   } else {
     return super.verify(stringproperty, s, httprequest, hashmap);
   }
 }
Beispiel #5
0
 public String verify(
     StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) {
   if (stringproperty == pParameters) {
     if (TextUtils.hasChars(s, "`;&")) {
       hashmap.put(stringproperty, "script parameters have illegal characters");
     }
   } else if (stringproperty == pExpression) {
     String s1 = TextUtils.legalMatchString(s);
     if (s1.length() > 0) {
       hashmap.put(stringproperty, s1);
     }
   } else if (stringproperty == pLocalScriptLocation) {
     String s2 = getProperty(pLocalScriptLocation);
     if (s2.length() == 0) {
       hashmap.put(stringproperty, "Specified local Scripts location must be non zero-length");
     }
   }
   return super.verify(stringproperty, s, httprequest, hashmap);
 }
 public static void main(String args[]) {
   File file = new File(Platform.getRoot() + "/logs/alert.log");
   AlertLogReader alertlogreader = new AlertLogReader(file);
   HashMap hashmap = new HashMap();
   hashmap.put("alert-type", "Email");
   ArrayList array = alertlogreader.process(hashmap, null, null, null);
   System.out.println("***************************************************");
   for (int i = 0; i < array.size(); i++) {
     HashMap hashmap1 = (HashMap) array.get(i);
     System.out.println(
         TextUtils.dateToString((Date) hashmap1.get("date"))
             + "   "
             + hashmap1.get("alert-message"));
   }
 }
  void printMessageForm(String s, String s1) throws java.io.IOException {
    java.lang.Object obj = null;
    if (request.isPost()) {
      StringBuffer stringbuffer = new StringBuffer();
      obj = new HashMapOrdered(true);
      ((HashMap) (obj)).put("title", request.getValue("title"));
      if (COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "title").length() == 0) {
        COM.dragonflow.Utils.TextUtils.addToBuffer(stringbuffer, "title missing");
      }
      ((HashMap) (obj)).put("product", request.getValue("product"));
      String s3 = "";
      for (Enumeration enumeration = request.getValues("topic"); enumeration.hasMoreElements(); ) {
        String s5 = (String) enumeration.nextElement();
        if (s3.length() > 0) {
          s3 = s3 + ",";
        }
        s3 = s3 + s5;
      }

      ((HashMap) (obj)).put("topics", s3);
      if (COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "topics").length() == 0) {
        COM.dragonflow.Utils.TextUtils.addToBuffer(stringbuffer, "at least one topic required");
      }
      ((HashMap) (obj)).put("body", request.getValue("body"));
      if (COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "body").trim().length() == 0) {
        COM.dragonflow.Utils.TextUtils.addToBuffer(stringbuffer, "body of note missing");
      }
      ((HashMap) (obj)).put("weight", request.getValue("weight"));
      ((HashMap) (obj)).put("releases", request.getValue("releases"));
      ((HashMap) (obj)).put("author", request.getValue("author"));
      ((HashMap) (obj)).put("id", request.getValue("id"));
      ((HashMap) (obj))
          .put(
              "updated",
              COM.dragonflow.Utils.TextUtils.prettyDateDate(
                  COM.dragonflow.Utils.TextUtils.prettyDate(
                      COM.dragonflow.SiteView.Platform.timeMillis())));
      String s6 = request.getValue("idnum");
      if (s6.length() == 0) {
        HashMap hashmap1 = getMasterConfig();
        String s9 = COM.dragonflow.Utils.TextUtils.getValue(hashmap1, "_developerNoteNextID");
        int i = COM.dragonflow.Utils.TextUtils.toInt(s9);
        if (i < 10000) {
          i = 10000;
        }
        for (java.io.File file2 = new File(s1 + "noteDN" + i + ".htm");
            file2.exists();
            file2 = new File(s1 + "noteDN" + i + ".htm")) {
          i++;
        }

        s6 = "DN" + i;
        i++;
        hashmap1.put("_developerNoteNextID", "" + i);
        saveMasterConfig(hashmap1);
      }
      ((HashMap) (obj)).put("idnum", s6);
      ((HashMap) (obj)).put("filename", "note" + s6 + ".htm");
      String s8 = s1 + "noteInternalTemplate.txt";
      String s10 = COM.dragonflow.Utils.FileUtils.readFile(s8).toString();
      if (s10.length() == 0) {
        COM.dragonflow.Utils.TextUtils.addToBuffer(stringbuffer, "could not find template " + s8);
      }
      if (stringbuffer.length() > 0) {
        outputStream.println("<HR><H2>" + stringbuffer.toString() + "</H2><HR><P>");
      } else {
        SiteViewMain.SupportNoteUtils.writeNoteFile(s1, ((HashMap) (obj)), s10);
        java.io.File file1 = new File(NOTE_CACHE_FILENAME);
        if (file1.exists()) {
          file1.delete();
        }
        printRefreshPage("/SiteView/cgi/go.exe/SiteView?page=developerNote", 0);
        return;
      }
    }
    String s2 = s + " Developer Note";
    printBodyHeader(s2);
    if (obj == null) {
      String s4 = request.getValue("idnum");
      if (s4.length() > 0) {
        java.io.File file = new File(s1 + "note" + s4 + ".htm");
        if (file.exists()) {
          obj = SiteViewMain.SupportNoteUtils.readNote(file);
        } else {
          outputStream.println("<HR><H3>Could not read note file " + file + "</H3><HR><P>");
        }
      }
    }
    if (obj == null) {
      obj = new HashMapOrdered(true);
    }
    HashMap hashmap = new HashMap();
    for (Enumeration enumeration1 = ((HashMap) (obj)).values("topic");
        enumeration1.hasMoreElements();
        hashmap.put(enumeration1.nextElement(), "true")) {}
    String s7 = "";
    ArrayList array = COM.dragonflow.Properties.FrameFile.readFromFile(s1 + "topics.txt");
    for (Enumeration enumeration2 = (Enumeration) array.iterator();
        enumeration2.hasMoreElements(); ) {
      HashMap hashmap2 = (HashMap) enumeration2.nextElement();
      String s11 = COM.dragonflow.Utils.TextUtils.getValue(hashmap2, "id");
      String s13 = COM.dragonflow.Utils.TextUtils.getValue(hashmap2, "title");
      String s15 = "";
      if (hashmap.get(s11) != null) {
        s15 = " selected";
      }
      s7 = s7 + "<option " + s15 + " value=\"" + s11 + "\">" + s13 + "\n";
    }

    ArrayList array1 = new ArrayList();
    array1.add("common");
    array1.add("common");
    array1.add("frequent");
    array1.add("frequent");
    array1.add("normal");
    array1.add("normal");
    array1.add("infrequent");
    array1.add("infrequent");
    array1.add("rare");
    array1.add("rare");
    String s12 = COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "weight");
    if (s12.length() == 0) {
      s12 = "normal";
    }
    String s14 = COM.dragonflow.Page.developerNotePage.getOptionsHTML(array1, s12);
    ArrayList array2 = new ArrayList();
    array2.add("SiteView,SiteSeer");
    array2.add("SiteView and SiteSeer");
    array2.add("SiteSeer");
    array2.add("SiteSeer only");
    array2.add("SiteView");
    array2.add("SiteView all platforms");
    array2.add("SiteView NT");
    array2.add("SiteView NT");
    array2.add("SiteView Unix");
    array2.add("SiteView Unix");
    array2.add("CentraScope");
    array2.add("CentraScope");
    String s16 = COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "product");
    if (s16.length() == 0) {
      s16 = "SiteView,SiteSeer";
    }
    String s17 = COM.dragonflow.Page.developerNotePage.getOptionsHTML(array2, s16);
    outputStream.println("<p><H2>" + s2 + "</H2>");
    outputStream.println(
        "Use this form to add a note to the developer note database.  Every night, the developernote index is updated on the internal web site.<p>");
    outputStream.println(
        "<FORM ACTION=/SiteView/cgi/go.exe/SiteView method=POST><input type=hidden name=page value=developerNote><input type=hidden name=account value="
            + request.getAccount()
            + ">"
            + "<BLOCKQUOTE><DL>"
            + "<DT><B>Title:</B> <input type=text name=title size=80 value=\""
            + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "title")
            + "\"><BR>"
            + "<DD><P>"
            + "<DT><B>Note applies to:</B> <select name=product>"
            + s17
            + "</select>"
            + "<DD><P>"
            + "<DT><B>Topics</B>"
            + "<DD><TABLE>"
            + "<tr><td><select name=topic size=10 multiple>"
            + s7
            + "</select>"
            + "</TABLE>"
            + "<DT>This is a <select name=weight>"
            + s14
            + "</select> question\n"
            + "<DD><P>"
            + "<DT><B>Author:</B> <input type=text name=author size=50 value=\""
            + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "author")
            + "\"><BR>"
            + "<DD>Your name so that people who have more questions can contact you<P>"
            + "<DT><B>Releases:</B> <input type=text name=releases size=50 value=\""
            + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "releases")
            + "\"><BR>"
            + "<DD>enter one or more releases that this note applies to<P>"
            + "</DL></BLOCKQUOTE>"
            + "<B>Notes:</B>"
            + "<textarea cols=80 rows=12 name=body>"
            + COM.dragonflow.Utils.TextUtils.escapeHTML(
                COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "body"))
            + "</textarea><BR>"
            + "<input type=hidden name=idnum value=\""
            + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "idnum")
            + "\">\n"
            + "<input type=hidden name=id value=\""
            + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "id")
            + "\">\n"
            + "<input type=hidden name=operation value=\""
            + s
            + "\">\n"
            + "<P><input type=submit name=send value=\"Save Developer Note\"><P>"
            + "</FORM>");
    printFooter(outputStream);
  }
 public void setMaxCounters(int i) {
   nMaxCounters = i;
   HashMap hashmap = MasterConfig.getMasterConfig();
   hashmap.put("_DispatcherMaxCounters", (new Integer(i)).toString());
   MasterConfig.saveMasterConfig(hashmap);
 }
  public ArrayList process(HashMap hashmap, Date date, Date date1, HashMap hashmap1) {
    SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView();
    long l = siteviewgroup.getSettingAsLong("_alertLogReadChunkSize", 0x19000);
    ArrayList array = new ArrayList();
    if (logfile == null || !logfile.exists()) {
      LogManager.log("Error", "Alert log " + logfile.getAbsolutePath() + " does not exist");
      return array;
    }
    if (!logfile.canRead()) {
      LogManager.log("Error", "Alert log " + logfile.getAbsolutePath() + " cannot be read");
      return array;
    }
    boolean flag = false;
    String s = logfile.getAbsolutePath();
    long l1 = Platform.FILE_NEWLINE.length();
    long l2 = logfile.length();
    boolean flag1 = false;
    if (hashmap1 != null) flag1 = !hashmap1.isEmpty();
    long l3 = 0L;
    long l4 = 0x7fffffffffffffffL;
    if (date != null) l3 = date.getTime();
    if (date1 != null) l4 = date1.getTime();
    long l5 = 0x7fffffffffffffffL;
    long l6 = 0L;
    Braf braf = null;
    try {
      do {
        if (flag) break;
        long l7 = l2 - l;
        long l8 = l2;
        l2 = -1L;
        if (l7 < 0L) l7 = 0L;
        long l9 = l7;
        braf = new Braf(s, l7);
        HashMap hashmap2 = null;
        ArrayList array1 = new ArrayList();
        String s2 = "";
        StringBuffer stringbuffer = new StringBuffer();
        label0:
        do {
          String s1;
          do if ((s1 = braf.readLine()) == null) break label0;
          while (s1.indexOf("<pre>") >= 0);
          if (isDateLine(s1) && getDateInfo(s1, lineDate)) {
            if (l2 < 0L) l2 = l9 - 1L;
            if (hashmap2 != null) {
              if (s2.length() > 0) {
                addAlertTag(hashmap2, s2, stringbuffer.toString());
                s2 = "";
                stringbuffer.setLength(0);
              }
              addAlertEntry(hashmap2, array1, hashmap);
            }
            Date date2 = getDate(lineDate);
            long l10 = date2.getTime();
            hashmap2 = null;
            if (l10 >= l3 && l10 <= l4)
              if (flag1) {
                if (ScheduleProperty.isEnabled(hashmap1, date2)) {
                  hashmap2 = new HashMap();
                  hashmap2.put("date", date2);
                }
              } else {
                hashmap2 = new HashMap();
                hashmap2.put("date", date2);
              }
            if (l10 < l5) l5 = l10;
            if (l10 > l6) l6 = l10;
          } else if (hashmap2 != null)
            if (s1.startsWith(ALERT_LINE_PREFIX)) {
              if (s2.length() > 0) {
                addAlertTag(hashmap2, s2, stringbuffer.toString());
                s2 = "";
                stringbuffer.setLength(0);
              }
              int i = s1.indexOf(COLON_SUFFIX);
              if (i >= 0) {
                s2 = s1.substring(1, i);
                stringbuffer.setLength(0);
                stringbuffer.append(s1.substring(i + COLON_SUFFIX.length()));
              }
            } else if (s2.length() > 0) {
              if (stringbuffer.length() > 0) stringbuffer.append("\n");
              stringbuffer.append(s1);
            }
          l9 += (long) s1.length() + l1;
        } while (l9 < l8);
        if (hashmap2 != null) {
          if (s2.length() > 0) addAlertTag(hashmap2, s2, stringbuffer.toString());
          addAlertEntry(hashmap2, array1, hashmap);
        }
        for (int j = 0; j < array.size(); j++) array1.add(array.get(j));

        array = array1;
        if (l7 == 0L) flag = true;
        braf.close();
        braf = null;
        if (l5 <= l3 && l6 >= l4) flag = true;
      } while (true);
    } catch (IOException ioexception) {
      LogManager.log("Error", "I/O error reading file: " + s);
      System.out.println("I/O error reading file: " + s);
    } finally {
      if (braf != null)
        try {
          braf.close();
        } catch (IOException ioexception1) {
        }
    }
    return array;
  }