/** * Gets the latest index file created for a job suite (if one exists). * @param suiteWorkdir suite working directory * @param suiteId suite unique ID (ID of the root job) * @return file the index file */ public static File getSuiteIndexFile( String suiteWorkdir, String suiteId) { return new File(suiteWorkdir + File.separator + "latest" + File.separator + FileUtil.toSafeFileName(suiteId) + ".index"); } }
/** * Gets the file used to store the job progress. * @param suiteName name space given to the job progress * @param jobId the job unique name * @return file used to store the job process */ private File getStatusFile(final String suiteName, final String jobId) { resolveDirsIfNeeded(); return new File(jobdirLatest + "/" + FileUtil.toSafeFileName(suiteName) + "__" + FileUtil.toSafeFileName(jobId) + ".job"); } /**
/** * Gets the log file used by this log manager. * @param suiteId log file suiteId * @return log file */ public File getLogFile(final String suiteId) { if (suiteId == null) { return null; } resolveDirsIfNeeded(); return new File(logdirLatest + "/" + FileUtil.toSafeFileName(suiteId) + LOG_SUFFIX); }
@Override public final Appender createAppender(final String suiteId) throws IOException { resolveDirsIfNeeded(); return new FileAppender(new PatternLayout(LAYOUT_PATTERN), logdirLatest + "/" + FileUtil.toSafeFileName(suiteId) + LOG_SUFFIX); }
/*default*/ File getSuiteStopFile() { return new File(getWorkdir() + File.separator + "latest" + File.separator + FileUtil.toSafeFileName(getId()) + ".stop"); } /*default*/ List<IJobLifeCycleListener> getJobLifeCycleListeners() {
b.append("d."); b.append(FileUtil.toSafeFileName(segPart));
String fileName = StringUtils.stripToEmpty( FileUtil.toSafeFileName(fileNamePrefix)) + fileBaseName + StringUtils.stripToEmpty( FileUtil.toSafeFileName(fileNameSuffix)) + "_" + rollCount + ".json"; if (compress) {
@Override public ICrawlDataStore createCrawlDataStore(ICrawlerConfig config, boolean resume) { String storeDir = config.getWorkDir().getPath() + "/crawlstore/mvstore/" + FileUtil.toSafeFileName(config.getId()) + "/"; return new MVStoreCrawlDataStore(storeDir, resume); }
+ FileUtil.toSafeFileName(suiteName) + "__" + FileUtil.toSafeFileName(jobId) + ".job");
String fileName = StringUtils.stripToEmpty( FileUtil.toSafeFileName(fileNamePrefix)) + fileBaseName + StringUtils.stripToEmpty( FileUtil.toSafeFileName(fileNameSuffix)) + "_" + rollCount + ".xml"; if (compress) {
@Override public final void backup(final String suiteId, final Date backupDate) throws IOException { resolveDirsIfNeeded(); String date = new SimpleDateFormat( "yyyyMMddHHmmssSSSS").format(backupDate); File progressFile = getLogFile(suiteId); File backupDir = FileUtil.createDateDirs( new File(logdirBackupBase), backupDate); backupDir = new File(backupDir, "logs"); if (!backupDir.exists()) { try { FileUtils.forceMkdir(backupDir); } catch (IOException e) { throw new JEFException("Cannot create backup directory: " + backupDir, e); } } File backupFile = new File( backupDir + "/" + date + "__" + FileUtil.toSafeFileName(suiteId) + LOG_SUFFIX); if (progressFile.exists()) { FileUtil.moveFile(progressFile, backupFile); } }
@Override public ICrawlDataStore createCrawlDataStore( ICrawlerConfig config, boolean resume) { String storeDir = config.getWorkDir().getPath() + "/crawlstore/jdbc/" + FileUtil.toSafeFileName(config.getId()) + "/"; return new JDBCCrawlDataStore( storeDir, resume, createJDBCSerializer()); }
date + "__" + FileUtil.toSafeFileName(getId()) + ".index"); if (!indexFile.renameTo(backupFile)) { throw new IOException("Could not create backup file: "