setting initial parameters in procedural scripts

Poster Content
nk4um Administrator
Posts: 607
June 27, 2005 21:14Stateless accessors
I haven''t found a mechanism to successfully store changeable "static" state in scripts between invocations - that''s not to say there isn''t one just that I haven''t found it and I have dug around a bit in the past.

I can offer a few suggestions though:

1) If the data is truely static you could construct final variables in the code (sorry I''m not sure about python but you can do this in javascript and beanshell) and then access them. Because the code is pre-compiled you should be able to access them then in each invocation and they would get constructed only once. You can also factor these out into a library that is imported into each script.

2) If the data is semi-static configuration data then one solution that is in line with ReST philosophy is to pass in the configuration state to your script. This could be in the form of an XML document. We have used this approach quite extensively in applications.

Does this help?
Like · Post Reply
nk4um User
Posts: 3
June 27, 2005 13:18setting initial parameters in procedural scripts
I read that accessors are created and cached and start processing requests after the init method has completed (http://localhost:1060/book/advdev/doc_guide_ura_data). I have a number of (static) variables that I want to be set up prior to the accessor starts processing requests. If I was writing the accessors in Java, I would just invoke my own init/constructors. However I want to script these accessors as procedural modules in Jython. Can you suggest how I might initialise these variables in this case?


Martin Pike
Like · Post Reply