public String update(String as[], String as1[], String as2[]) {
    try {
      connect();
    } catch (Exception exception) {
      return exception.getMessage();
    }
    Set set = null;
    try {
      set =
          (Set)
              management.queryNamesMethod.invoke(
                  mbs,
                  new Object[] {
                    null,
                    management.finalSubStringMethod.invoke(
                        null,
                        new Object[] {
                          management.attrMethod.invoke(null, new Object[] {"Type"}),
                          management.valueMethod.invoke(null, new Object[] {"Runtime"})
                        })
                  });
    } catch (Exception exception1) {
      LogManager.log("Error", "Failed to query WebLogic server: " + exception1);
      return exception1.getMessage();
    }
    for (int i = 0; i < as1.length; i++) {
      int j = as1[i].lastIndexOf('/');
      if (j < 0) {
        continue;
      }
      String s = as1[i].substring(j + 1);
      String s2 = as1[i].substring(0, j);
      j = as[i].lastIndexOf('/');
      if (j < 0) {
        continue;
      }
      int k = as[i].lastIndexOf('/', j - 1);
      int l = as[i].indexOf(':', k);
      String s1 = as[i].substring(l + 1, j);
      Object obj = findObjectName(s1, s2, set);
      try {
        as2[i] = String.valueOf(management.getAttributeMethod.invoke(mbs, new Object[] {obj, s}));
        continue;
      } catch (Exception exception2) {
        LogManager.log("Error", exception2.toString());
      }
      LogManager.log(
          "Error",
          "Failed to get value for counter "
              + as1[i]
              + ". If this happens only a handfull of counters, it is probably due to a WebLogic bug");
      as2[i] = "Error: See log for detail";
    }

    return "OK";
  }
Example #2
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;
 }
Example #3
0
 private static void portalAssert(boolean flag, String s) {
   if (!flag) {
     System.out.println("ASSERT FAILED: " + s);
     LogManager.log("Error", "ASSERT FAILED: " + s);
     TextUtils.debugPrintStackTrace();
   }
 }
Example #4
0
 void loadPortalSiteView(HashMap hashmap) {
   LogManager.log("RunMonitor", "loading SiteView server " + TextUtils.getValue(hashmap, "_id"));
   PortalSiteView portalsiteview = new PortalSiteView();
   portalsiteview.readFromHashMap(hashmap);
   portalsiteview.initialize(hashmap);
   addElement(portalsiteview);
 }
  /**
   * CAUTION: Decompiled by hand.
   *
   * @param stringbuffer
   * @return
   */
  public String getBrowseData(StringBuffer stringbuffer) {
    try {
      connect();
      Weblogic6xObject weblogic6xobject = new Weblogic6xObject();
      addedMBeans = new Hashtable();
      Set set =
          (Set)
              management.queryNamesMethod.invoke(
                  mbs,
                  new Object[] {
                    null,
                    management.finalSubStringMethod.invoke(
                        null,
                        new Object[] {
                          management.attrMethod.invoke(null, new Object[] {"Type"}),
                          management.valueMethod.invoke(null, new Object[] {"Runtime"})
                        })
                  });

      int i = set.size();
      System.out.println("Weblogic6x: Found " + i + " beans.");
      Object obj = set.iterator();
      while (((Iterator) (obj)).hasNext()) {
        Object obj1 = ((Iterator) (obj)).next();
        if (!addedMBeans.containsKey(obj1)) {
          Weblogic6xObject weblogic6xobject1 = new Weblogic6xObject(obj1, mbs, management);
          if ((!weblogic6xobject1.getType().equals("WebAppComponentRuntime")
                  || !weblogic6xobject1.getName().equals("console")
                      && !weblogic6xobject1.getName().equals("wl_management_internal1")
                      && !weblogic6xobject1.getName().equals("wl_management_internal2"))
              && (!weblogic6xobject1.getType().equals("ServletRuntime")
                  || management
                      .getKeyPropertyMethod
                      .invoke(weblogic6xobject1.getParentName(), new Object[] {"Type"})
                      .equals("WebAppComponentRuntime"))) {
            addObject(weblogic6xobject1, weblogic6xobject);
          }
        }
      }

      weblogic6xobject.purge();
      obj = new CharArrayWriter();
      weblogic6xobject.printXML(new PrintWriter(((java.io.Writer) (obj))), 0);
      return ((CharArrayWriter) (obj)).toString();
    } catch (Throwable throwable) {
      Throwable throwable1 = throwable.getCause();
      if (throwable1 != null) {
        LogManager.log("Error", "WebLogic exception cause: " + throwable1.toString());
      }
      throwable.printStackTrace();
      String s = throwable.getMessage();
      if (s == null) {
        stringbuffer.append(
            "Unable to load the list of counters. Please check if you are using the correct version of the WebLogic jar file.");
      } else {
        stringbuffer.append(s);
      }
      return "";
    }
  }
Example #6
0
 /**
  * CAUTION: Decompiled by hand.
  *
  * @return
  */
 private int getPort() {
   try {
     int i = Integer.parseInt(getProperty(pPortNumber));
     return i;
   } catch (Exception e) {
     LogManager.log("error", "Failed to parse port string : " + getProperty(pPortNumber));
     return 623;
   }
 }
 /**
  * CAUTION: Decompiled by hand.
  *
  * @throws Exception
  */
 private void connect() throws Exception {
   try {
     String s;
     if (bSecure) {
       s = "t3s";
       System.setProperty("weblogic.security.SSL.ignoreHostnameVerification", "true");
       HttpsURLConnection.setDefaultHostnameVerifier(new NullHostnameVerifier());
     } else {
       s = "t3";
     }
     Hashtable hashtable = new Hashtable();
     hashtable.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
     hashtable.put("java.naming.provider.url", s + "://" + host);
     if (username.length() > 0 && password.length() > 0) {
       hashtable.put("java.naming.security.principal", username);
       hashtable.put("java.naming.security.credentials", password);
     }
     ClassLoader classloader = Thread.currentThread().getContextClassLoader();
     Class class1 = classloader.loadClass("javax.naming.InitialContext");
     Constructor constructor = class1.getConstructor(new Class[] {java.util.Hashtable.class});
     Method method = class1.getMethod("lookup", new Class[] {String.class});
     Object obj = constructor.newInstance(new Object[] {hashtable});
     Object obj1 = method.invoke(obj, new Object[] {"weblogic.management.home.localhome"});
     mbs = obj1.getClass().getMethod("getMBeanServer", null).invoke(obj1, null);
     LogManager.log("RunMonitor", "WebLogic6x: Connected");
   } catch (Throwable throwable) {
     Throwable throwable1 = throwable.getCause();
     if (throwable1 != null) {
       LogManager.log("Error", "WebLogic exception cause: " + throwable1.toString());
       String s1 = throwable1.getClass().getName();
       if ("javax.naming.NoInitialContextException".equals(s1)) {
         LogManager.log("Error", throwable.toString());
         throw new Exception("No WebLogic server found on " + host);
       }
       if ("javax.naming.AuthenticationException".equals(s1)) {
         LogManager.log("Error", throwable.toString());
         throw new Exception("Access denied for user " + username);
       }
       if ("javax.naming.CommunicationException".equals(s1)) {
         LogManager.log("Error", throwable.toString());
         throw new Exception("No WebLogic server found on " + host);
       }
     } else {
       LogManager.log("Error", "Exception '" + throwable.toString() + "' with cause == null");
     }
     throwable.printStackTrace();
     LogManager.log("Error", throwable.toString());
     String s2 = throwable.getClass().getName();
     if (s2.equals("weblogic.management.NoAccessRuntimeException")) {
       throw new Exception("Access denied for user " + username);
     }
     if (s2.equals("weblogic.common.internal.VersioningError")) {
       throw new Exception(
           "Server may be running external jar files. This is a known WebLogic issue and has a few workarounds:\n1. Place the jar file after the weblogic.jar entry in the classpath\n2. Instead of a jar file, keep the external classes in a directory structure and include the root directory instead of the jar file in classpatch\n3. If all else fails, provide the path to the weblogic jar file in the provided edit field of the \"Choose Counters\" screen");
     } else {
       throw new Exception("Unhandled exception thrown: " + s2 + " See log for details");
     }
   }
 }
Example #8
0
 public static String getHealthState() {
   String s = "good";
   String s1 = CheckCreateHealth();
   MonitorGroup monitorgroup = MonitorGroup.loadGroup("__Health__", s1);
   if (monitorgroup != null) {
     String s2 = monitorgroup.getProperty(MonitorGroup.pCategory);
     s = s2;
   } else {
     LogManager.log("Error", "Unable to find Health System.");
   }
   return s;
 }
Example #9
0
  void loadAllPortalSiteViews() {
    Object obj = null;
    try {
      ArrayList array = FrameFile.readFromFile(PORTAL_SERVERS_CONFIG_PATH);
      for (int i = 1; i < array.size(); i++) {
        HashMap hashmap = (HashMap) array.get(i);
        loadPortalSiteView(hashmap);
      }

    } catch (IOException ioexception) {
      LogManager.log("Error", "Could not load portal servers file: " + PORTAL_SERVERS_CONFIG_PATH);
    }
  }
Example #10
0
  private static void refreshCache(String s, File file, ArrayList array) {
    try {
      ArrayList array1 = FrameFile.readFromFile(file.getAbsolutePath());
      for (int i = 1; i < array1.size(); i++) {
        HashMap hashmap = (HashMap) array1.get(i);
        array.add(hashmap);
      }

      readExtraItems(s, array);
    } catch (IOException ioexception) {
      LogManager.log("Error", "Error reading file: " + ioexception.getMessage());
    }
  }
Example #11
0
 public static void main(String args[]) throws IOException {
   SiteViewSupport.argv = args;
   try {
     SiteViewSupport.InitProcess();
     SiteViewSupport.InitProcess2();
     SiteViewSupport.StartProcess(); /*Æô¶¯¼à²âÏß³Ì*/
     //            ApiForOfbiz.DisplayAllMonitor();
     SiteViewSupport.WaitForProcess();
   } catch (Exception exception) {
     exception.printStackTrace();
     LogManager.log("Error", Platform.productName + " unexpected shutdown: " + exception);
   }
   SiteViewSupport.ShutdownProcess();
 }
Example #12
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;
 }
Example #13
0
 private int exec(String s, ArrayList array) {
   int i = -1;
   BufferedReader bufferedreader = null;
   Process process = null;
   try {
     process = CommandLine.execSync(s);
     bufferedreader = FileUtils.MakeInputReader(process.getInputStream());
     do {
       String s1 = bufferedreader.readLine();
       if (s1 == null) {
         i = process.exitValue();
         break;
       }
       if (s1.startsWith(VALID_RES_END_INDICATOR)) {
         i = Integer.parseInt(s1.substring(VALID_RES_END_INDICATOR.length()));
         break;
       }
       array.add(s1);
     } while (true);
   } catch (Exception exception) {
     LogManager.log("error", exception.getMessage());
     i = -1;
     array.clear();
   }
   if (bufferedreader != null) {
     try {
       bufferedreader.close();
     } catch (IOException ioexception) {
       LogManager.log("error", ioexception.getMessage());
     }
   }
   if (process != null) {
     process.destroy();
   }
   return i;
 }
Example #14
0
 String getParameters() {
   String s = I18N.toDefaultEncoding(getProperty("_parameters"));
   if (TextUtils.isSubstituteExpression(s)) {
     s = TextUtils.substitute(s);
   }
   s = createFromTemplate(s);
   if (TextUtils.hasChars(s, "`;&|<>")) {
     LogManager.log(
         "Error",
         "Removed illegal characters from script monitor parameters \""
             + s
             + "\""
             + " for monitor "
             + getProperty(pName));
     s = TextUtils.removeChars(s, "`;&|<>");
   }
   return s;
 }
Example #15
0
 public Vector getScalarValues(ScalarProperty property, HTTPRequest request, CGI cgi) {
   if (property == getResetFileProperty()) {
     Vector v = new Vector();
     v.addElement("none");
     v.addElement("Never");
     v.addElement("once");
     v.addElement("First Time Only");
     v.addElement("always");
     v.addElement("Always");
     return v;
   }
   Vector vValues = null;
   try {
     vValues = super.getScalarValues(property, request, cgi);
   } catch (SiteViewException e) {
     LogManager.log("Error", "Exception " + e);
   }
   return vValues;
 }
Example #16
0
  public HashMap getTemplateTable() {
    if (templateID != null && templateTableLastUpdate < templateCacheLastUpdate) {
      templateTable = null;
      if (templateID.length() > 0) {
        if (templateCache == null) {
          templateCache = new HashMap();
          String s = "";
          Array array = getTemplateConfigFileList();
          for (int i = 0; i < array.size(); i++)
            try {
              s = (String) array.at(i);
              HashMap hashmap2 = new HashMap();
              Array array1 = FrameFile.readFromFile(s);
              templateCacheLastUpdate = Platform.timeMillis();
              for (int j = 1; j < array1.size(); j++) {
                HashMap hashmap3 = (HashMap) array1.at(j);
                hashmap2.put(TextUtils.getValue(hashmap3, "__id"), hashmap3);
              }

              resolveTemplateReferences(hashmap2);
              templateCache.add(s, hashmap2);
            } catch (IOException ioexception) {
              LogManager.log("Error", "Could not read template file " + s);
            }
        }
        if (templateCache != null) {
          String s1 = getTemplateConfigFilePath();
          HashMap hashmap = null;
          hashmap = (HashMap) templateCache.get(s1);
          if (hashmap != null) {
            HashMap hashmap1 = (HashMap) hashmap.get(templateID);
            if (hashmap1 != null) {
              templateTable = new HashMapOrdered(true);
              initializeValuesTable(hashmap1, templateTable, true);
            }
          }
        }
      }
      templateTableLastUpdate = Platform.timeMillis();
    }
    return templateTable;
  }
Example #17
0
  /**
   * CAUTION: Decompiled by hand.
   *
   * @param hashmap
   * @param hashmap1
   * @param i
   * @param j
   */
  static void resolveTemplateReferences(HashMap hashmap, HashMap hashmap1, int i, int j) {
    if (i > j) {
      LogManager.log("Error", "Loop detected in templates.config");
      return;
    }
    for (Enumeration enumeration = hashmap1.values("__template"); enumeration.hasMoreElements(); ) {
      String s = (String) enumeration.nextElement();
      HashMap hashmap2 = (HashMap) hashmap.get(s);
      if (hashmap2 != null) {
        resolveTemplateReferences(hashmap, hashmap2, i + 1, j);
        Enumeration enumeration1 = hashmap2.keys();
        while (enumeration1.hasMoreElements()) {
          String s1 = (String) enumeration1.nextElement();
          if (hashmap1.get(s1) == null) hashmap1.put(s1, hashmap2.get(s1));
        }
      }
    }

    hashmap1.remove("__template");
  }
Example #18
0
 public static String getViewContent(String s, HTTPRequest httprequest) {
   String s1 = "";
   String s2 =
       Platform.getUsedDirectoryPath("templates.view", httprequest.getAccount())
           + File.separator
           + s;
   try {
     s1 = FileUtils.readFile(s2).toString();
     s1 =
         TextUtils.replaceString(
             s1, "account=administrator", "account=" + httprequest.getAccount());
     s1 =
         TextUtils.replaceString(
             s1,
             "name=\"account\" value=\"administrator\"",
             "name=\"account\" value=\"" + httprequest.getAccount() + "\"");
   } catch (IOException ioexception) {
     LogManager.log("Error", "Could not read view file " + s2);
   }
   return s1;
 }
Example #19
0
 /** CAUTION: Decompiled by hand. */
 private static void insureMinHealth() {
   try {
     Array array = FrameFile.readFromFile(Health.CheckCreateHealth());
     if (array.size() > 1) {
       return;
     } else {
       HashMap hashmap = new HashMap();
       String as[] = Health.getHealth().getTemplateList("administrator");
       if (as != null && as.length > 0 && as[0].length() > 0) {
         hashmap.put("_healthTemplateSet", as[0]);
         hashmap.put("_healthDisableLogging", "");
         getHealth().update(hashmap, "administrator");
       }
     }
   } catch (Exception exception) {
     LogManager.log(
         "error",
         "Couldn't add default health monitors to the Health subsystem. Got Error: "
             + exception.getMessage());
   }
 }
Example #20
0
 public static void main(String args[]) throws IOException {
   SiteViewSupport.argv = args;
   try {
     // Class.forName("COM.dragonflow.Api.ECFServer");
     // ECFServer.start();
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   ;
   try {
     TftpServerStart.StartServer(); // 启动TFTP服务器
     SiteViewSupport.InitProcess();
     SiteViewSupport.InitProcess2();
     SiteViewSupport.StartProcess(); /*启动监测线程*/
     ApiRmiServer server = new ApiRmiServer();
     SiteViewSupport.WaitForProcess();
   } catch (Exception exception) {
     exception.printStackTrace();
     LogManager.log("Error", Platform.productName + " unexpected shutdown: " + exception);
   }
   SiteViewSupport.ShutdownProcess();
 }
Example #21
0
 public Vector getScalarValues(ScalarProperty scalarproperty, HTTPRequest httprequest, CGI cgi)
     throws SiteViewException {
   if (scalarproperty == pMIB) {
     Vector vector = new Vector();
     try {
       BrowsableMIB browsablemib = BrowsableMIB.getInstance();
       if (browsablemib.containsMIB(IPlanetWSMIB)) {
         vector.add(IPlanetWSMIB);
         vector.add(IPlanetWSMIB);
       }
     } catch (Exception exception) {
       LogManager.log(
           "Error",
           "IPlanet WS Monitor could not get BrowsableMIB instance: " + exception.getMessage());
     }
     if (vector.size() == 0) {
       vector.add("No MIBs Available");
       vector.add("No MIBs Available");
     }
     return vector;
   } else {
     return super.getScalarValues(scalarproperty, httprequest, cgi);
   }
 }
Example #22
0
 protected boolean update() {
   double ad[] = initializeStats();
   String as[] = initializeNameList();
   Enumeration enumeration = getMultipleValues(pItems);
   SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView();
   long l = getPropertyAsLong(pDelay) * 1000L;
   String s = getProperty(pStatic);
   s = s.trim();
   if (getPropertyAsBoolean(pRunMonitors)) {
     checkSequentially(ad, as, l, "");
   } else {
     int i = 0;
     do {
       if (!enumeration.hasMoreElements()) {
         break;
       }
       String s2 = (String) enumeration.nextElement();
       Monitor monitor = (Monitor) siteviewgroup.getElement(s2.replace(' ', '/'));
       if (monitor != this) {
         if (monitor != null) {
           if (!(monitor instanceof MonitorGroup)) {
             updateStats(ad, as, monitor, i++);
           }
         } else {
           LogManager.log(
               "Error",
               "Could not get monitor " + s2 + " in Composite Monitor " + getProperty(pName));
         }
       }
     } while (true);
   }
   String s1 = getProperty(pOperation);
   double d = 0.0D;
   double d1 = ad[0];
   double d2 = ad[1];
   String s3 = "";
   String s4 = "ok";
   if (s1.equals("Add")) {
     if (d1 != -999D && d2 != -999D) {
       d = d1 + d2;
       s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Add Result= " + d;
     } else {
       s4 = "n/a";
       s3 = s3 + " Add Result= n/a";
     }
   } else if (s1.equals("Multiply")) {
     if (d1 != -999D && d2 != -999D) {
       d = d1 * d2;
       s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Multiply Result= " + d;
     } else {
       s4 = "n/a";
       s3 = s3 + " Multiply Result= n/a";
     }
   } else if (s1.equals("Subtract12")) {
     if (d1 != -999D && d2 != -999D) {
       d = d1 - d2;
       s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Subtract Result= " + d;
     } else {
       s4 = "n/a";
       s3 = s3 + " Subtract Result= n/a";
     }
   } else if (s1.equals("Subtract21")) {
     if (d1 != -999D && d2 != -999D) {
       d = d2 - d1;
       s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Subtract Result= " + d;
     } else {
       s4 = "n/a";
       s3 = s3 + " Subtract Result= n/a";
     }
   } else if (s1.equals("Divide12")) {
     if (d1 != -999D && d2 != -999D && d2 != 0.0D) {
       d = d1 / d2;
       s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Divide Result= " + d;
     } else {
       s4 = "n/a";
       s3 = s3 + " Divide Result= n/a";
     }
   } else if (s1.equals("Divide21")) {
     if (d1 != -999D && d2 != -999D && d1 != 0.0D) {
       d = d2 / d1;
       s3 = s3 + as[0] + " = " + d1 + ", " + as[1] + " = " + d2 + ", Divide Result= " + d;
     } else {
       s4 = "n/a";
       s3 = s3 + " Divide Result= n/a";
     }
   }
   if (!s4.equals("n/a") && s.length() > 0) {
     String s5 = s.substring(0, 1);
     s = s.substring(1);
     if (s.length() > 0) {
       double d3 = TextUtils.toDouble(s);
       if (d3 != 0.0D && d != -999D) {
         if (s5.equals("+")) {
           d += d3;
         } else if (s5.equals("*")) {
           d *= d3;
         } else if (s5.equals("-")) {
           d -= d3;
         } else if (s5.equals("/")) {
           d /= d3;
         }
       }
     }
     int j = s3.indexOf("Result= ");
     s3 = s3.substring(0, j) + "Result= " + d;
   }
   if (stillActive()) {
     synchronized (this) {
       if (s4.equals("ok")) {
         setProperty(pResult, String.valueOf(d));
         setProperty(pStatus, s4);
         if (getProperty(pValueLabels).length() > 0) {
           setProperty(pStateString, s3 + ", " + (String) getLabels().get("result") + " = " + d);
         } else {
           setProperty(pStateString, s3);
         }
       } else {
         setProperty(pResult, "n/a");
         setProperty(pStatus, "n/a");
         setProperty(pNoData, "n/a");
         setProperty(pStateString, s3);
       }
     }
   }
   return true;
 }
  public synchronized boolean execute() {
    try {
      SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView();
      Array array = new Array();
      Array array1 = new Array();
      Array array2 = new Array();
      Array array3 = siteviewgroup.getGroupFiles();
      Enumeration enumeration = array3.elements();
      File file = null;
      File file1 = null;
      File file2 = null;
      File file3 = null;
      HashSet hashset = new HashSet();
      for (Enumeration enumeration1 = fileNameMap.keys();
          enumeration1.hasMoreElements();
          hashset.add(enumeration1.nextElement())) {}
      String s;
      for (; enumeration.hasMoreElements(); hashset.remove(s)) {
        File file4 = (File) enumeration.nextElement();
        s = file4.getAbsolutePath();
        Long long1 = (Long) fileNameMap.get(s);
        if (long1 == null) {
          if (file4.getName().equals("history.config")) {
            file = file4;
          } else if (file4.getName().equals("dynamic.config")) {
            file2 = file4;
          } else {
            array.add(file4);
          }
        } else if (long1.longValue() != file4.lastModified()) {
          if (file4.getName().equals("history.config")) {
            file1 = file4;
          } else if (file4.getName().equals("dynamic.config")) {
            file3 = file4;
          } else {
            array1.add(file4);
            if (file4.getAbsolutePath().endsWith(".mg")) {
              //                            TopazConfigurator.checkModified(file4);
            }
          }
        }
        long1 = new Long(file4.lastModified());
        fileNameMap.put(s, long1);
      }

      if (file2 != null) {
        array.add(file2);
      }
      if (file3 != null) {
        array1.add(file3);
      }
      if (file != null) {
        array.add(file);
      }
      if (file1 != null) {
        array1.add(file1);
      }
      String s1;
      for (Iterator iterator = hashset.iterator();
          iterator.hasNext();
          LogManager.log("Debug", "group deleted: " + s1)) {
        s1 = (String) iterator.next();
        fileNameMap.remove(s1);
        File file5 = new File(s1);
        array2.add(file5);
        if (file5.getAbsolutePath().endsWith(".mg")) {
          //                    TopazConfigurator.checkDeleted(file5);
        }
      }

      HashMap hashmap = new HashMap();
      siteviewgroup.adjustGroups(array, array1, array2, hashmap);
      for (HashMapIterator hashmapiterator = hashmap.begin();
          !hashmapiterator.atEnd();
          hashmapiterator.advance()) {
        fileNameMap.put(hashmapiterator.key(), hashmapiterator.value());
      }

    } catch (Exception exception) {
      LogManager.log("Error", "Error loading configuration: " + exception);
      LogManager.log("Error", "  detail: " + FileUtils.stackTraceText(exception));
    }
    clearConfigChangeFlag();
    return true;
  }
Example #24
0
  public static Vector getScriptList(String s, String s1, HTTPRequest httprequest) {
    Vector vector = new Vector();
    String s2 = s1;
    if (s2 == null || s2.length() == 0) {
      s2 = "scripts";
    }
    s = Machine.getFullMachineID(s, httprequest);
    if (Machine.isPortalMachineID(s)) {
      String s3 = Machine.getServerIDFromMachineID(s);
      PortalSiteView portalsiteview = (PortalSiteView) Portal.getPortal().getElement(s3);
      if (portalsiteview != null) {
        String s4 =
            "/SiteView/cgi/go.exe/SiteView?page=remoteOp&operation=scripts&machineID="
                + Machine.getMachineFromMachineID(s)
                + "&account=administrator";
        ArrayList array2 = portalsiteview.sendURLToRemoteSiteView(s4, null);
        for (int i1 = 0; i1 < array2.size(); i1++) {
          vector.addElement(array2.get(i1));
        }

      } else {
        LogManager.log("Error", "Could not find SiteView ID: " + s3);
      }
    } else if (Machine.isNTSSH(s)) {
      RemoteFile remotefile = new RemoteFile(s, "scripts");
      ArrayList array = remotefile.listFiles();
      for (int j = 0; j < array.size(); j++) {
        String s5 = I18N.toNullEncoding((String) array.get(j));
        if (!s5.endsWith(".txt")
            && !s5.endsWith("directory.bat")
            && (s5.endsWith(".bat")
                || s5.endsWith(".vbs")
                || s5.endsWith(".exe")
                || s5.endsWith(".pl")
                || s5.endsWith(".sh"))) {
          String as1[] = TextUtils.split(s5, " ");
          s5 = as1[as1.length - 1].trim();
          vector.addElement(s5);
          vector.addElement(s5);
        }
      }

    } else if (Platform.isCommandLineRemote(s)) {
      RemoteFile remotefile1 = new RemoteFile(s, "scripts");
      int i = Machine.getOS(s);
      ArrayList array1 = remotefile1.listFiles();
      for (int l = 0; l < array1.size(); l++) {
        String s7 = I18N.toNullEncoding((String) array1.get(l));
        if (!s7.endsWith(".txt") && (!Platform.isUnix(i) || !s7.startsWith("."))) {
          vector.addElement(s7);
          vector.addElement(s7);
        }
      }

    } else {
      File file = new File(Platform.getUsedDirectoryPath(s2, httprequest.getAccount()));
      String as[] = file.list();
      for (int k = 0; k < as.length; k++) {
        String s6 = I18N.toNullEncoding(as[k]);
        if (s6.endsWith(".txt") || Platform.isUnix() && s6.startsWith(".")) {
          continue;
        }
        File file1 = new File(file, as[k]);
        if (!file1.isDirectory()) {
          vector.addElement(s6);
          vector.addElement(s6);
        }
      }
    }
    return vector;
  }
Example #25
0
  /** CAUTION: Decompiled by hand. */
  protected boolean update() {
    long l = Platform.timeMillis();
    int i = -1;
    String[] as = (new String[] {""});
    String s = getProperty(pExpression);
    long l1 = getPropertyAsLong(pMaxMeasurement);
    int j = getPropertyAsInteger(pCacheLife);
    boolean flag = j > 0;
    ArrayList array = new ArrayList();
    String s1 = "";

    try {
      String s2 = I18N.toDefaultEncoding(getProperty(pScript));
      String s3 = I18N.toDefaultEncoding(getProperty(pRemoteScript));
      String s4 = null;
      String s7 = I18N.toDefaultEncoding(getProperty(pLocalScriptLocation));
      if (s7.length() == 0) {
        s7 = "scripts";
      } else if (s7.indexOf("../") >= 0 || s7.indexOf("..\\") >= 0) {
        failMonitorRun(i, "Illegal Script Location contains ../ construct");
        return true;
      }

      s1 = getProperty(pMachineName);
      if (Machine.isNTSSH(s1) && s2.equals("USE COMMAND")) {
        failMonitorRun(i, "Can't use this option with remote NT ssh connection");
        return true;
      }

      if (Platform.isRemote(s1) && Machine.getMachine(s1) == null) {
        failMonitorRun(i, "Remote host unreachable");
        return true;
      }

      if (Platform.isNTRemote(s1) && !Machine.isNTSSH(s1)) {
        failMonitorRun(i, "NT host must be configured as NT ssh remote ");
        return true;
      }

      if (s3.equals("none") && s2.equals("USE COMMAND")) {
        failMonitorRun(i, "Need to specify a script");
        return true;
      }

      if (s3.length() != 0 && !s3.equals("none")) {
        try {
          s4 = getCommandFromLocalFile(s3);
          s4 = TextUtils.replaceParameters(s4, getParameters(), getReplacementChars());
        } catch (IOException ioexception) {
          LogManager.log("Error", " File load error " + ioexception.toString());
          setProperty(pNoData, "n/a");
        }
      } else {
        if (!Platform.isRemote(s1)) {
          String s8 = Platform.getRoot() + "/" + s7 + "/" + s2;
          File file = new File(s8);
          s4 = file.getAbsolutePath();
        } else {
          String s9 = "scripts" + Machine.getMachinePathSeparator(s1) + s2;
          OSAdapter osadapter = Machine.getAdapter(s1);
          if (osadapter != null) {
            CommandLine commandline = new CommandLine();
            String s11 = osadapter.getCommandSetting("fileExists", "changeDirectory");
            if (s11.length() > 0) {
              s4 = s11;
            } else {
              s4 = "/usr/bin/cd";
            }
            commandline.exec(s4, s1, Platform.getLock(s1));
          }
          RemoteFile remotefile = new RemoteFile(s1, s9);
          s4 = remotefile.getFullPath();
        }
        s4 = s4 + " " + getParameters();
        System.out.println("Script: " + s4);
      }
      LogManager.log("RunMonitor", "Script monitor command: " + s4 + ", machine: " + s1);
      String s10 = s1;
      if (s10.startsWith("\\\\")) {
        s10 = s10.substring(2);
      }
      Machine machine = Machine.getNTMachine(s10);
      int j1 = getPropertyAsInteger(pTimeout) * 1000;
      if (j1 < 0) {
        j1 = getSettingAsLong("_scriptMonitorTimeout", -1) * 1000;
      }
      String s12 = getScriptServerName(s1);
      String s14 =
          getProperty(pScript).equals("USE COMMAND")
              ? getProperty(pRemoteScript)
              : getProperty(pScript);
      ScriptMonitorCache scriptmonitorcache =
          new ScriptMonitorCache(s12, s14, getPropertyAsInteger(pCacheLife));
      if (!flag && alertDebug) {
        System.out.println("Caching is disabled.");
      }
      boolean flag1 = scriptmonitorcache.isFresh();
      if (flag && flag1 && scriptmonitorcache.getExitValue() == 0) {
        if (alertDebug) {
          System.out.println(
              "Caching is enabled, the cache life time is set to: "
                  + getPropertyAsInteger(pCacheLife));
        }
        if (alertDebug) {
          System.out.println(
              "The cache is still good, not exec'ing script, cache last modified on: "
                  + scriptmonitorcache.getLastModDate());
        }
        array = scriptmonitorcache.getOutput();
        i = scriptmonitorcache.getExitValue();
      } else if (machine != null && Machine.isNTSSH(s10)) {
        if (s4.indexOf("\\\\" + s10) > 0) {
          s4 = TextUtils.replaceString(s4, "\\\\" + s10, "");
        }
        s4 = "scripts\\" + s4.substring(s4.indexOf(s2));
        if (j1 > 0) {
          s4 = CommandLine.getExecSyncCmd(s10, s4, j1, true);
        }
        SSHCommandLine sshcommandline = new SSHCommandLine();
        array = sshcommandline.exec(s4, machine, false);
        i = sshcommandline.exitValue;
      } else {
        CommandLine commandline1 = new CommandLine();
        array = commandline1.exec(s4, s1, Platform.monitorLock, j1);
        i = commandline1.getExitValue();
      }
      if (flag && !flag1) {
        if (alertDebug) {
          System.out.println("Exec'd script and updating cache.");
        }
        scriptmonitorcache.update(i, array);
      }
      if (i < 0) {
        String s16 = "Failed to run script";
        if (i == Monitor.kURLTimeoutError) {
          s16 = "Script timed out";
        }
        failMonitorRun(i, s16);
        return true;
      }

      StringBuffer stringbuffer1 = new StringBuffer();
      String s17;
      Enumeration enumeration = (Enumeration) array.iterator();
      while (enumeration.hasMoreElements()) {
        s17 = (String) enumeration.nextElement();
        LogManager.log("RunMonitor", "Script monitor machine " + s1 + " output: " + s17);
        if (s17.startsWith(CommandLine.PERFEX_EXECSYNC_TIMEOUT)) {
          failMonitorRun(-1, "Error: Timeout");
          return true;
        }
        if (s17.indexOf("not found") > 0
            || s17.indexOf("Not Found") > 0
            || s17.indexOf("denied") > 0
            || s17.indexOf("Denied") > 0
            || s17.indexOf("cannot execute") > 0
            || s17.indexOf("such file or directory") > 0) {
          failMonitorRun(-1, s17);
          return true;
        }

        stringbuffer1.append(s17);
        stringbuffer1.append("\n");
        if (s.length() > 0 && !TextUtils.isRegularExpression(s) && s17.indexOf(s) != -1) {
          long l4 = TextUtils.findLong(s17, "", "");
          if (l4 != -1L) {
            as[0] = String.valueOf(l4);
          }
        }
      }

      if (TextUtils.isSubstituteExpression(s)) {
        s = TextUtils.substitute(s, this);
      }
      if (s.length() > 0 && TextUtils.isRegularExpression(s)) {
        String s18 = stringbuffer1.toString();
        Perl5Util perl5util = new Perl5Util();
        if (perl5util.match(s, s18)) {
          int i2 = perl5util.groups();
          if (i2 > 0) {
            if (i2 == 1) {
              as = new String[i2];
              as[0] = perl5util.group(0);
            } else {
              if (--i2 > maxNumberOfMatches) {
                i2 = maxNumberOfMatches;
              }
              as = new String[i2];
              for (int j2 = 0; j2 < as.length && j2 < maxNumberOfMatches; j2++) {
                as[j2] = perl5util.group(j2 + 1);
              }
            }
          }
        } else {
          failMonitorRun(-1, "Content Match Error");
          return true;
        }
      }
    } catch (Exception exception) {
      LogManager.log("RunMonitor", "Script monitor error: " + exception + " machine: " + s1);
      setProperty(pNoData, "n/a");
    }

    LogManager.log("RunMonitor", "Script monitor exit: " + i + " machine: " + s1);
    setProperty(pScriptOutput, "");
    if (as[0].trim().length() == 0) {
      as[0] = "n/a";
      long l2 = getSettingAsLong("_scriptMonitorLinesToSave", 25);
      String s5 = "";
      for (int k = 0; k < array.size() && (long) k < l2; k++) {
        s5 = s5 + array.get(k);
        s5 = s5 + "^";
      }

      s5 = s5.replace('\r', ' ');
      s5 = s5.replace('\n', '^');
      setProperty(pScriptOutput, s5);
    }
    long l3 = Platform.timeMillis() - l;
    String s6 = TextUtils.floatToString((float) l3 / 1000F, 2) + " sec";
    if (stillActive()) {
      synchronized (this) {
        for (int i1 = 0; i1 < as.length; i1++) {
          setProperty(pMatchValue[i1], as[i1]);
        }

        setProperty(pStatus, i);
        if (i != 0) {
          setProperty(pNoData, "n/a");
        }
        setProperty(pRoundTripTime, l3);
        setProperty(pMeasurement, getMeasurement(pRoundTripTime, l1));
        if (s.length() > 0) {
          HashMap hashmap = getLabels();
          StringBuffer stringbuffer = new StringBuffer();
          for (int k1 = 0; k1 < as.length; k1++) {
            String s13 = getNameFromIndex(k1);
            String s15 = (String) hashmap.get(s13);
            if (s15 == null) {
              s15 = s13;
            }
            stringbuffer.append(s15 + "=" + as[k1] + (k1 >= as.length - 1 ? "" : ","));
          }

          setProperty(pStateString, stringbuffer);
        } else {
          setProperty(pStateString, "exit: " + i + ", " + s6);
        }
      }
    }
    return true;
  }
  protected boolean update() {
    if (Platform.isWindows()) {
      for (int i = 0; i < getStateValues().length; i++) {
        unsetProperty(getStateValues()[i]);
      }

      if ((getMediaTrace() & 4) != 0) {
        mediaDebug("MediaPlayerMonitorBase(): Entered");
      }
      Array array = new Array();
      String s = getMediaCommand();
      if ((getMediaTrace() & 4) != 0) {
        mediaDebug("getMediaCommand(): " + s);
      }
      CommandLine commandline = new CommandLine();
      array = commandline.exec(s);
      int j = commandline.getExitValue();
      if ((getMediaTrace() & 4) != 0) {
        mediaDebug("mediaCommand: " + s + ",getExitValue(): " + j);
      }
      for (Enumeration enumeration = array.elements();
          enumeration.hasMoreElements();
          mediaDebug("Results: " + enumeration.nextElement())) {}
      boolean flag = false;
      if (j == 0) {
        try {
          BufferedReader bufferedreader = new BufferedReader(new FileReader(mediaLog));
          do {
            String s1;
            if ((s1 = bufferedreader.readLine()) == null) {
              break;
            }
            if (parseRecord(s1)) {
              flag = true;
            }
          } while (true);
          if (flag) {
            String s3 = "URL: " + getProperty(getPMediaURL());
            Array array1 = getCounters();
            for (int l = 0; l < array1.size(); l++) {
              if (l == 0) {
                s3 = s3 + "&nbsp";
              }
              String s4 = prepLabel((String) array1.at(l));
              s3 = s3 + s4 + "&nbsp;" + getProperty(getStateValues()[l]);
              if (l < array1.size() - 1) {
                s3 = s3 + ", ";
              }
            }

            setProperty(pStateString, s3);
            setProperty(getPStatus(), "ok");
          }
        } catch (FileNotFoundException filenotfoundexception) {
          LogManager.log("Error", "Error Opening: " + mediaLog + " " + filenotfoundexception);
          setProperty(pStateString, "Error opening media log file: " + mediaLog);
          setProperty(getPStatus(), "Error");
        } catch (IOException ioexception) {
          LogManager.log("Error", "Error reading: " + mediaLog + " " + ioexception);
          setProperty(pStateString, "Error reading media log file: " + mediaLog);
          setProperty(getPStatus(), "Error");
        }
      }
      if (!flag) {
        String s2 = "";
        StringBuffer stringbuffer = new StringBuffer();
        String s5 = "";
        System.out.println("Error in monitor !");
        try {
          BufferedReader bufferedreader1 = new BufferedReader(new FileReader(mediaLog + "_"));
          do {
            String s6;
            if ((s6 = bufferedreader1.readLine()) == null) {
              break;
            }
            stringbuffer.append(s6);
            int k = s6.indexOf("Error:");
            if (k >= 0) {
              if (s2.length() > 0) {
                s2 = s2 + "<br>";
              }
              s2 = s2 + s6.substring(k + 6).trim();
            }
          } while (true);
        } catch (FileNotFoundException filenotfoundexception1) {
          s2 = "File Not Found Exception occurrred while reading error log file.";
        } catch (IOException ioexception1) {
          s2 = "I/O Exception occurred while reading error log file.";
        }
        if (s2.length() > 0) {
          setError(handleUpdateError(s2));
        } else {
          setError(stringbuffer.toString());
        }
      }
      File file = new File(mediaLog);
      if (file != null) {
        if ((getMediaTrace() & 2) != 0) {
          mediaDebug("Delete Temp File: " + mediaLog);
        }
        try {
          file.delete();
        } catch (SecurityException securityexception) {
          LogManager.log(
              "Error",
              "MediaPlayerMonitorBase Security Exception caught deleting temp file: " + mediaLog);
        }
      } else {
        LogManager.log("Error", "MediaPlayerMonitorBase Error deleting temp file: " + mediaLog);
      }
      file = new File(mediaLog + "_");
      if (file != null) {
        if ((getMediaTrace() & 2) != 0) {
          mediaDebug("Delete Temp File: " + mediaLog + "_");
        }
        try {
          file.delete();
        } catch (SecurityException securityexception1) {
          LogManager.log(
              "Error",
              "MediaPlayerMonitorBase Security Exception caught deleting temp file: " + mediaLog);
        }
      } else {
        LogManager.log(
            "Error", "MediaPlayerMonitorBase Error deleting temp file: " + mediaLog + "_");
      }
      if ((getMediaTrace() & 4) != 0) {
        mediaDebug("MediaPlayerMonitorBase(): Exited");
      }
      return true;
    } else {
      return false;
    }
  }
 protected void mediaDebug(String s) {
   LogManager.log("RunMonitor", "MEDIA TRACE: " + s);
 }
Example #28
0
  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;
  }
Example #29
0
  protected boolean update() {
    String s = getProperty(pMachineName);
    long l = 0L;
    long l1 = 0L;
    try {
      l = Long.parseLong(getProperty(pLastMeasurement));
      l1 = Long.parseLong(getProperty(pLastPageFaults));
    } catch (NumberFormatException numberformatexception) {
    }
    ArrayList array = null;
    if (monitorDebugLevel == 3) {
      array = new ArrayList();
    }
    long al[] = Platform.getMemoryFull(s, l1, l, this, array);
    long l2 = al[0];
    long l3 = al[2];
    long l4 = l3 - al[1];
    long l5 = al[3];
    long l6 = al[4];
    l1 = al[5];
    l = al[6];
    long l7 = al[7];
    String s1 = "" + l4 / 0x100000L;
    float f = -1F;
    if (l5 != -1L && l6 != 0L) {
      float f1 = (float) l6 / (float) l7;
      f = (float) l5 / f1;
      if ((double) f < 0.001D) {
        f = 0.0F;
      }
    }
    if (stillActive()) {
      synchronized (this) {
        setProperty(pLastPageFaults, l1);
        setProperty(pLastMeasurement, l);
        if (l2 == -1L) {
          setProperty(pPercentFull, "n/a");
          setProperty(pFreeSpace, "n/a");
          setProperty(pPageFaultsPerSecond, "n/a");
          setProperty(pMeasurement, 0);
          setProperty(pStateString, "no data");
          setProperty(pNoData, "n/a");
          if (monitorDebugLevel == 3 && array != null) {
            StringBuffer stringbuffer = new StringBuffer();
            for (int i = 0; i < array.size(); i++) {
              stringbuffer.append(array.get(i) + "\n");
            }

            LogManager.log(
                "Error", "MemoryMonitor: " + getFullID() + " failed, output:\n" + stringbuffer);
          }
        } else {
          setProperty(pPercentFull, l2);
          setProperty(pFreeSpace, l4 / 0x100000L);
          setProperty(pMeasurement, getMeasurement(pPercentFull));
          String s2 = l2 + "% used, " + s1 + "MB free";
          if (f == -1F) {
            setProperty(pPageFaultsPerSecond, "n/a");
          } else {
            setProperty(pPageFaultsPerSecond, f);
            s2 = s2 + ", " + TextUtils.floatToString(f, 2) + " pages/sec";
          }
          setProperty(pStateString, s2);
        }
      }
    }
    return true;
  }
  /**
   * CAUTION: Decompiled by hand.
   *
   * @param s
   * @param s1
   * @param set
   * @return
   */
  Object findObjectName(String s, String s1, Set set) {
    Object obj = null;
    try {
      Object obj1;
      obj = management.objectNameCtr.newInstance(new Object[] {s1});
      obj1 = set.iterator();

      Object obj2;
      while (((Iterator) (obj1)).hasNext()) {

        obj2 = ((Iterator) (obj1)).next();
        if (((Boolean) management.equalsMethod.invoke(obj2, new Object[] {obj})).booleanValue()) {
          return obj2;
        }
      }
    } catch (Exception exception) {
      return null;
    }

    System.out.println("Fannie Mae Problem start");

    try {
      if (management
          .getKeyPropertyMethod
          .invoke(obj, new Object[] {"Type"})
          .equals("ServletRuntime")) {
        String result = (String) management.getKeyPropertyMethod.invoke(obj, new Object[] {"Name"});
        int i;
        for (i = result.length() - 1; i >= 0 && Character.isDigit(result.charAt(i)); i--) {}

        Object obj3 = null;
        Object obj4;
        String s3;
        String s2;
        Iterator iterator = set.iterator();
        while (iterator.hasNext()) {
          obj4 = iterator.next();
          s2 = (String) management.getKeyPropertyMethod.invoke(obj4, new Object[] {"Type"});
          if (s2 != null && s2.equals("ServletRuntime")) {
            s3 = (String) management.getKeyPropertyMethod.invoke(obj4, new Object[] {"Name"});
            if (s3.regionMatches(0, result, 0, i)) {

              try {
                String s4 =
                    (String)
                        management.getAttributeMethod.invoke(
                            mbs, new Object[] {obj4, "ServletName"});
                if (s4 != null) {
                  if (s4.equals(s)) {
                    System.out.println("Found object by ServletName");
                    return obj4;

                  } else {
                    break;
                  }
                }
              } catch (Exception e1) {
                if (obj3 != null) {

                  LogManager.log(
                      "RunMonitor",
                      "Ambiguous near macth found:\n   " + obj3 + "\n" + "   " + obj4);
                  return null;
                }
                obj3 = obj4;
              }
            }
          }
        }
        return obj3;
      }
    } catch (Exception e) {
      return null;
    }

    return null;
  }