{"issue":{"created_at":"2011-12-06T00:55:06Z","state":"open","updated_at":"2011-12-08T15:12:55Z","user":{"gravatar_id":"2147c68b7ec5d32424a717c801525d56","id":655987,"url":"https://api.github.com/users/travisfw","avatar_url":"https://secure.gravatar.com/avatar/2147c68b7ec5d32424a717c801525d56?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"travisfw"},"comments":2,"body":"Enable an additional binding in the action and rest script environment to a map object which may be used to store objects for future calls and actions.\r\nA part of this change is introducing a new ScriptUtil class that sets up the script environment so that this code is not duplicated and so that future changes to scripting actions will change scripting rest calls and vice versa.","assignee":null,"id":2457103,"pull_request":{"patch_url":"https://github.com/internetarchive/heritrix3/pull/3.patch","html_url":"https://github.com/internetarchive/heritrix3/pull/3","diff_url":"https://github.com/internetarchive/heritrix3/pull/3.diff"},"labels":[],"number":3,"title":"save script state","html_url":"https://github.com/internetarchive/heritrix3/issues/3","closed_at":null,"url":"https://api.github.com/repos/internetarchive/heritrix3/issues/3","milestone":null},"action":"created","comment":{"created_at":"2011-12-08T15:12:55Z","updated_at":"2011-12-08T15:12:55Z","user":{"gravatar_id":"2147c68b7ec5d32424a717c801525d56","id":655987,"url":"https://api.github.com/users/travisfw","avatar_url":"https://secure.gravatar.com/avatar/2147c68b7ec5d32424a717c801525d56?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"travisfw"},"body":"In respective order:\r\n\r\nDo you mean to suggest that a ScriptedProcessor could be defined in the cxml to provide persistent values to other scripts? These script-generated values would be initialized when the cxml is built only? I anticipate the changes introduced in the pull request to be used for debugging and unpredictable circumstances, which is really the reason for the script rest call and action to exist. One would have to include a lot in such a ScriptedProcessor to anticipate unknown needs, and it would probably still fall short.\r\n\r\nGood point. It would be better to provide a map instance to the script and persist those values after the script ends in a thread safe manner. Essentially, provide isolation (the I from ACID). I don't anticipate needs for these values to survive beyond a crawl's lifetime or be shared between two crawl jobs, though such needs may exist. I had considered an alternative, to save state on the CrawlJob instance, but I couldn't find how to dig that up from the context of ActionDirectory.tryAsScript(File, String).\r\n\r\nI agree that context specific sharing makes sense, but should that be built out or would we be over engineering for unknown use cases? I don't like the idea of putting arbitrary key value stores for static code to use. Why would that be useful? The use case here is specific to scripts which are presently unable to save static state.\r\n\r\nTo me that would imply that this state is system level. The intention here is not specifically interaction with things outside the JVM.","id":3063530,"url":"https://api.github.com/repos/internetarchive/heritrix3/issues/comments/3063530"}}