mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-11-15 10:20:47 +00:00
HER-1984 save script state - implement by adding a map to the application context for arbitrary use, and make sure the app context is available in all scripting environments
* PathSharingContext.java
new member variable ConcurrentHashMap data and accessor getData()
* ScriptedProcessor.java, ScriptedDecideRule.java
make appCtx available to scripts; also remove unused member sharedMap
* ActionDirectory.java
formatting fix
This commit is contained in:
1 parent
55ec01c4e4
commit
803f9ca979
4 files changed
+20
-9
No files matched your search
@@ -23,6 +23,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -178,4 +179,18 @@ public class PathSharingContext extends FileSystemXmlApplicationContext {
|
||||
}
|
||||
super.initLifecycleProcessor();
|
||||
}
|
||||
|
||||
protected ConcurrentHashMap<Object, Object> data;
|
||||
|
||||
/**
|
||||
* @return a shared map for arbitrary use during a crawl; for example, could
|
||||
* be used for state persisting for the duration of the crawl,
|
||||
* shared among ScriptedProcessor, scripting console, etc scripts
|
||||
*/
|
||||
public ConcurrentHashMap<Object, Object> getData() {
|
||||
if (data == null) {
|
||||
data = new ConcurrentHashMap<Object, Object>();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user