36 |
|
*/ |
37 |
|
public final int DEFAULT_AGE = 3600; |
38 |
|
|
39 |
+ |
/** |
40 |
+ |
* The default path seperator, here for convienience |
41 |
+ |
*/ |
42 |
+ |
private final String sep = File.separator; |
43 |
+ |
|
44 |
|
//---STATIC METHODS--- |
45 |
|
|
46 |
|
/** |
76 |
|
alertSubDir = cp.getProperty("WebFeeder", "WebFeeder.alertSubDir"); |
77 |
|
File alertsDir = new File(rootPath, alertSubDir); |
78 |
|
if(deleteContents(alertsDir)) { |
79 |
< |
_logger.write(this.toString(), Logger.DEBUG, "Deleted all files and directories from: "+rootPath+"/"+alertSubDir); |
79 |
> |
_logger.write(this.toString(), Logger.DEBUG, "Deleted all files and directories from: "+rootPath+sep+alertSubDir); |
80 |
|
} else { |
81 |
< |
_logger.write(this.toString(), Logger.WARNING, "Failed to delete all files and directories from: "+rootPath+"/"+alertSubDir); |
81 |
> |
_logger.write(this.toString(), Logger.WARNING, "Failed to delete all files and directories from: "+rootPath+sep+alertSubDir); |
82 |
|
} |
83 |
|
// cleanup complete |
84 |
|
} catch (PropertyNotFoundException e) { |
205 |
|
String data = packet.printAll(); |
206 |
|
String hostname = packet.getParam("packet.attributes.machine_name"); |
207 |
|
// set paths |
208 |
< |
File outDir = new File(rootPath, latestSubDir+"/"+hostname); |
209 |
< |
File outFile = new File(rootPath, latestSubDir+"/"+hostname+"/"+latestFileName); |
208 |
> |
File outDir = new File(rootPath, latestSubDir+sep+hostname); |
209 |
> |
File outFile = new File(rootPath, latestSubDir+sep+hostname+sep+latestFileName); |
210 |
|
// write the data out |
211 |
|
writeData(outDir, outFile, data); |
212 |
|
} |
235 |
|
String data = alert.printAll(); |
236 |
|
String hostname = alert.getSource(); |
237 |
|
// set paths |
238 |
< |
File outDir = new File(rootPath, alertSubDir+"/"+hostname); |
239 |
< |
String destFile = alertSubDir+"/"+hostname+"/"+alertFileName+"."+String.valueOf(alert.getInitialAlertTime()); |
238 |
> |
File outDir = new File(rootPath, alertSubDir+sep+hostname); |
239 |
> |
String destFile = alertSubDir+sep+hostname+sep+alertFileName+"."+String.valueOf(alert.getInitialAlertTime()); |
240 |
|
File outFile; |
241 |
|
// check if we're at a special "end case" (OK or FINAL) |
242 |
|
if(alert.getLevel()==0 || alert.getLevel()==Alert.alertLevels.length-1) { |