/** * 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); }