Пример #1
0
 public static Array createHealthGroup() throws SiteViewParameterException {
   String s = Platform.getRoot() + File.separator + "groups" + File.separator + "__Health__.mg";
   File file = new File(s);
   Array array = null;
   if (!file.exists()) {
     array = new Array();
     HashMap hashmap = new HashMap();
     hashmap.put("_encoding", I18N.getDefaultEncoding());
     hashmap.put("_health", "true");
     hashmap.put("_dependsCondition", "good");
     hashmap.put("_fileEncoding", I18N.getDefaultEncoding());
     hashmap.put("_name", "Health");
     hashmap.put("_nextID", "1");
     array.add(hashmap);
     try {
       FrameFile.writeToFile(s, array);
     } catch (IOException ioexception1) {
       String as[] = {"__Health__.mg", ioexception1.getMessage()};
       throw new SiteViewParameterException(SiteViewErrorCodes.ERR_OP_SS_HEALTH_CANNOT_WRITE, as);
     }
   } else {
     try {
       array = FrameFile.readFromFile(s);
     } catch (IOException ioexception) {
       LogManager.log(
           "error", "Couldn't read the Health group. Got Error: " + ioexception.getMessage());
     }
   }
   return array;
 }
Пример #2
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);
     }
   }
 }
Пример #3
0
 public static ArrayList getViews() {
   File file = new File(Platform.getRoot() + "/groups/views.config");
   long l = file.lastModified();
   if (viewConfigLastModified != l) {
     viewConfigLastModified = l;
     viewCache = new ArrayList();
     refreshCache("views.config", file, viewCache);
   }
   return viewCache;
 }
Пример #4
0
 public static ArrayList getQueries() {
   File file = new File(Platform.getRoot() + "/groups/query.config");
   long l = file.lastModified();
   if (queryConfigLastModified != l) {
     queryConfigLastModified = l;
     queryCache = new ArrayList();
     refreshCache("query.config", file, queryCache);
   }
   return queryCache;
 }
Пример #5
0
 static {
   centrascopeDebug = 0;
   StringProperty astringproperty[] = new StringProperty[0];
   addProperties("COM.dragonflow.SiteView.Portal", astringproperty);
   String s = System.getProperty("CentraScope.debug");
   if (s != null) {
     centrascopeDebug = TextUtils.toInt(s);
     System.out.println("centrascopeDebug=" + centrascopeDebug);
   }
   PORTAL_SERVERS_CONFIG_PATH =
       Platform.getRoot() + File.separator + "groups" + File.separator + "portal.config";
 }
Пример #6
0
 protected static String CheckCreateHealth() {
   String s = Platform.getRoot() + "/groups/" + "__Health__.mg";
   File file = new File(s);
   if (!file.exists()) {
     try {
       createHealthGroup();
     } catch (SiteViewParameterException siteviewparameterexception) {
       LogManager.log(
           "Error",
           "Unable to write Health file Error: "
               + siteviewparameterexception.getLocalizedMessage());
     }
   }
   return s;
 }
Пример #7
0
  public String[] getTemplateList(String s) throws SiteViewException {
    Vector vector = new Vector();
    String s1 = "";
    String s2 = "";
    int i = Machine.getOS("");
    String s3 = i != 1 ? "Unix" : "NT";
    if (!Platform.isStandardAccount(s)) {
      s1 =
          Platform.getRoot()
              + File.separator
              + "accounts"
              + File.separator
              + s
              + File.separator
              + "templates.health";
      if (!(new File(s1)).exists()) {
        s1 = Platform.getRoot() + s2 + File.separator + "templates.health";
      }
    } else {
      s1 = Platform.getRoot() + s2 + File.separator + "templates.health";
    }
    File file = new File(s1);
    String as[] = file.list();
    for (int j = 0; as != null && j < as.length; j++) {
      if (as[j].indexOf(".") < 0 && as[j].startsWith(s3)) {
        vector.addElement(as[j].substring(s3.length()));
      }
    }

    String as1[] = new String[vector.size()];
    for (int k = 0; k < vector.size(); k++) {
      as1[k] = (String) vector.elementAt(k);
    }

    return as1;
  }
Пример #8
0
 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"));
   }
 }
Пример #9
0
 static {
   exePath =
       Platform.getRoot() + File.separator + "bin" + File.separator + "ss_mon_single_run.exe ";
   nMaxCounters = 30;
   HashMap hashmap = MasterConfig.getMasterConfig();
   nMaxCounters = TextUtils.toInt(TextUtils.getValue(hashmap, "_DispatcherMaxCounters"));
   if (nMaxCounters <= 0) {
     nMaxCounters = 30;
   }
   StringProperty astringproperty[] = BrowsableBase.staticInitializer(nMaxCounters, true);
   exeTimeout = TextUtils.toInt(TextUtils.getValue(hashmap, "_browsableExeTimeout"));
   if (exeTimeout <= 0) {
     exeTimeout = 45000;
   }
   String s = (COM.dragonflow.SiteView.BrowsableExeBase.class).getName();
   addProperties(s, astringproperty);
 }
Пример #10
0
 public static ArrayList getEditableViewContentsArray(String s, boolean flag) throws IOException {
   ArrayList array = new ArrayList();
   if (flag) {
     array.add("");
     array.add("");
   }
   File file = new File(Platform.getRoot() + "/templates.view/");
   String as[] = file.list();
   if (as != null) {
     for (int i = 0; i < as.length; i++) {
       if (TextUtils.match(as[i], s)) {
         array.add(as[i]);
         array.add(as[i]);
       }
     }
   }
   return array;
 }
Пример #11
0
  private static void createHealthGroupList(String s) {
    if (groupIDsInHealth.contains(s)) {
      return;
    }
    groupIDsInHealth.add(s);
    String s1 = Platform.getRoot() + "/groups/";
    try {
      Array array = FrameFile.readFromFile(s1 + s + ".mg");
      for (int i = 1; i < array.size(); i++) {
        HashMap hashmap = (HashMap) array.at(i);
        String s2 = (String) hashmap.get("_class");
        if (s2 != null && s2.equals("SubGroup")) {
          createHealthGroupList((String) hashmap.get("_group"));
        }
      }

    } catch (IOException ioexception) {
      return;
    }
  }
Пример #12
0
  public String update(HashMap hashmap, String s) throws SiteViewException {
    String s1 = (String) hashmap.get("_healthTemplateSet");
    String s2 = "";
    String s3 = "";
    int i = Machine.getOS("");
    String s4 = i != 1 ? "Unix" : "NT";
    if (!Platform.isStandardAccount(s)) {
      s2 =
          Platform.getRoot()
              + File.separator
              + "accounts"
              + File.separator
              + s
              + File.separator
              + "templates.health";
      if (!(new File(s2)).exists()) {
        s2 = Platform.getRoot() + File.separator + "templates.health";
      }
      s3 =
          Platform.getRoot()
              + File.separator
              + "accounts"
              + File.separator
              + s
              + File.separator
              + "groups";
      if (!(new File(s3)).exists()) {
        s3 = Platform.getRoot() + File.separator + "groups";
      }
    } else {
      s2 = Platform.getRoot() + File.separator + "templates.health";
      s3 = Platform.getRoot() + File.separator + "groups";
    }
    if (s1 != null && s1.length() > 0) {
      File file = new File(s2);
      String as[] = file.list();
      Array array = null;
      try {
        array = FrameFile.readFromFile(s3 + "/" + "__Health__.mg");
      } catch (IOException ioexception) {
      }
      if (array == null || array.size() == 0) {
        array = createHealthGroup();
        APISiteView.forceConfigurationRefresh();
      }
      Array array1 = null;
      try {
        array1 = FrameFile.readFromFile(s2 + "/" + s4 + s1);
      } catch (IOException ioexception1) {
        String as1[] = {ioexception1.getMessage()};
        throw new SiteViewParameterException(
            SiteViewErrorCodes.ERR_OP_SS_HEALTH_NO_TEMPLATE_FILE, as1);
      }
      if (array != null && array1 != null) {
        HashMap hashmap1 = (HashMap) array.at(0);
        String s5 = (String) hashmap1.get("_nextID");
        for (int j = 1; j < array1.size(); j++) {
          HashMap hashmap2 = (HashMap) array1.at(j);
          HashMap hashmap3 = new HashMap();
          hashmap3.put("_id", s5);
          String s6;
          for (Enumeration enumeration = hashmap2.keys();
              enumeration.hasMoreElements();
              hashmap3.put(s6, hashmap2.get(s6))) {
            s6 = (String) enumeration.nextElement();
          }

          array.add(hashmap3);
          s5 = TextUtils.increment(s5);
        }

        hashmap1.put("_nextID", s5);
        try {
          FrameFile.writeToFile(s3 + "/" + "__Health__.mg", array);
        } catch (IOException ioexception2) {
          String as2[] = {"__Health__.mg", ioexception2.getMessage()};
          throw new SiteViewParameterException(
              SiteViewErrorCodes.ERR_OP_SS_HEALTH_CANNOT_WRITE, as2);
        }
      }
      hashmap.remove("_healthTemplateSet");
      updateMaster(hashmap);
      APIGroup.forceConfigurationRefresh();
      return s1;
    } else {
      hashmap.remove("_healthTemplateSet");
      updateMaster(hashmap);
      APIGroup.forceConfigurationRefresh();
      return "";
    }
  }
Пример #13
0
 public static String getPortalRootPath() {
   return Platform.getRoot() + File.separator + PORTAL_DIRECTORY;
 }
Пример #14
0
 String getExePath() {
   String s = Platform.getRoot() + File.separator + "logs";
   return exePath + getExeTimeout() + " \"" + s + "\" " + getMonDll() + " ";
 }