private String[] findNodeName(FileInputStream[] fileis) {
    String[] NodeName = new String[fileis.length];
    for (int i = 0; i < fileis.length; i++) {
      int length = 0;
      byte[] by = new byte[0];
      try {
        if (fileis[i] != null) {
          length = fileis[i].available();
          by = new byte[length];
          fileis[i].read(by);
          // fileis[i].reset();
        }
      } catch (IOException ioexp) {
        ioexp.printStackTrace();
      }

      String newdata = new String(by);
      String delimiterstart = new String("<nodeName>");
      String delimiterend = new String("</nodeName>");
      int startindex = newdata.indexOf(delimiterstart);
      int endindex = newdata.indexOf(delimiterend);
      String nodename = null;
      if ((startindex > -1) && (endindex > -1)) {
        nodename = newdata.substring(startindex, endindex);
        NodeName[i] = nodename;
      }
    }
    return NodeName;
  }
 protected Vector getsecurityevent(FileInputStream fileis) {
   int length = 0;
   byte[] by = new byte[0];
   // DOMParser parser=null;
   // InputSource isource=null;
   try {
     if (fileis != null) {
       length = fileis.available();
       by = new byte[length];
       fileis.read(by);
     }
     /* was trying to run xml parser. Having problems will look into it later
     if(fi!=null)
     {
     parser=new DOMParser();
     // parser.setEntityResolver(new ConfigResolver());
     isource=new InputSource(fi);
     parser.parse(isource);
     }
         */
   }
   /*
   catch(SAXException saxexp)
   {
   saxexp.printStackTrace();
   }*/
   catch (IOException ioexp) {
     ioexp.printStackTrace();
   }
   String newdata = new String(by);
   String delimiterstart = new String("<securityEvent>");
   String delimiterend = new String("</securityEvent>");
   int startindex = 0;
   int endindex = 0;
   int lastpt = 0;
   Vector data = new Vector();
   startindex = newdata.indexOf(delimiterstart);
   endindex = newdata.indexOf(delimiterend);
   while ((startindex > -1) && (endindex > -1)) {
     data.add(newdata.substring(startindex, endindex));
     lastpt = startindex;
     startindex = newdata.indexOf(delimiterstart, endindex);
     endindex = newdata.indexOf(delimiterend, startindex);
   }
   // data.add(newdata.substring(lastpt,newdata.length()));
   return data;
 }
  /**
   * Called inside of an open transaction whenever the plugin was explicitly told to run or when
   * there are changes to any of our subscriptions.
   */
  public void execute() {
    if (MonitoringUtils.debug > 0) {
      System.out.println("In exec of Sensor");
    }
    if (!publishedcapabilities) {
      if (MonitoringUtils.debug > 0) System.out.println("In Sensor Plugin publishing capabilities");
      publishedcapabilities = publishcapabilities();
      File filelist = null;
      if (Services.contains("SecurityException")) {
        String filename = secprop.getProperty(secprop.BOOTSTRAP_LOGFILE);
        if (filename != null) {
          int lastindex = filename.lastIndexOf(File.separator);
          filename = filename.substring(0, lastindex);
          filelist = new File(filename);
        } else {
          if (MonitoringUtils.debug > 0)
            System.out.println(
                "Could not get the log file name for security exception through java property .Probably org.cougaar.core.security.bootstrap.SecurityManagerLogFile is not set ---- using default values");
          String cougaarpath = secprop.getProperty(secprop.COUGAAR_INSTALL_PATH);
          StringBuffer logfilepath = new StringBuffer();
          logfilepath.append(cougaarpath);
          if (MonitoringUtils.debug > 0)
            System.out.println("got cougaar install path" + logfilepath.toString());
          logfilepath.append(File.separatorChar);
          logfilepath.append("log" + File.separatorChar + "bootstrap" + File.separator);
          if (MonitoringUtils.debug > 0)
            System.out.println("IN Sensor Plugin got log  path" + logfilepath.toString());
          filelist = new File(logfilepath.toString());
        }
        String[] filenames = null;
        if (filelist != null) {
          filenames = filelist.list();
          if ((filenames != null) && (filenames.length > 0)) {
            if (MonitoringUtils.debug > 0) {
              for (int i = 0; i < filenames.length; i++) {
                System.out.println("file name at : " + i + "  :: " + filenames[i]);
              }
            }
            String[] uniquelog = findUniquePerNode(filenames, filelist, "SecurityManager");
            if (MonitoringUtils.debug > 0) {
              for (int i = 0; i < uniquelog.length; i++) {
                System.out.println("file name unique at : " + i + "  :: " + uniquelog[i]);
              }
            }
            fi = new FileInputStream[uniquelog.length];
            File tempfile = null;
            for (int i = 0; i < uniquelog.length; i++) {
              tempfile = new File(filelist, uniquelog[i]);
              try {
                fi[i] = new FileInputStream(tempfile);
              } catch (IOException ioexp) {
                System.err.println(
                    "Error while opening file stream for file :::  " + tempfile.toString());
                ioexp.printStackTrace();
              }
            }
            nodename = findNodeName(fi);
            for (int i = 0; i < uniquelog.length; i++) {
              tempfile = new File(filelist, uniquelog[i]);
              try {
                fi[i] = new FileInputStream(tempfile);
              } catch (IOException ioexp) {
                System.err.println(
                    "Error while opening file stream for file :::  " + tempfile.toString());
                ioexp.printStackTrace();
              }
            }
          }
        }
      }
    }

    process_publishCmd(allcmd.getAddedList());
    double slp = Math.random();
    double crit = Math.random();
    while ((crit * 10) > 4 || ((crit * 10) == 0)) {
      crit = Math.random();
      // System.out.println("crit while gen is :"+crit*10);
    }
    slp *= 10 * 0.6;
    sleeptime = ((int) slp) * 100000l;
    if (sleeptime == 0) {
      sleeptime = 1000000l;
    }
    publishdata();
    wakeAfter(sleeptime);
  }